<template>
|
|
<view class="card">
|
|
<!-- todo: delete -->
|
|
<view class="flex header">
|
|
<view class="flex left">
|
|
<view class="avatar">
|
|
<!-- todo: check key -->
|
|
<image class="avatar-img" :src="data.user.avatar" mode="scaleToFill"></image>
|
|
</view>
|
|
<view class="info">
|
|
<view class="name">{{ data.user.name }}</view>
|
|
<view>{{ $dayjs(data.createTime).format('YYYY-MM-DD') }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="section content">{{ data.content }}</view>
|
|
<view class="flex section imgs">
|
|
<image class="img"
|
|
v-for="(url, iIdx) in images"
|
|
:key="iIdx" :src="url"
|
|
mode="scaleToFill"
|
|
></image>
|
|
</view>
|
|
<view class="section score">
|
|
<view class="flex score-item">
|
|
<view class="score-item-label">行程</view>
|
|
<formRate :value="data.tripNum" :readonly="true"></formRate>
|
|
</view>
|
|
<view class="flex score-item">
|
|
<view class="score-item-label">景点</view>
|
|
<formRate :value="data.spotNum" :readonly="true"></formRate>
|
|
</view>
|
|
<view class="flex score-item">
|
|
<view class="score-item-label">导师</view>
|
|
<formRate :value="data.mentorNum" :readonly="true"></formRate>
|
|
</view>
|
|
</view>
|
|
<view class="section operate">
|
|
<button class="flex btn" @click="onComment">
|
|
<image class="icon" src="@/pages_order/static/comment/icon-comment.png" mode="aspectFill"></image>
|
|
<view>评论</view>
|
|
</button>
|
|
<button v-if="data.liked" class="flex btn" @click="onLike">
|
|
<image class="icon" src="@/pages_order/static/comment/icon-like-active.png" mode="aspectFill"></image>
|
|
<view>点赞</view>
|
|
</button>
|
|
<button v-else class="flex btn" @click="onCancelLike">
|
|
<image class="icon" src="@/pages_order/static/comment/icon-like.png" mode="aspectFill"></image>
|
|
<view>点赞</view>
|
|
</button>
|
|
</view>
|
|
<view class="section comment"
|
|
v-for="item in commentList"
|
|
:key="item.id"
|
|
>
|
|
<view class="flex comment-user">
|
|
<view class="avatar">
|
|
<!-- todo: check key -->
|
|
<image class="avatar-img" :src="item.avatar" mode="scaleToFill"></image>
|
|
</view>
|
|
<view class="name">{{ item.name }}</view>
|
|
<view class="time">{{ item.createTime }}</view>
|
|
</view>
|
|
<view class="comment-content">{{ item.content }}</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import formRate from '@/pages_order/components/formRate.vue'
|
|
|
|
export default {
|
|
components: {
|
|
formRate,
|
|
},
|
|
props: {
|
|
data: {
|
|
type: Object,
|
|
default() {
|
|
return {}
|
|
}
|
|
},
|
|
mode: {
|
|
type: String,
|
|
default: 'read' // read | edit
|
|
}
|
|
},
|
|
computed: {
|
|
images() {
|
|
const { image } = this.data || {}
|
|
|
|
return image?.split?.(',')
|
|
},
|
|
disabled() {
|
|
return this.mode !== 'edit'
|
|
},
|
|
},
|
|
methods: {
|
|
onComment() {
|
|
if (this.disabled) {
|
|
return
|
|
}
|
|
// todo
|
|
|
|
this.$emit('change')
|
|
},
|
|
onLike() {
|
|
if (this.disabled) {
|
|
return
|
|
}
|
|
// todo
|
|
|
|
this.$emit('change')
|
|
},
|
|
onCancelLike() {
|
|
if (this.disabled) {
|
|
return
|
|
}
|
|
// todo
|
|
|
|
this.$emit('change')
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.card {
|
|
width: 100%;
|
|
padding: 32rpx;
|
|
box-sizing: border-box;
|
|
background: #FAFAFF;
|
|
border: 2rpx solid #FFFFFF;
|
|
border-radius: 32rpx;
|
|
}
|
|
|
|
.header {
|
|
|
|
.left {
|
|
flex: 1;
|
|
justify-content: flex-start;
|
|
column-gap: 24rpx;
|
|
}
|
|
|
|
.avatar {
|
|
width: 100rpx;
|
|
height: 100rpx;
|
|
border: 4rpx solid #FFFFFF;
|
|
border-radius: 50%;
|
|
overflow: hidden;
|
|
|
|
&-img {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
.info {
|
|
font-family: PingFang SC;
|
|
font-weight: 400;
|
|
font-size: 24rpx;
|
|
line-height: 1.5;
|
|
color: #8B8B8B;
|
|
|
|
.name {
|
|
font-weight: 600;
|
|
font-size: 36rpx;
|
|
line-height: 1.2;
|
|
color: #252545;
|
|
margin-bottom: 8rpx;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
&-icon {
|
|
width: 44rpx;
|
|
height: auto;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
.section {
|
|
margin-top: 24rpx;
|
|
}
|
|
|
|
.content {
|
|
font-family: PingFang SC;
|
|
font-weight: 400;
|
|
font-size: 32rpx;
|
|
line-height: 1.4;
|
|
color: #181818;
|
|
}
|
|
|
|
.imgs {
|
|
justify-content: flex-start;
|
|
flex-wrap: wrap;
|
|
gap: 24rpx;
|
|
|
|
.img {
|
|
width: 190rpx;
|
|
height: 190rpx;
|
|
}
|
|
}
|
|
|
|
.score {
|
|
&-item {
|
|
padding: 12rpx 0;
|
|
justify-content: space-between;
|
|
|
|
& + & {
|
|
margin-top: 4rpx;
|
|
}
|
|
|
|
&-label {
|
|
font-family: PingFang SC;
|
|
font-weight: 400;
|
|
font-size: 26rpx;
|
|
line-height: 1.4;
|
|
color: #181818;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
.comment {
|
|
&-user {
|
|
column-gap: 16rpx;
|
|
|
|
.avatar {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
border-radius: 50%;
|
|
|
|
&-img {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
.name {
|
|
font-size: 26rpx;
|
|
font-weight: 600;
|
|
color: #000000;
|
|
}
|
|
|
|
.time {
|
|
flex: 1;
|
|
text-align: right;
|
|
font-size: 24rpx;
|
|
color: #999999;
|
|
}
|
|
}
|
|
|
|
&-content {
|
|
margin-top: 28rpx;
|
|
font-size: 26rpx;
|
|
color: #666666;
|
|
}
|
|
}
|
|
</style>
|