From f926e6141482ca1c7ea8de58c06736e7d93abf9f Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期一, 13 一月 2025 11:37:53 +0800 Subject: [PATCH] 1.在线客服-点击事件修改 --- sub_pages/customer/shop/shop.vue | 135 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 111 insertions(+), 24 deletions(-) diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index d1f6f20..3c5f7f2 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -170,36 +170,53 @@ </view> <view class="m-t-12"> - <view v-for="(item,index) of commentList" > + <view v-for="(item,index) of commentList" :key="index"> <u-row justify="space-between" > - <u-col span="1"> - <u--image v-if="item.anonymityFalg==1 " :showLoading="true" - src="https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png" width="30px" height="30px" shape="circle"></u--image> - <u--image v-else :showLoading="true" :src="item.customerCover" width="30px" height="30px" shape="circle"></u--image> - - </u-col> - <u-col span="4"> - <view v-if="item.anonymityFalg==1 " >匿名用户</view> - <view v-else>{{item.customerName}}</view> - </u-col> <u-col span="2"> - <u-rate count="5" v-model="item.commentGrade" readonly></u-rate> + <view style="display: flex; justify-content: flex-start; align-items: center;padding: 5rpx;"> + <u--image v-if="item.anonymityFalg==1 " :showLoading="true" + src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/95/95450acd98ff4245ab998809496ba6d5niming.png" width="30px" height="30px" shape="circle"></u--image> + <u--image v-else :showLoading="true" :src="item.customerCover" width="30px" height="30px" shape="circle"></u--image> + </view> </u-col> - <u-col span="4"> - <view style="font-size: 12px;">{{item.updateTime}}</view> + <u-col span="10" style="font-size: 12px;"> + <span v-if="item.anonymityFalg==1 " >{{formatAnonymityName(item.customerName)}}</span> + <span v-else>{{item.customerName}}</span> </u-col> + + <!-- <u-col span="4"> + <view style="font-size: 12px; margin-right: 10px; text-align: right;">{{item.updateTime}}</view> + </u-col> --> </u-row> - <u-row justify="space-between" > + <u-row justify="space-between" class="flower-comment"> <u-col span="2"></u-col> <u-col span="10"> + <view class="rate"> + <u-rate count="5" v-model="item.commentGrade" readonly size="30"></u-rate> + <view style="font-size: 12px; margin-right: 10px; text-align: right;">{{item.updateTime}}</view> + </view> <view> - <span style="color:#3E9FFB;border: 1px solid #3E9FFB; padding:2px 2px ;font-size: 12px;"> - {{item.flowerName}}({{item.flowerColor}}){{item.flowerLevel}} - </span> - {{item.comment}} - <view class="flex" > - <u--image v-for="(commentImg,index2) of item.commentImagesList" :key="index2" style="margin:10px;" - :showLoading="true" :src="commentImg"></u--image> + <view> + <span class="flower-unit" >{{item.flowerName}} {{item.flowerLevel}}</span> + <span class="comment" style="font-size: 12px;"> + {{item.comment}} + </span> + </view> + <view class="img-v" > + <!-- <u--image v-for="(commentImg,index2) of item.commentImagesList" :key="index2" class="comment-img" + :showLoading="true" :src="commentImg"></u--image> --> + + <!-- <image v-for="(commentImg,index2) of item.commentImagesList" :key="index2" :src="commentImg" class="comment-img" @click="previewImg(commentImg)"></image> --> + + <u-grid :border="false" > + <u-grid-item + v-for="(commentImg,index2) of item.commentImagesList" + :key="index2" + > + <image :src="commentImg" class="comment-img" @click="previewImg(commentImg)"></image> + </u-grid-item> + </u-grid> + </view> </view> @@ -459,6 +476,15 @@ } }, methods: { + + formatAnonymityName(name) { + if (name.length <= 1) { + return '**' + name + '**'; + } else { + const firstChar = name.charAt(0); + return '**' + firstChar + '**'; + } + }, async getCommentsStatis() { { @@ -516,15 +542,19 @@ this.commentList[existingCommentIndex] = { ...this.commentList[existingCommentIndex], ...item, - commentImagesList + commentImagesList, + updateTime: item.updateTime ? this.formatUpdateTime(item.updateTime) : null }; } else { // 新增评论 this.commentList.push({ ...item, - commentImagesList + commentImagesList, + updateTime: item.updateTime ? this.formatUpdateTime(item.updateTime) : null }); } + console.log("评论列表:") + console.log(this.commentList) }); } @@ -532,6 +562,20 @@ this.$message.hideLoading() } + }, + formatUpdateTime(time) { + + if (!time) return ''; // 如果时间为空,直接返回空字符串 + const date = new Date(time); + + // 格式化为 "YYYY-MM-DD HH:mm" 形式 + const year = date.getFullYear(); + const month = (date.getMonth() + 1).toString().padStart(2, '0'); + const day = date.getDate().toString().padStart(2, '0'); + const hours = date.getHours().toString().padStart(2, '0'); + const minutes = date.getMinutes().toString().padStart(2, '0'); + + return `${year}-${month}-${day} ${hours}:${minutes}`; }, getList_after() { @@ -938,12 +982,55 @@ } } + .flower-comment{ + padding:10px; + line-height: 1.5; + + .comment{ + margin: 10px; + font-size: 10rpx; + } + + } + + .rate{ + display: flex; + justify-content: space-between; + margin:10px 10px 10px 0px; + } + + .img-v{ + margin:10px; + display: flex; + flex-wrap: wrap; + .comment-img{ + margin:5rpx; + width:170rpx; + height:170rpx; + border-radius: 10rpx; + object-fit: contain; + } + .comment-img2{ + object-fit: cover; /* 或 contain */ + } + } .comment-replay{ background-color: #F6F6F6; color: #6582B6; margin-top:10rpx; padding: 10rpx; + font-size: 12px; + } + + .flower-unit{ + color:#3E9FFB; + border: 1rpx solid #3E9FFB; + margin:10px; + margin-left:0px; + padding-left: 5rpx; + padding-right: 5rpx; + font-size: 12px; } } </style> \ No newline at end of file -- Gitblit v1.9.3