appraise.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <view class="container">
  3. <!-- 顶部评分区域 -->
  4. <view class="header">
  5. <view class="header_box">
  6. <!-- 总评分区域 -->
  7. <view class="box_left">5.0</view>
  8. <view class="box_right">
  9. <!-- 位置评分区域 -->
  10. <view class="right_item">
  11. <view class="item_info">位置 4.6</view>
  12. <view class="item_progress">
  13. <progress activeColor="#0BAD8B" backgroundColor="#CCCCCC" stroke-width="10" border-radius="92" :percent="(4.6 / 5) * 100" />
  14. </view>
  15. </view>
  16. <!-- 设施评分区域 -->
  17. <view class="right_item">
  18. <view class="item_info">设施 4.6</view>
  19. <view class="item_progress">
  20. <progress activeColor="#0BAD8B" backgroundColor="#CCCCCC" stroke-width="10" border-radius="92" :percent="(4.6 / 5) * 100" />
  21. </view>
  22. </view>
  23. <!-- 服务评分区域 -->
  24. <view class="right_item">
  25. <view class="item_info">服务 4.6</view>
  26. <view class="item_progress">
  27. <progress activeColor="#0BAD8B" backgroundColor="#CCCCCC" stroke-width="10" border-radius="92" :percent="(4.6 / 5) * 100" />
  28. </view>
  29. </view>
  30. <!-- 卫生评分区域 -->
  31. <view class="right_item">
  32. <view class="item_info">卫生 4.6</view>
  33. <view class="item_progress">
  34. <progress activeColor="#0BAD8B" backgroundColor="#CCCCCC" stroke-width="10" border-radius="92" :percent="(4.6 / 5) * 100" />
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 分段器区域 -->
  41. <view class="segmented">
  42. <uni-segmented-control styleType="text" activeColor="#096562" :current="activeCurrent" :values="headerList" @clickItem="onClickItem" />
  43. </view>
  44. <!-- 评价列表 -->
  45. <view class="body">
  46. <!-- 每一个评价区域 -->
  47. <view class="body_box" v-for="item in commentList" :key="item.id">
  48. <!-- 用户信息区域 -->
  49. <view class="box_userInfo" @click="handleGoDetail(item)">
  50. <img mode="aspectFill" :src="item.imgUrl" />
  51. <view class="userInfo_msg">
  52. <view class="msg_name">{{ item.name }}</view>
  53. <view class="msg_star">
  54. <uni-rate readonly activeColor="#FFC300" :size="16" :value="item.rate" />
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 入住时间区域 -->
  59. <view class="box_time">{{ item.liveTime }}入住,{{ item.subTime }}发表 | {{ item.type }}</view>
  60. <!-- 评价内容区域 -->
  61. <uv-read-more show-height="85rpx" closeText="全文" color="#096663" fontSize="24rpx" textIndent="0" :toggle="true" :shadowStyle="shadowStyle">
  62. <view class="box_content">
  63. {{ item.content }}
  64. </view>
  65. </uv-read-more>
  66. <!-- 图片区域 -->
  67. <view class="box_img">
  68. <img v-for="(ele, index) in item.imgList" :key="index" mode="aspectFill" :src="ele" @click="handleClickImg(item.imgList, index)" />
  69. </view>
  70. <!-- 评论按钮区域 -->
  71. <view class="box_comment">
  72. <img src="../../static/index/comment.png" />
  73. <view>评论({{ item.count }})</view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. export default {
  81. data() {
  82. return {
  83. // 分段器分类数组
  84. headerList: ['全部(256)', '有图/视频(42)', '商家回复(42)'],
  85. // 当前激活的分段器索引
  86. activeCurrent: 0,
  87. // 评价内容区域阴影样式
  88. shadowStyle: {
  89. backgroundImage: 'none'
  90. },
  91. // 评价列表数据
  92. commentList: [
  93. {
  94. id: 1,
  95. imgUrl: 'https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
  96. name: '张三',
  97. rate: 4.6,
  98. liveTime: '2023-07',
  99. subTime: '2023-08-01',
  100. type: '大床房',
  101. content:
  102. '评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容的丰富的丰富评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容的丰富的丰富',
  103. imgList: [
  104. 'https://img1.baidu.com/it/u=2776549017,1408541252&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500',
  105. 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fitem%2F201912%2F28%2F20191228151619_wxioq.thumb.1000_0.jpg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695352503&t=cf595866bbcbd5c6a01ffe69913da7e0'
  106. ],
  107. count: 12
  108. },
  109. {
  110. id: 2,
  111. imgUrl: 'https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
  112. name: '李四',
  113. rate: 4.1,
  114. liveTime: '2023-08',
  115. subTime: '2023-08-11',
  116. type: '双人房',
  117. content:
  118. '评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容的丰富的丰富评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容的丰富的丰富',
  119. imgList: [
  120. 'https://img1.baidu.com/it/u=2776549017,1408541252&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500',
  121. 'https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
  122. 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fitem%2F201912%2F28%2F20191228151619_wxioq.thumb.1000_0.jpg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695352503&t=cf595866bbcbd5c6a01ffe69913da7e0',
  123. 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F70a86822-e473-4ad8-9147-fad3e5cbc5ec%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1695352600&t=689d4a86e77580db11cdc227291ef6f7'
  124. ],
  125. count: 8
  126. },
  127. {
  128. id: 3,
  129. imgUrl: 'https://img1.baidu.com/it/u=4085584268,3308739054&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=375',
  130. name: '王八',
  131. rate: 3.8,
  132. liveTime: '2023-07',
  133. subTime: '2023-07-11',
  134. type: '普通房',
  135. content:
  136. '评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容的丰富的丰富评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容的丰富的丰富',
  137. imgList: [],
  138. count: 26
  139. }
  140. ]
  141. }
  142. },
  143. methods: {
  144. // 点击每一个评价回调
  145. handleGoDetail(item) {
  146. let info = encodeURIComponent(JSON.stringify(item))
  147. uni.navigateTo({
  148. url: `/pages/appraiseDetail/appraiseDetail?info=${info}`
  149. })
  150. },
  151. // 切换分段器时的回调
  152. onClickItem(e) {
  153. if (this.current !== e.currentIndex) {
  154. this.current = e.currentIndex
  155. }
  156. },
  157. // 点击评价图片回调
  158. handleClickImg(url, index) {
  159. // 预览图片
  160. uni.previewImage({
  161. current: index,
  162. urls: url
  163. })
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .container {
  170. display: flex;
  171. flex-direction: column;
  172. min-height: 100vh;
  173. background-color: #f2f3f5;
  174. .header {
  175. height: 150rpx;
  176. background-color: #fff;
  177. .header_box {
  178. display: flex;
  179. margin: 43rpx 0 36rpx;
  180. height: 70rpx;
  181. .box_left {
  182. display: flex;
  183. justify-content: center;
  184. align-items: center;
  185. width: 140rpx;
  186. color: #096562;
  187. font-size: 60rpx;
  188. font-weight: 900;
  189. border-right: 1rpx solid #cccccc;
  190. }
  191. .box_right {
  192. flex: 1;
  193. display: flex;
  194. flex-wrap: wrap;
  195. color: #808080;
  196. font-size: 24rpx;
  197. .right_item {
  198. display: flex;
  199. align-items: center;
  200. width: 50%;
  201. .item_info {
  202. margin-left: 33rpx;
  203. }
  204. .item_progress {
  205. margin-right: 20rpx;
  206. padding: 0 13rpx;
  207. flex: 1;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. .segmented {
  214. padding-bottom: 18rpx;
  215. margin-bottom: 20rpx;
  216. background-color: #fff;
  217. }
  218. .body {
  219. .body_box {
  220. box-sizing: border-box;
  221. padding: 0 20rpx;
  222. margin: 0 auto 20rpx;
  223. width: 710rpx;
  224. border-radius: 18rpx;
  225. background-color: #fff;
  226. .box_userInfo {
  227. display: flex;
  228. align-items: center;
  229. height: 115rpx;
  230. img {
  231. width: 70rpx;
  232. height: 70rpx;
  233. border-radius: 50%;
  234. }
  235. .userInfo_msg {
  236. margin-left: 18rpx;
  237. .msg_name {
  238. font-size: 28rpx;
  239. }
  240. .msg_star {
  241. margin-left: -5rpx;
  242. margin-top: 5rpx;
  243. }
  244. }
  245. }
  246. .box_time {
  247. display: flex;
  248. align-items: center;
  249. color: #a6a6a6;
  250. font-size: 24rpx;
  251. }
  252. .box_content {
  253. margin-top: 15rpx;
  254. font-size: 24rpx;
  255. color: #000;
  256. }
  257. .box_img {
  258. display: grid;
  259. grid-template-columns: 1fr 1fr 1fr;
  260. grid-auto-rows: auto;
  261. gap: 10rpx;
  262. margin-top: 20rpx;
  263. img {
  264. width: 216rpx;
  265. height: 216rpx;
  266. border-radius: 20rpx;
  267. }
  268. }
  269. .box_comment {
  270. display: flex;
  271. justify-content: flex-end;
  272. align-items: center;
  273. padding: 20rpx 0 30rpx;
  274. font-size: 24rpx;
  275. img {
  276. margin-right: 12rpx;
  277. width: 25rpx;
  278. height: 22rpx;
  279. }
  280. }
  281. }
  282. }
  283. }
  284. </style>