feat: 商品评价
This commit is contained in:
@@ -0,0 +1,332 @@
|
||||
<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>
|
||||
|
||||
<!-- 评价主内容区域 -->
|
||||
<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>
|
||||
</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, // 当前图片索引
|
||||
};
|
||||
},
|
||||
onShow() {},
|
||||
onLoad() {},
|
||||
methods: {
|
||||
// 监听滑动切换
|
||||
onSwiperChange(e) {
|
||||
this.currentImageIndex = e.detail.current;
|
||||
},
|
||||
// 返回上一页
|
||||
goBack() {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
background-color: #f7f7f9;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user