Files
frontend-app/pages/other_package/productInfo/evaluateDetail.vue
T

537 lines
12 KiB
Vue
Raw Normal View History

2026-07-02 17:02:55 +08:00
<template>
<view class="content">
<!-- 状态栏占位 -->
<TopSafe></TopSafe>
<!-- 整合后的自定义头部导航栏(包含返回键和用户信息) -->
<view class="custom-header">
<view class="user-info">
<up-image
class="back-icon"
src="/static/common/left.png"
width="18"
height="20"
bgColor="#f1f6ff00"
@tap="goBack"
/>
<image
class="avatar"
src="/static/avatar-placeholder.png"
mode="aspectFill"
></image>
<text class="nickname">李老八</text>
<view class="badge">
<up-image
src="/static/common/rz.png"
width="14"
height="13"
bgColor="#f1f6ff00"
class="badge-icon"
></up-image>
<text class="badge-text">星级用户</text>
</view>
</view>
</view>
2026-07-02 17:47:54 +08:00
<!-- 评价与评论主内容区域 -->
2026-07-02 17:02:55 +08:00
<view class="setting-view">
<view class="evaluation-card">
<!-- 1. 大图晒单区域(支持左右滑动,兼容H5和小程序) -->
<view class="image-wrapper">
<swiper
class="main-swiper"
:current="currentImageIndex"
@change="onSwiperChange"
:circular="true"
>
<swiper-item v-for="(img, index) in imageList" :key="index">
<image
class="main-image"
:src="img"
mode="aspectFill"
></image>
</swiper-item>
</swiper>
<!-- 自定义数字指示器 -->
<view class="image-indicator" v-if="imageList.length > 1">
{{ currentImageIndex + 1 }}/{{ imageList.length }}
</view>
</view>
<!-- 2. 购买规格与星级评分 -->
<view class="rating-row">
<text class="sku-text">已购韩版FILA斐乐Running ...</text>
<view class="stars-box">
<view class="stars">
<text class="star active">★</text>
<text class="star active">★</text>
<text class="star active">★</text>
<text class="star active">★</text>
<text class="star active">★</text>
</view>
<text class="rating-label">好评</text>
</view>
</view>
<!-- 3. 用户评价文本 -->
<view class="comment-content">
包装非常严实,里三层外三层的,完全不用担心运输损坏。
</view>
<!-- 4. 底部关联商品卡片 -->
<view class="product-mini-card">
<image
class="prod-img"
src="https://img.yzcdn.cn/vant/cat.jpeg"
mode="aspectFill"
></image>
<view class="prod-info">
<text class="prod-title"
>Skechers斯凯奇2024年秋冬...Skechers斯凯奇2024年秋冬...</text
>
</view>
</view>
2026-07-02 17:47:54 +08:00
<!-- 【新增】5. 评论列表显示区 -->
<view class="comment-section">
<view class="comment-count">{{ commentList.length }}条评论</view>
<view class="comment-item" v-for="(item, index) in commentList" :key="index">
<image class="c-avatar" :src="item.avatar" mode="aspectFill"></image>
<view class="c-body">
<view class="c-user-line">
<text class="c-nickname">{{ item.nickname }}</text>
</view>
<view class="c-text">{{ item.content }}</view>
<view class="c-footer">
<text class="c-time">{{ item.time }}</text>
<text class="c-reply-btn" @tap="tapReply(item)">回复</text>
</view>
</view>
<!-- 右侧点赞 -->
<view class="c-like-box" @tap="toggleCommentLike(index)">
</view>
</view>
<!-- 底部到底提示 -->
<view class="no-more">— 到底啦 —</view>
</view>
</view>
</view>
<view class="bottom-bar">
<view class="input-box">
<text class="edit-icon">✏️</text>
<input
type="text"
v-model="inputComment"
placeholder="热情回复 文明用语"
placeholder-class="input-placeholder"
confirm-type="send"
@confirm="sendComment"
/>
2026-07-02 17:02:55 +08:00
</view>
</view>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import TopSafe from "@/components/common/top-safe.nvue";
import MyBtn from "@/components/common/my-btn.vue";
export default {
components: { TopSafe, MyBtn },
data() {
return {
// 图片列表数据
imageList: [
"https://img.yzcdn.cn/vant/cat.jpeg",
"https://img.yzcdn.cn/vant/apple-1.jpg",
"https://img.yzcdn.cn/vant/apple-2.jpg"
],
currentImageIndex: 0, // 当前图片索引
2026-07-02 17:47:54 +08:00
// 【新增】输入框绑定的文本
inputComment: '',
// 【新增】模拟评论区数据
commentList: [
{
avatar: "https://img.yzcdn.cn/vant/cat.jpeg",
nickname: "不吃葡萄皮888",
level: 4,
content: "哼哼唧唧",
time: "刚刚",
isLiked: false
},
{
avatar: "https://img.yzcdn.cn/vant/cat.jpeg",
nickname: "不吃葡萄皮888",
level: 4,
content: "😊",
time: "刚刚",
isLiked: false
}
]
2026-07-02 17:02:55 +08:00
};
},
onShow() {},
onLoad() {},
methods: {
// 监听滑动切换
onSwiperChange(e) {
this.currentImageIndex = e.detail.current;
},
// 返回上一页
goBack() {
uni.navigateBack({
delta: 1,
});
},
2026-07-02 17:47:54 +08:00
// 【新增】发送评论
sendComment() {
if (!this.inputComment.trim()) return;
this.commentList.unshift({
avatar: "/static/avatar-placeholder.png", // 默认当前用户头像
nickname: "我就是我",
level: 1,
content: this.inputComment,
time: "刚刚",
isLiked: false
});
this.inputComment = '';
uni.showToast({ title: '评论成功', icon: 'none' });
},
// 【新增】点赞单条评论
toggleCommentLike(index) {
this.commentList[index].isLiked = !this.commentList[index].isLiked;
},
// 【新增】点击回复
tapReply(item) {
uni.showToast({ title: `回复 @${item.nickname}`, icon: 'none' });
}
2026-07-02 17:02:55 +08:00
},
};
</script>
<style lang="scss" scoped>
.content {
background-color: #f7f7f9;
min-height: 100vh;
2026-07-02 17:47:54 +08:00
position: relative;
2026-07-02 17:02:55 +08:00
}
.custom-header {
width: 100%;
height: 100rpx;
background-color: #ffffff;
display: flex;
align-items: center;
padding: 0 24rpx;
box-sizing: border-box;
border-bottom: 1rpx solid #f2f2f2;
.user-info {
display: flex;
align-items: center;
width: 100%;
.back-icon {
width: 36rpx;
height: 36rpx;
margin-right: 20rpx;
}
.avatar {
width: 68rpx;
height: 68rpx;
border-radius: 50%;
background-color: #7a46f2;
margin-right: 16rpx;
}
.nickname {
font-size: 34rpx;
color: #1a1a1a;
font-weight: 600;
margin-right: 12rpx;
}
.badge {
display: flex;
align-items: center;
background-color: #fdf6ec;
border-radius: 6rpx;
padding: 2rpx 8rpx;
.badge-icon {
margin-right: 6rpx;
}
.badge-text {
font-size: 22rpx;
color: #b88230;
font-weight: 500;
}
}
}
}
.setting-view {
width: 100%;
height: calc(100% - 100rpx - var(--status-bar-height));
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
box-sizing: border-box;
2026-07-02 17:47:54 +08:00
padding-bottom: 120rpx; /* 【新增】留出底部固定栏的距离 */
2026-07-02 17:02:55 +08:00
}
.evaluation-card {
width: 100%;
background-color: #ffffff;
padding-bottom: 30rpx;
display: flex;
flex-direction: column;
// 大图晒单区域优化
.image-wrapper {
width: 100%;
padding: 24rpx 32rpx 0 32rpx;
box-sizing: border-box;
position: relative; // 为指示器绝对定位做准备
.main-swiper {
width: 100%;
height: 500rpx; // swiper必须指定高度,可根据业务UI自行微调
.main-image {
width: 100%;
height: 100%; // 让图片撑满swiper-item
border-radius: 12rpx;
display: block;
}
}
// 右下角微型数字指示器
.image-indicator {
position: absolute;
right: 50rpx;
bottom: 20rpx;
background-color: rgba(0, 0, 0, 0.6);
color: #ffffff;
padding: 4rpx 16rpx;
font-size: 22rpx;
border-radius: 20rpx;
z-index: 10;
}
}
// 规格与星级
.rating-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx 32rpx 16rpx 32rpx;
.sku-text {
font-size: 26rpx;
color: #a0a0a0;
max-width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.stars-box {
display: flex;
align-items: center;
.stars {
display: flex;
margin-right: 12rpx;
.star {
font-size: 28rpx;
color: #e0e0e0;
margin-left: 2rpx;
&.active {
color: #7b3ff7;
}
}
}
.rating-label {
font-size: 26rpx;
color: #7b3ff7;
font-weight: 500;
}
}
}
// 评价文本
.comment-content {
font-size: 28rpx;
color: #262626;
line-height: 1.5;
padding: 0 32rpx 24rpx 32rpx;
text-align: justify;
}
// 底部链接商品卡片
.product-mini-card {
margin: 0 32rpx;
background-color: #f5f6f8;
border-radius: 16rpx;
padding: 16rpx;
display: flex;
align-items: center;
.prod-img {
width: 110rpx;
height: 110rpx;
border-radius: 12rpx;
background-color: #e5e5e5;
flex-shrink: 0;
}
.prod-info {
margin-left: 20rpx;
flex: 1;
.prod-title {
font-size: 26rpx;
color: #1a1a1a;
line-height: 1.4;
font-weight: 500;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
}
}
}
2026-07-02 17:47:54 +08:00
/* ================= 【新增样式】评论显示区 ================= */
.comment-section {
margin-top: 40rpx;
padding: 0 32rpx;
border-top: 1rpx solid #f2f2f2;
.comment-count {
font-size: 26rpx;
color: #999999;
padding: 24rpx 0;
}
.comment-item {
display: flex;
padding: 24rpx 0;
position: relative;
.c-avatar {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
margin-right: 16rpx;
background-color: #f0f0f0;
}
.c-body {
flex: 1;
.c-user-line {
display: flex;
align-items: center;
margin-bottom: 8rpx;
.c-nickname {
font-size: 26rpx;
color: #888888;
margin-right: 10rpx;
}
}
.c-text {
font-size: 28rpx;
color: #262626;
line-height: 1.4;
margin-bottom: 12rpx;
}
.c-footer {
display: flex;
align-items: center;
font-size: 24rpx;
color: #aaaaaa;
.c-time {
margin-right: 20rpx;
}
.c-reply-btn {
color: #555555;
cursor: pointer;
}
}
}
.c-like-box {
padding: 10rpx;
}
}
.no-more {
text-align: center;
font-size: 24rpx;
color: #cccccc;
padding: 40rpx 0 10rpx 0;
}
}
/* ================= 【新增样式】底部固定评论/操作栏 ================= */
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 110rpx;
background-color: #ffffff;
border-top: 1rpx solid #eeeeee;
display: flex;
align-items: center;
padding: 0 24rpx;
box-sizing: border-box;
z-index: 100;
padding-bottom: env(safe-area-inset-bottom); /* 适配全面屏底部安全区 */
.input-box {
flex: 1;
height: 70rpx;
background-color: #f5f6f8;
border-radius: 35rpx;
display: flex;
align-items: center;
padding: 0 24rpx;
margin-right: 24rpx;
.edit-icon {
font-size: 26rpx;
color: #999999;
margin-right: 12rpx;
}
input {
flex: 1;
font-size: 26rpx;
color: #262626;
}
.input-placeholder {
color: #bbbbbb;
}
}
}
2026-07-02 17:02:55 +08:00
</style>