mineComment.vue
5.4 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<template>
<u-sticky bgColor="#06b9d3" zIndex="999999999999999999999999">
<u-navbar title="我的评论" :autoBack="true" bgColor="#06b9d3" safeAreaInsetTop :titleStyle="{ color: '#fff' }" leftIconColor="#fff"></u-navbar>
<u-tabs :list="list1" @click="clickTabsItemHandler" lineColor="#fff" lineWidt="18" lineHeight="3" :scrollable="false" :activeStyle="{ fontSize: '34rpx', color: '#fff', fontWeight: 700 }" :inactiveStyle="{ fontSize: '34rpx', color: '#fff' }"></u-tabs>
</u-sticky>
<image src="/static/images/commentBg.png" class="mineCom-bg" mode="aspectFill" />
<view class="mineCom Zindex">
<template v-if="pageList.records.length">
<view class="mineCom-item" v-for="_ in pageList?.records" :key="_.id">
<view class="" style="margin-bottom: 50rpx">
<view class="flexA">
<view>
<image :src="_?.user?.avatar ? proxy.$h.downFile(_?.user?.avatar) : '/static/images/commentBg.png'" class="mineCom-avatar" mode="aspectFill" />
</view>
<view>
<view class="flexA">
<view class="mineCom-username">{{ _?.user?.nickname }}</view>
<view class="mineCom-toptag" v-if="_?.consultationWay">{{ proxy.$h.optObjectValue('consultationWay', _?.consultationWay) }}</view>
</view>
<view class="mineCom-time">{{ _?.time }}</view>
</view>
</view>
</view>
<view class="flexA" style="margin-bottom: 16rpx">
<view class="mineCom-text">评分:</view>
<view style="margin-right: 6rpx; color: #ffc525; font-size: 26rpx">{{ _?.star }}分</view>
<u-rate :count="5" v-model="_.star" allowHalf activeColor="#ffc525" readonly></u-rate>
</view>
<view class="mineCom-text">评价:{{ _?.content }}</view>
<!-- 未回复 -->
<template v-if="_.isReply == 0">
<u-line margin="30rpx 0"></u-line>
<view class="flexD" style="width: 100%">
<view style="width: 170rpx">
<up-button color="#05B8D2" shape="circle" text="回复" throttleTime="1500" @click="proxy.$h.jumpUrl(`/pages2/message/reply?id=${_?.id}&detailData=${JSON.stringify(_)}`)"></up-button>
</view>
</view>
</template>
<!-- 已回复 -->
<template v-if="_.isReply == 1">
<view class="mineCom-grayBg" style="margin-top: 30rpx">
<view class="flexJ" style="margin-bottom: 14rpx">
<view class="mineCom-time">回复:</view>
<view class="mineCom-time">{{ _?.replyTime }}</view>
</view>
<view class="mineCom-text">{{ _?.replyContent }}</view>
</view>
</template>
</view>
<view class="mineCom-empty flexC">已加载全部</view>
</template>
<!-- 列表为空 -->
<template v-else>
<view class="flexCCol" style="margin-top: 170rpx">
<image src="/static/images/commentEmpty.png" class="mineCom-emptyImg" mode="aspectFill" />
<view class="mineCom-time">没有更多数据</view>
</view>
</template>
</view>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, ComponentPublicInstance } from 'vue'
import { onShow, onReachBottom } from '@dcloudio/uni-app'
import { getComment_list } from '../../api'
import { MessageListParamsType, PageListType, CommentListItemType } from '../../types'
const { proxy } = getCurrentInstance() as { proxy: ComponentPublicInstance }
const list1 = [{ name: '待回复' }, { name: '已回复' }]
const pageList = ref<PageListType<CommentListItemType>>({ records: [] })
const params = ref<MessageListParamsType>({
type: 1,
pageNo: 0
})
const clickTabsItemHandler = e => {
params.value.type = e.index + 1
getListHandler(true)
}
const getListHandler = async (refresh: boolean) => {
refresh ? ((params.value.pageNo = 1), pageList.value.records.splice(0)) : params.value.pageNo++
const { result }: { result: PageListType<CommentListItemType> } = await getComment_list(params.value)
if (!result.records.length) return
result.records.map(_ => pageList.value?.records.push(_))
}
onShow(() => getListHandler(true))
onReachBottom(() => getListHandler(false))
</script>
<style>
page {
background: #f7f8fa !important;
}
</style>
<style lang="scss" scoped>
.mineCom-bg {
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 396rpx;
}
.mineCom {
box-sizing: border-box;
padding: 112rpx 24rpx 0;
&-emptyImg {
width: 216rpx;
height: 216rpx;
margin-bottom: 50rpx;
}
&-grayBg {
box-sizing: border-box;
padding: 32rpx;
border-radius: 24rpx;
background: #f8f8fa;
}
&-text {
color: #323233;
font-size: 26rpx;
}
&-item {
box-sizing: border-box;
padding: 28rpx 24rpx;
background: #fff;
border-radius: 24rpx;
margin-bottom: 22rpx;
}
&-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;
margin-left: 16rpx;
margin-top: 8rpx;
}
&-toptag {
color: #05b8d2;
font-size: 22rpx;
font-weight: 700;
box-sizing: border-box;
padding: 2rpx 10rpx;
border: 1rpx solid #05b8d2;
border-radius: 8rpx;
}
&-empty {
margin: 36rpx auto 0;
color: #999999;
font-size: 26rpx;
}
}
</style>