|
|
- <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"></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>
- <uv-rate :value="data.productNum" size="48rpx" gutter="16rpx" activeColor="#F7BA1E" :allowHalf="true" :minCount="0.5" readonly></uv-rate>
- </view>
- <view class="flex score-item">
- <view class="score-item-label">问卷体验</view>
- <uv-rate :value="data.paperNum" size="48rpx" gutter="16rpx" activeColor="#F7BA1E" :allowHalf="true" :minCount="0.5" readonly></uv-rate>
- </view>
- <view class="flex score-item">
- <view class="score-item-label">物流速度</view>
- <uv-rate :value="data.logisticsNum" size="48rpx" gutter="16rpx" activeColor="#F7BA1E" :allowHalf="true" :minCount="0.5" readonly></uv-rate>
- </view>
- </view>
- <view class="section operate" v-if="mode == 'edit'">
- <button class="flex btn" @click="onComment">
- <image class="icon" src="@/static/image/icon-comment.png" mode="aspectFill"></image>
- <view>评论</view>
- </button>
- <button v-if="data.liked" class="flex btn" @click="onLike">
- <image class="icon" src="@/static/image/icon-like-active.png" mode="aspectFill"></image>
- <view>点赞</view>
- </button>
- <button v-else class="flex btn" @click="onCancelLike">
- <image class="icon" src="@/static/image/icon-like.png" mode="aspectFill"></image>
- <view>点赞</view>
- </button>
- </view>
- </view>
- </template>
-
- <script>
- export default {
- props: {
- data: {
- type: Object,
- default() {
- return {}
- }
- },
- mode: {
- type: String,
- default: 'read' // read | edit
- }
- },
- computed: {
- images() {
- const { image } = this.data || {}
-
- return image?.split?.(',')
- }
- },
- methods: {
- onComment() {
- // todo
-
- this.$emit('change')
- },
- onLike() {
- // todo
-
- this.$emit('change')
- },
- onCancelLike() {
- // 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;
- }
-
- }
- }
- </style>
|