This commit is contained in:
cansnow
2025-12-05 16:10:52 +08:00
parent 29be534f22
commit 69a61178e1
64 changed files with 2575 additions and 1141 deletions
@@ -0,0 +1,289 @@
<template>
<view class="content-circle-box" :index="index">
<view @tap="linkToBusinessCard(item.user_id)">
<MyAvatar :src="item.user.avatar" :desc="item.user.nickname || item.user.id" :isGroup="false" size="66"></MyAvatar>
</view>
<view class="content">
<view class="content-name" @tap="linkToBusinessCard(item.user_id)">{{ item.user.nickname || item.user.remark }}</view>
<view class="content-desc">{{ item.body }}</view>
<!-- 图片,视频 -->
<view class="content-img" v-if="item.files!=null&&item.files.length>0">
<!-- //只有一张图时候 -->
<view v-if="item.files.length==1&&item.releaseType==1" class="u-flex u-row-left u-col-center"
style="width:100%;min-height: 200rpx;">
<u-image width="280rpx" :src="cdn(item.files[0])" mode="widthFix"
@tap="previewImg(0, item)">
<u-loading slot="loading"></u-loading>
<view slot="error" class="u-flex u-row-left u-col-center"
style="font-size: 24rpx;width: 200rpx;height: 100rpx;margin-top: -50rpx;">
<u-icon name="photo" size="100" label="加载失败" label-pos="bottom"></u-icon>
</view>
</u-image>
</view>
<!-- 有多张图的时候 -->
<view v-if="item.files.length > 1&&item.releaseType==1">
<view class="content-img-more u-m-b-20">
<u-grid :col="3" :border="false" hover-class="none">
<u-grid-item v-for="(src, index) in item.files" :index="index" :custom-style="girdItemCustomStyle">
<view @tap="previewImg(index, item)" class="slot-btn">
<u-image :src="cdn(src)" width="180rpx" height="180rpx" mode="aspectFill" border-radius="10"></u-image>
</view>
</u-grid-item>
</u-grid>
</view>
</view>
<!-- 视频 -->
<view class="u-m-b-30 u-m-t-30 u-flex u-row-left u-col-center"
v-if="item.fileList.length > 0&&item.releaseType==2" @tap="previewImg(0, item)">
<view v-if="vuex_OSPlat=='ios'">
<u-image width="280rpx" :src="getVideoPoster(item.fileList[0])" mode="widthFix">
<u-loading slot="loading"></u-loading>
</u-image>
</view>
<view v-else class="u-flex u-row-center u-col-center"
style="border: 1rpx solid #36648b;width:280rpx;height:120rpx;border-radius: 16rpx;">
<u-icon name="play-circle" size="48" color="#36648b"
label="点击查看视频" label-pos="bottom"></u-icon>
</view>
</view>
</view>
<!-- 地点 -->
<view v-if="(item.address&&item.address.chooseFlag)==true" class="u-line-2 u-m-t-10 u-m-b-10" style="font-size: 30rpx;color: #36648b;">
<u-icon name="map" color="#36648b" size="30" :custom-style="{marginLeft:'-4rpx'}"></u-icon>
<text> {{ item.address.name}}</text>
</view>
<!-- 相对时间 点赞按钮等 -->
<view class="relavivetime" :id="`comment-${'null'}-${index}`">
<view class="time u-flex u-col-center">
<view>{{ item.created_at }}</view>
<view @click="deleteCircle(item,index)" style="color:#36648b;margin-left: 20rpx;" v-if="item.user_id==selfInfo.userID">删除</view>
</view>
<view class="icon-box u-flex u-row-between u-col-center">
<view @tap="clickThumb(item,index)" class="u-m-r-6 u-p-t-4">
<u-icon v-if="item.isPraise==false" size="38" name="heart" color="#36648b"></u-icon>
<u-icon v-if="item.isPraise==true" size="38" name="heart-fill" color="#36648b"></u-icon>
</view>
<view @tap="handleComment(item.id, null, index)" class="u-m-l-6 u-p-t-2">
<u-icon size="40" name="chat" color="#36648b"></u-icon>
</view>
</view>
</view>
<!-- 点赞人 评论 -->
<view class="msg-box">
<view class="thumbinfo u-border-bottom" v-if="item.praise!=null&&item.praise.length">
<uni-icons size="30" type="heart" color="#36648b" class="u-m-r-10"></uni-icons>
<text class="thumbinfo-name" v-for="(userInfo, pindex) in item.praise" :index="pindex"
:key="pindex" @tap="linkToBusinessCard(userInfo.userId)">
{{ userInfo.nickame }}{{ pindex != item.praise.length - 1 ? '' : '' }}
</text>
</view>
<view class="comment" v-if="item.comments!=null&&item.comments.length">
<view class="comment-box" v-for="(comment, commentIndex) in item.comments" :index="commentIndex"
:key="commentIndex" hover-class="comment-hover-class"
:id="`comment-${item.id}-${index}`"
@tap="handleComment(item.id, comment, index)">
<text class="comment-box-name" v-if="!comment.reply_user_id">{{ comment.replyUser.nickname }}</text>
<text class="comment-box-name" v-if="comment.reply_user_id">
{{ comment.replyUser.nickname }}
<text class="callback u-m-l-4 u-m-r-4">回复</text>
</text>
<text v-if="comment.reply_user_id" class="comment-box-name">{{ comment.replyUser.nickname }}</text>
<text class="comment-box-content">{{ comment.content }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import MyAvatar from "@/components/MyAvatar/index.vue";
import videoPlayer from '@/components/videoPlayer.vue';
export default{
components:{videoPlayer ,MyAvatar},
props:{
index:{
type:Number,
default:0
},
item:{
type:Object,
default(){
return {};
}
}
},
computed:{
selfInfo() {
return this.$store.getters.storeSelfInfo;
},
},
data(){
console.log(this.item);
return {
}
},
methods:{
}
}
</script>
<style scoped lang="scss">
.content-circle-box {
padding: 18rpx 30rpx;
border-bottom: 1rpx solid #f2eeee;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: flex-start;
.headimg {
width: 80rpx;
height: 80rpx;
.img {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
.content {
flex: 1;
padding-left: 18rpx;
font-size: 32rpx;
&-name {
color: #36648b;
font-weight: bold;
font-size: 32rpx;
}
&-desc {
color: #000000;
padding-top: 4rpx;
//line-height: 36rpx;
font-size: 32rpx;
}
&-img {
margin-top: 10rpx;
.img-1 {
will-change: transform;
width: 280rpx;
height: auto;
max-height: 400rpx;
}
&-more {
display: flex;
flex-wrap: wrap;
.img-more {
display: block;
width: 160rpx;
height: 160rpx;
margin: 4rpx;
}
.img-3 {
margin: 4rpx 4rpx 4rpx 0;
}
}
}
.msg-box {
width: 100%;
background-color: #FFF;
margin-top: 15rpx;
border-radius: 4rpx;
.thumbinfo {
// border-bottom: 1rpx solid gray;
padding: 6rpx;
display: flex;
align-items: center;
flex-wrap: wrap;
&-icon {
width: 28rpx;
height: 28rpx;
line-height: 28rpx;
margin-right: 15rpx;
text-align: center;
vertical-align: middle;
padding-left: 10rpx;
}
&-name {
font-size: 28rpx;
color: #36648b;
}
}
.comment {
padding: 6rpx 8rpx;
color: $uni-text-color;
font-size: 28rpx;
&-box {
padding: 4rpx 0;
&-name {
color: #36648b;
.callback {
color: $uni-text-color;
}
}
&-content {
word-break: break-all;
}
}
}
}
}
.relavivetime {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 26rpx;
.time {
color: $uni-text-color-grey;
}
.icon-box {
display: flex;
align-items: center;
&-item {
//background-color: #F8F8F8;
padding: 4rpx 12rpx;
border-radius: 6rpx;
&.thumb {
margin-right: 10rpx;
}
}
.img {
width: 34rpx;
height: 34rpx;
}
}
}
}
</style>
@@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>
+38 -173
View File
@@ -1,7 +1,14 @@
<template>
<view class="content" id="content">
<u-navbar bgColor="transparent" title="朋友圈" title-size="36" leftIconColor="#fff"
:titleStyle ="{color:'#fff'}" :title-bold="true" :border-bottom="false">
<u-navbar
@leftClick="goto('/pages/workbench/index/index')"
bgColor="transparent"
title="朋友圈"
title-size="36"
leftIconColor="#fff"
:titleStyle ="{color:'#fff'}"
:title-bold="true"
:border-bottom="false">
<view slot="right" class="u-margin-right-20" @click="showTypeSheet"
@longpress="linkToRelease({releaseType:0})">
<u-icon name="camera" color="#fff" size="32"></u-icon>
@@ -18,22 +25,21 @@
<MyAvatar class="headimg" :src="selfInfo.faceURL" :desc="selfInfo.nickname || selfInfo.remark"
:isGroup="Boolean(selfInfo.groupID)" size="66" @tap="linkToBusinessCard(selfInfo.userID)" />
<text class="nickname">{{ selfInfo.nickname || self.remark }}</text>
<text class="nickname">{{ selfInfo.nickname || selfInfo.remark }}</text>
</view>
<!-- 个性签名 -->
<view class="signature">
<view class="">{{ selfInfo.bio }}</view>
</view>
<view class="u-m-t-20 u-m-b-30 u-flex u-row-center u-col-center" v-if="vuex_friendCircleUnreadCount>0">
<view class="u-flex u-row-left u-col-center" @click="clearUnReadCount()"
style="width: 300rpx;height:70rpx;background-color: #333333;color: #ffffff;border-radius:10rpx;">
<view v-if="vuex_friendCircleUnreadCount>0" style="display: flex;justify-content: center;">
<view @click="clearUnReadCount()"
style="width: 300rpx;height:70rpx;line-height:70rpx;background-color: #333333;color: #ffffff;border-radius:10rpx;display: flex;align-items: center;">
<view style="width:80rpx;padding:0 10rpx;">
<MyAvatar class="headimg" :src="selfInfo.faceURL" :desc="selfInfo.nickname || selfInfo.remark"
:isGroup="Boolean(selfInfo.groupID)" size="66"/>
<MyAvatar :src="selfInfo.faceURL" class="headimg" desc=" " size="24"/>
</view>
<view style="width:220rpx;text-align: center;">
<text>{{vuex_friendCircleUnreadCount}}条新信息</text>
<view style="flex:1;">
{{vuex_friendCircleUnreadCount}}条新信息
</view>
</view>
</view>
@@ -42,107 +48,9 @@
<view class="content-circle">
<!-- circleData是vuex变量不在本页面定义 -->
<template v-if="circleData!=null&&circleData.length>0">
<view class="content-circle-box" v-for="(item, index) in circleData" :key="index" :index="index">
<view @tap="linkToBusinessCard(item.user_id)">
<MyAvatar :src="item.user.avatar" :desc="item.user.nickname || item.user.id" :isGroup="false" size="66"></MyAvatar>
</view>
<view class="content">
<view class="content-name" @tap="linkToBusinessCard(item.user_id)">{{ item.user.nickname || item.user.remark }}</view>
<view class="content-desc">{{ item.body }}</view>
<!-- 图片,视频 -->
<view class="content-img" v-if="item.files!=null&&item.files.length>0">
<!-- //只有一张图时候 -->
<view v-if="item.files.length==1&&item.releaseType==1" class="u-flex u-row-left u-col-center"
style="width:100%;min-height: 200rpx;">
<u-image width="280rpx" :src="cdn(item.files[0])" mode="widthFix"
@tap="previewImg(0, item)">
<u-loading slot="loading"></u-loading>
<view slot="error" class="u-flex u-row-left u-col-center"
style="font-size: 24rpx;width: 200rpx;height: 100rpx;margin-top: -50rpx;">
<u-icon name="photo" size="100" label="加载失败" label-pos="bottom"></u-icon>
</view>
</u-image>
</view>
<!-- 有多张图的时候 -->
<view v-if="item.files.length > 1&&item.releaseType==1">
<view class="content-img-more u-m-b-20">
<u-grid :col="3" :border="false" hover-class="none">
<u-grid-item v-for="(src, index) in item.files" :index="index" :custom-style="girdItemCustomStyle">
<view @tap="previewImg(index, item)" class="slot-btn">
<u-image :src="cdn(src)" width="180rpx" height="180rpx" mode="aspectFill" border-radius="10"></u-image>
</view>
</u-grid-item>
</u-grid>
</view>
</view>
<!-- 视频 -->
<view class="u-m-b-30 u-m-t-30 u-flex u-row-left u-col-center"
v-if="item.fileList.length > 0&&item.releaseType==2" @tap="previewImg(0, item)">
<view v-if="vuex_OSPlat=='ios'">
<u-image width="280rpx" :src="getVideoPoster(item.fileList[0])" mode="widthFix">
<u-loading slot="loading"></u-loading>
</u-image>
</view>
<view v-else class="u-flex u-row-center u-col-center"
style="border: 1rpx solid #36648b;width:280rpx;height:120rpx;border-radius: 16rpx;">
<u-icon name="play-circle" size="48" color="#36648b"
label="点击查看视频" label-pos="bottom"></u-icon>
</view>
</view>
</view>
<!-- 地点 -->
<view v-if="(item.address&&item.address.chooseFlag)==true" class="u-line-2 u-m-t-10 u-m-b-10" style="font-size: 30rpx;color: #36648b;">
<u-icon name="map" color="#36648b" size="30" :custom-style="{marginLeft:'-4rpx'}"></u-icon>
<text> {{ item.address.name}}</text>
</view>
<!-- 相对时间 点赞按钮等 -->
<view class="relavivetime" :id="`comment-${'null'}-${index}`">
<view class="time u-flex u-col-center">
<view>{{ item.created_at }}</view>
<view @click="deleteCircle(item,index)" style="color:#36648b;margin-left: 20rpx;" v-if="item.user_id==selfInfo.userID">删除</view>
</view>
<view class="icon-box u-flex u-row-between u-col-center">
<view @tap="clickThumb(item,index)" class="u-m-r-6 u-p-t-4">
<u-icon v-if="item.isPraise==false" size="38" name="heart" color="#36648b"></u-icon>
<u-icon v-if="item.isPraise==true" size="38" name="heart-fill" color="#36648b"></u-icon>
</view>
<view @tap="handleComment(item.id, null, index)" class="u-m-l-6 u-p-t-2">
<u-icon size="40" name="chat" color="#36648b"></u-icon>
</view>
</view>
</view>
<!-- 点赞人 评论 -->
<view class="msg-box">
<view class="thumbinfo u-border-bottom" v-if="item.praise!=null&&item.praise.length">
<uni-icons size="30" type="heart" color="#36648b" class="u-m-r-10"></uni-icons>
<text class="thumbinfo-name" v-for="(userInfo, pindex) in item.praise" :index="pindex"
:key="pindex" @tap="linkToBusinessCard(userInfo.userId)">
{{ userInfo.nickame }}{{ pindex != item.praise.length - 1 ? '' : '' }}
</text>
</view>
<view class="comment" v-if="item.comments!=null&&item.comments.length">
<view class="comment-box" v-for="(comment, commentIndex) in item.comments" :index="commentIndex"
:key="commentIndex" hover-class="comment-hover-class"
:id="`comment-${item.id}-${index}`"
@tap="handleComment(item.id, comment, index)">
<text class="comment-box-name" v-if="!comment.reply_user_id">{{ comment.replyUser.nickname }}</text>
<text class="comment-box-name" v-if="comment.reply_user_id">
{{ comment.replyUser.nickname }}
<text class="callback u-m-l-4 u-m-r-4">回复</text>
</text>
<text v-if="comment.reply_user_id" class="comment-box-name">{{ comment.replyUser.nickname }}</text>
<text class="comment-box-content">{{ comment.content }}</text>
</view>
</view>
</view>
</view>
</view>
<template v-for="(item, index) in circleData" >
<CircleItem :key="index" :index="index" :item="item"></CircleItem>
</template>
</template>
<template v-else>
<view style="margin-top: 30%;">
@@ -259,11 +167,12 @@
import {getFriendCircle} from "@/api/login.js"
import UserBase from "@/components/User.vue"
import MyAvatar from "@/components/MyAvatar/index.vue";
import util from "@/util/index.js"
import util from "@/util/index.js";
import CircleItem from "./components/circleItem.vue"
export default {
name: 'firendCircle',
mixins:[UserBase],
components:{videoPlayer ,MyAvatar},
components:{videoPlayer ,MyAvatar,CircleItem},
computed: {
selfInfo() {
return this.$store.getters.storeSelfInfo;
@@ -382,6 +291,7 @@
},
methods: {
goto:util.goto,
clearUnReadCount(){
this.$store.dispatch('circle/updateUnreadCount',0-this.vuex_friendCircleUnreadCount);
},
@@ -389,60 +299,6 @@
getCircleDataList:function(param){
let that=this;
this.$store.dispatch('circle/getFriendCircleList',param);
return ;
getFriendCircle(param).then(res => {
//console.log("朋友圈列表",res);
let circleDataList=res.data;
//console.log("朋友圈列表",circleDataList);
if(circleDataList.length>0){
that.loadMoreFlag=true;
for (var i = 0; i < circleDataList.length; i++) {
let item= circleDataList[i];
if(item.userId==this.selfInfo.userID){
item.userName="我";
}
if(item.address!=null&&item.address.length>0){
item.address=JSON.parse(item.address);
}
if(item.fileList!=null&&item.fileList.length>0){
item.fileList=JSON.parse(item.fileList);
if(item.releaseType==2){
}
}
if(item.praise!=null){
item.praise=JSON.parse(item.praise);
}else{
item.praise=[];
}
if(item.comment!=null&&item.comment.length>0){
item.comment=JSON.parse(item.comment);
}
else{
item.comment=[];
}
}
}else{
if(param.moreFlag==true){
that.loadMoreFlag=false;
}
return;
}
//初始化列表
if(param.moreFlag==false){
console.log("初始化朋友圈列表",circleDataList.length);
that.circleData = circleDataList;
//that.$u.vuex('circleData', circleDataList);
}
//加载更多
else{
let oldList=that.circleData;
let newList=oldList.concat(circleDataList);
that.circleData = circleDataList;
//that.$u.vuex('circleData', newList);
console.log("加载更多朋友圈列表",newList);
}
})
},
//滚动事件
@@ -680,7 +536,7 @@
tempFilePaths = res.tempFilePaths;
let param = {
releaseType: 1,
tempFilePaths: JSON.stringify(tempFilePaths)
tempFilePaths: tempFilePaths
}
that.linkToRelease(param);
return;
@@ -698,7 +554,7 @@
tempFilePaths.push(filePath);
let param = {
releaseType: 2,
tempFilePaths: JSON.stringify(tempFilePaths)
tempFilePaths: tempFilePaths
}
that.linkToRelease(param);
return;
@@ -709,10 +565,19 @@
},
//点击自定义组件相机按钮
linkToRelease(params) {
uni.$u.route({
url: '/pages/workbench/friend-circle/releaseFriendCircle',
params: params
});
console.log(params);
let url = "/pages/workbench/friend-circle/releaseFriendCircle?";
for(let key in params){
if(key!="tempFilePaths"){
url+=key+"="+params[key]+"&";
}
}
uni.navigateTo({
url:url,
success(res) {
res.eventChannel.emit('successEvent',params);
}
})
},
getVideoPoster(videoSrc){
console.log("video",videoSrc);
@@ -53,15 +53,15 @@
<!-- :value="address.name" :value-style="customValueStyle" :label="address.address" -->
<u-cell bg-color="#ffffff"
:title="address.chooseFlag?(address.name):'所在位置'" :title-style="customTitleStyle"
:label="address.chooseFlag?(address.address):'请选择'"
:value="address.chooseFlag?(address.address):'请选择'" isLink
@click="toChooseLocation()">
<view slot="icon" class="u-flex u-row-center u-col-center">
<u-icon name="map" size="32" :color="address.chooseFlag?'#19be6b':'#606266'"></u-icon>
</view>
</u-cell>
<u-cell bg-color="#ffffff" title="提醒谁看" :title-style="customTitleStyle" @click="toRemind()">
<u-cell bg-color="#ffffff" title="提醒谁看" :title-style="customTitleStyle" @click="toRemind">
<view slot="icon" class="u-flex u-row-center u-col-center">
<u-icon name="/static/images/friendCircle/at.png" width="32" height="32" color="#606266"></u-icon>
<u-icon name="/static/images/friendCircle/at.png" width="24" height="24" color="#606266"></u-icon>
</view>
</u-cell>
<u-cell bg-color="#ffffff" @click="toSetPromission()"
@@ -90,6 +90,11 @@
components:{
videoPlayer
},
computed: {
circleData() {
return this.$store.getters.storeCircleData;
}
},
data() {
return {
winWidth:0,
@@ -173,18 +178,24 @@
if (this.releaseType == 2) {
this.navbarTitle = "发表视频";
}
if (option.tempFilePaths != null && option.tempFilePaths != undefined && option.tempFilePaths.length > 0) {
this.tempFilePaths = JSON.parse(option.tempFilePaths);
if(this.releaseType!=0){
//console.log("不是纯文字")
this.submitFlag=false; //可以直接发布
const _this = this;
const eventChannel = this.getOpenerEventChannel();
// 注意在 onUnload 取消监听,避免监听常驻内存
eventChannel.on('successEvent', function(data) {
console.log(data)
if (data.tempFilePaths != null && data.tempFilePaths != undefined && data.tempFilePaths.length > 0) {
_this.tempFilePaths = data.tempFilePaths;
if(_this.releaseType!=0){
//console.log("不是纯文字")
_this.submitFlag=false; //可以直接发布
}
for (var i = 0; i < _this.tempFilePaths.length; i++) {
let url= _this.tempFilePaths[i];
_this.tempUploadFilePath.push({url:url});
}
//console.log("准备发朋友圈的临时文件", _this.tempUploadFilePath);
}
for (var i = 0; i < this.tempFilePaths.length; i++) {
let url= this.tempFilePaths[i];
this.tempUploadFilePath.push({url:url});
}
//console.log("准备发朋友圈的临时文件", this.tempUploadFilePath);
}
})
},
@@ -202,6 +213,14 @@
}
});
},
onUnload() {
try {
const eventChannel = this.getOpenerEventChannel();
eventChannel.off('successEvent');
} catch (error) {
//TODO handle the exception
}
},
methods: {
cdn:util.cdn,
@@ -214,7 +233,7 @@
//监听输入
inputing:function(e){
let content=e.detail.value.trim();
//console.log("content",content);
console.log("content",content);
if(content.length>0){
this.submitFlag=false;
}else{
@@ -225,11 +244,7 @@
//如果不是纯文字
else{
//附件列表没有
if(this.tempFilePaths.length<1){
this.submitFlag=true;
}else{
this.submitFlag=false;
}
this.submitFlag = this.tempFilePaths.length<1;
}
}
},
@@ -247,11 +262,7 @@
//如果不是纯文字
else{
//附件列表没有
if(this.tempFilePaths.length<1){
this.submitFlag=true;
}else{
this.submitFlag=false;
}
this.submitFlag = this.tempFilePaths.length<1;
}
}
},
@@ -432,7 +443,7 @@
else{
newCircle.comment=[];
}
let circleDataList=this.circleData;
let circleDataList=[...this.circleData];
circleDataList.unshift(newCircle);
that.$u.vuex('circleData', circleDataList);
that.btnLoading = false;