reply.vue
3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
<u-navbar title="0" :autoBack="true" bgColor="#ffffff" placeholder safeAreaInsetTop :titleStyle="{ color: '#fff' }">
<template #right>
<view style="width: 126rpx">
<up-button color="#05B8D2" shape="circle" text="提交" throttleTime="1500" size="small" @click="submitCommentHandler"></up-button>
</view>
</template>
</u-navbar>
<view class="reply graybg">
<view class="reply-topbg">
<view class="title">回复评论</view>
<view class="graybg1">
<view class="flexJ" style="margin-bottom: 50rpx">
<view class="flexA">
<image :src="proxy.$h.downFile(commmentDetail?.user?.avatar)" class="reply-avatar" mode="aspectFill" />
<view class="reply-username">{{ commmentDetail?.user?.nickname }}</view>
<view class="reply-toptag" v-if="commmentDetail?.consultationWay">{{ proxy.$h.optObjectValue('consultationWay', commmentDetail?.consultationWay) || '' }}</view>
</view>
</view>
<view class="reply-time">{{ commmentDetail?.time }}</view>
<view class="flexA" style="margin-bottom: 16rpx">
<view class="reply-text">评分:</view>
<view style="margin-right: 6rpx; color: #ffc525">{{ commmentDetail?.star }}分</view>
<u-rate :count="5" v-model="value" allowHalf activeColor="#ffc525" readonly></u-rate>
</view>
<view class="reply-text">评价:{{ commmentDetail?.content || '' }}</view>
</view>
</view>
<view class="main">
<u-textarea v-model="commentText" placeholder="请输入内容" count maxlength="200"></u-textarea>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, ComponentPublicInstance } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { updateComment_receive } from '../../api'
import { CommentListItemType } from '../../types'
const { proxy } = getCurrentInstance() as { proxy: ComponentPublicInstance }
const value = ref(4.5)
const commentText = ref<string>('')
const submitCommentHandler = async () => {
if (commentText.value.length === 0) return uni.$u.toast('回复内容不能为空')
await updateComment_receive({ id: commentId.value, content: commentText.value })
proxy.$h.timeCallBack('回复成功')
}
const commentId = ref<string>('')
const commmentDetail = ref<CommentListItemType>()
onLoad((e: { id: string; detailData: string }) => {
commentId.value = e.id
commmentDetail.value = JSON.parse(e.detailData)
value.value = Number(commmentDetail.value?.star)
})
</script>
<style lang="scss" scoped>
.reply {
.main {
box-sizing: border-box;
padding: 0 24rpx;
border-radius: 24rpx;
}
&-text {
color: #323233;
font-size: 26rpx;
}
&-avatar {
width: 92rpx;
height: 92rpx;
min-width: 92rpx;
min-height: 92rpx;
border-radius: 50%;
}
&-username {
margin: 0 16rpx;
color: #323233;
font-size: 30rpx;
font-weight: 700;
}
&-time {
color: #999999;
font-size: 26rpx;
}
&-toptag {
color: #05b8d2;
font-size: 22rpx;
font-weight: 700;
box-sizing: border-box;
padding: 2rpx 10rpx;
border: 1rpx solid #05b8d2;
border-radius: 8rpx;
}
&-topbg {
box-sizing: border-box;
padding: 40rpx 24rpx;
background: #fff;
border-radius: 0 0 32rpx 32rpx;
margin-bottom: 24rpx;
.title {
color: #323233;
font-size: 32rpx;
font-weight: 700;
margin-bottom: 52rpx;
}
.graybg1 {
box-sizing: border-box;
padding: 28rpx 24rpx;
background: #f8f8fa;
border-radius: 24rpx;
}
}
}
</style>