Files
im/pages/find/friend-circle/components/circleItem.vue
T

360 lines
8.9 KiB
Vue
Raw Normal View History

2025-12-05 16:10:52 +08:00
<template>
<view class="content-circle-box" :index="index">
<view @tap="linkToBusinessCard(item.user_id)">
2025-12-08 02:29:46 +08:00
<MyAvatar :src="item.user.avatar" :desc="item.user.nickname || item.user.id" :isGroup="false" size="48"></MyAvatar>
2025-12-05 16:10:52 +08:00
</view>
<view class="content">
<view class="content-name" @tap="linkToBusinessCard(item.user_id)">{{ item.user.nickname || item.user.remark }}</view>
2025-12-08 02:29:46 +08:00
<view class="content-desc">
<text class="u-line-5" selectable user-select>{{item.body}}</text>
<!-- <u-text :lines="5" :text="item.body" selectable /> -->
2025-12-08 02:29:46 +08:00
</view>
2025-12-05 16:10:52 +08:00
<!-- 图片,视频 -->
<view class="content-img" v-if="item.files!=null&&item.files.length>0">
2025-12-08 02:29:46 +08:00
<!-- //只有一张图时候 -->
<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)">
<u-loading-icon slot="loading"></u-loading-icon>
<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>
2025-12-05 16:10:52 +08:00
</view>
2025-12-08 02:29:46 +08:00
</u-image>
</view>
<!-- 有多张图的时候 -->
<view v-if="item.files.length > 1&&item.releaseType==1">
<view class="content-img-more u-m-b-20">
<uni-grid :column="3" showBorder borderColor="#FFF" hover-class="none" :highlight="false">
<uni-grid-item v-for="(src, index) in item.files" :key="index" :index="index">
<view class="slot-btn">
<u-image @tap="previewImg(index)" :src="cdn(src)" width="180rpx" height="180rpx" mode="aspectFill" border-radius="10"></u-image>
</view>
</uni-grid-item>
</uni-grid>
2025-12-05 16:10:52 +08:00
</view>
2025-12-08 02:29:46 +08:00
</view>
<!-- 视频 -->
2026-02-09 07:29:02 +08:00
<view class="u-m-b-30 u-m-t-30 u-flex u-row-left u-col-center"
2025-12-08 02:29:46 +08:00
v-if="item.files.length > 0&&item.releaseType==2" @tap="previewImg(0, item)">
2026-02-09 07:29:02 +08:00
<view class="u-flex u-row-center u-col-center"
2025-12-08 02:29:46 +08:00
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>
2025-12-05 16:10:52 +08:00
</view>
<!-- 地点 -->
2026-02-09 07:29:02 +08:00
<view v-if="(item.address&&item.address.chooseFlag)==true" @click="gotomap(item)" class="content-address">
<u-icon name="map" color="#36648b"></u-icon>
<u-text class="name" :lines="1" :text="item.address.name"></u-text>
2025-12-05 16:10:52 +08:00
</view>
<!-- 相对时间 点赞按钮等 -->
<view class="relavivetime" :id="`comment-${'null'}-${index}`">
2025-12-08 02:29:46 +08:00
<view class="time">
2025-12-05 16:10:52 +08:00
<view>{{ item.created_at }}</view>
2026-01-11 13:51:16 +08:00
<view @click="deleteCircle(item,index)" style="color:#36648b;margin-left: 20rpx;" v-if="item.user_id==storeSelfInfo.userID">删除</view>
2025-12-05 16:10:52 +08:00
</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">
2025-12-08 02:29:46 +08:00
<u-icon v-if="item.is_liked==false" size="24" name="heart" color="#36648b"></u-icon>
<u-icon v-if="item.is_liked==true" size="24" name="heart-fill" color="#36648b"></u-icon>
2025-12-05 16:10:52 +08:00
</view>
2025-12-08 02:29:46 +08:00
<view @tap="handleComment(null, index)" class="u-m-l-6 u-p-t-2">
<u-icon size="24" name="chat" color="#36648b"></u-icon>
2025-12-05 16:10:52 +08:00
</view>
</view>
</view>
<!-- 点赞人 评论 -->
<view class="msg-box">
2025-12-08 02:29:46 +08:00
<view class="thumbinfo u-border-bottom" v-if="item.likes!=null&&item.likes.length">
2026-01-11 13:51:16 +08:00
<uni-icons size="24" type="heart" color="#36648b" class="u-m-r-10"></uni-icons>
<text class="thumbinfo-name" v-for="(ui, pindex) in item.likes" :index="pindex"
:key="pindex" @tap="linkToBusinessCard(ui.user_id)">
{{ ui.nickname }}{{ pindex != item.likes.length - 1 ? '' : '' }}
2025-12-05 16:10:52 +08:00
</text>
</view>
<view class="comment" v-if="item.comments!=null&&item.comments.length">
2026-01-11 13:51:16 +08:00
<view
class="comment-box"
v-for="(comment, commentIndex) in item.comments"
:index="comment.id"
:key="comment.id"
hover-class="comment-hover-class"
2025-12-08 02:29:46 +08:00
:id="`comment-${item.id}-${comment.id}`"
@tap="handleComment(comment, index)">
<text class="comment-box-name">
{{ comment.user.nickname }}
2025-12-05 16:10:52 +08:00
</text>
2026-01-11 13:51:16 +08:00
<text class="callback u-m-l-4 u-m-r-4" v-if="comment.reply_user_id">回复</text>
<text v-if="comment.reply_user_id" class="comment-box-name">
{{ comment.user.nickname }}
</text>
<text></text>
2025-12-08 02:29:46 +08:00
<text class="comment-box-content">{{ comment.body }}</text>
2025-12-05 16:10:52 +08:00
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import MyAvatar from "@/components/MyAvatar/index.vue";
2025-12-08 02:29:46 +08:00
import util from "@/util/index.js";
2026-01-11 13:51:16 +08:00
import { mapGetters } from "vuex";
2025-12-05 16:10:52 +08:00
export default{
2026-01-11 13:51:16 +08:00
components:{MyAvatar},
2025-12-05 16:10:52 +08:00
props:{
index:{
type:Number,
default:0
},
item:{
type:Object,
default(){
return {};
}
}
},
computed:{
2026-01-11 13:51:16 +08:00
...mapGetters(["storeSelfInfo"]),
2025-12-05 16:10:52 +08:00
},
data(){
2026-01-11 14:00:09 +08:00
//console.log(this.item);
2025-12-05 16:10:52 +08:00
return {
2025-12-08 02:29:46 +08:00
girdItemCustomStyle:{
padding: '0',
margin:'0',
border:'1rpx solid #f2f6fc'
},
2025-12-05 16:10:52 +08:00
}
},
methods:{
2026-01-11 13:51:16 +08:00
log(v){
console.log(v)
},
2025-12-08 02:29:46 +08:00
clickThumb(item,index){
this.$emit('userEvent',{type:'clickThumb',item,index});
},
deleteCircle(item,index){
this.$emit('userEvent',{type:'deleteCircle',item,index});
},
handleComment(comment,index){
this.$emit('userEvent',{type:'handleComment',comment,index});
},
linkToBusinessCard(userID){
this.$emit('userEvent',{type:'linkToBusinessCard',userID});
},
//查看大图或者预览视频
previewImg(current) {
const data = this.item;
let that=this;
let releaseType= data.releaseType;
let fileList=[...data.files];
if(releaseType==2){
that.previewVideoSrc=fileList[0];
that.previewVideoFlag=true;
}else{
fileList=fileList.map(item=>this.cdn(item));
uni.previewImage({
current:current,
urls: fileList,
});
return;
}
},
getVideoPoster(videoSrc){
console.log("video",videoSrc);
return "http://192.168.31.125:9090/we-chat/images/friendCircle/1715421601709.mp4";
//return videoSrc;
},
2026-02-09 07:29:02 +08:00
gotomap(item){
const addr = item.address;
uni.navigateTo({
url:`/pages/common/map?type=viewlocation&lng=${addr.longitude}&lat=${addr.latitude}&address=${addr.address}`
})
},
2025-12-08 02:29:46 +08:00
cdn:util.cdn
2025-12-05 16:10:52 +08:00
}
}
</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;
uni-text{
}
2025-12-05 16:10:52 +08:00
}
&-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;
}
}
}
2026-02-09 07:29:02 +08:00
&-address{
font-size: 26rpx;
color: #36648b;
display: flex;
align-items: center;
margin-top: 10rpx;
.u-icon{
}
.name{
}
}
2025-12-05 16:10:52 +08:00
.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;
}
}
2025-12-05 16:10:52 +08:00
}
}
}
.relavivetime {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 26rpx;
.time {
color: $uni-text-color-grey;
2025-12-08 02:29:46 +08:00
display: flex;
align-items: center;
2025-12-05 16:10:52 +08:00
}
.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;
}
}
}
}
2025-12-08 02:29:46 +08:00
.content-img-more{
max-width: 100%;
}
2025-12-05 16:10:52 +08:00
</style>