feebacklist.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="u-flex f-d-c ">
  3. <scroll-view @scrolltolower="init(id)" :scroll-y="true" class="cs-heig">
  4. <view class="comment" v-for="(res, index) in list" :key="res.id">
  5. <view class="left">
  6. <u-avatar width="90" height="90" mode="circle" />
  7. </view>
  8. <view class="right">
  9. <view class="top">
  10. <view class="name">{{ res.userId }}</view>
  11. </view>
  12. <view class="content">{{ res.content }}</view>
  13. <view class="u-flex">
  14. <view class="u-m-r-10" :key="key" v-for="(index,key) in res.imagear">
  15. <u-image @click="previewImage(index)" :src="index " width="150" height="150"></u-image>
  16. </view>
  17. </view>
  18. <view class="bottom">
  19. {{res.createTime}}
  20. </view>
  21. </view>
  22. </view>
  23. </scroll-view>
  24. <navigator hover-class="none" :url="`../taskfeeback/taskfeeback?id=${id}&title=${title}`" class="feebtn">我要反馈
  25. </navigator>
  26. <u-toast ref="uToast" />
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. taskfeedback
  32. } from '@/api/index.js'
  33. import dayjs from "dayjs";
  34. export default {
  35. data() {
  36. return {
  37. commentList: [],
  38. title: "",
  39. id: "",
  40. list: [],
  41. totalCount: -1,
  42. curPage: 1,
  43. totalPage: 0 //总页数
  44. };
  45. },
  46. onLoad(option) {
  47. this.title = option.title
  48. this.id = option.id
  49. },
  50. onShow() {
  51. this.totalCount = -1
  52. this.curPage = -1
  53. this.$nextTick(() => {
  54. this.init(this.id)
  55. })
  56. },
  57. methods: {
  58. // 点击图片事件
  59. previewImage(index) {
  60. uni.previewImage({
  61. current: index, //预览图片的下标
  62. urls: [index] //预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
  63. })
  64. },
  65. // createimg(arr) {
  66. // arr.map((index) => {
  67. // index.imagear = index.images.split(",")
  68. // return index
  69. // })
  70. // },
  71. // 处理图片数据格式
  72. spliteimage(datastring) {
  73. let ar = datastring.split(',')
  74. return ar
  75. },
  76. // 获取页面数据
  77. async init(id) {
  78. if (this.totalCount == -1) {
  79. let data = await taskfeedback({
  80. taskId: id,
  81. })
  82. let {
  83. list,
  84. total,
  85. } = data.data
  86. list = list.map((index) => {
  87. index.createTime = dayjs(index.createTime).format("YYYY-MM-DD HH:mm:ss")
  88. index.imagear = this.spliteimage(index.images)
  89. return index
  90. })
  91. this.list = list //列表
  92. } else {
  93. if (this.curPage <= this.totalPage) {
  94. let data = await taskfeedback({
  95. taskId: id,
  96. // page: this.curPage
  97. })
  98. let list = JSON.parse(JSON.stringify(this.list))
  99. list = list.map((index) => {
  100. index.imagear = this.spliteimage(index.images)
  101. return index
  102. })
  103. this.list = [
  104. ...list, ...data.data.list
  105. ]
  106. this.curPage = this.curPage + 1
  107. } else {
  108. this.$refs.uToast.show({
  109. title: '没有更多了',
  110. })
  111. }
  112. }
  113. },
  114. }
  115. };
  116. </script>
  117. <style lang="scss" scoped>
  118. .comment {
  119. display: flex;
  120. padding: 30rpx;
  121. .left {
  122. image {
  123. width: 64rpx;
  124. height: 64rpx;
  125. border-radius: 50%;
  126. background-color: #f2f2f2;
  127. }
  128. }
  129. .right {
  130. flex: 1;
  131. padding-left: 20rpx;
  132. font-size: 30rpx;
  133. .top {
  134. display: flex;
  135. justify-content: space-between;
  136. align-items: center;
  137. margin-bottom: 10rpx;
  138. .name {
  139. color: #5677fc;
  140. }
  141. .like {
  142. display: flex;
  143. align-items: center;
  144. color: #9a9a9a;
  145. font-size: 26rpx;
  146. .num {
  147. margin-right: 4rpx;
  148. color: #9a9a9a;
  149. }
  150. }
  151. .highlight {
  152. color: #5677fc;
  153. .num {
  154. color: #5677fc;
  155. }
  156. }
  157. }
  158. .content {
  159. margin-bottom: 10rpx;
  160. }
  161. .reply-box {
  162. background-color: rgb(242, 242, 242);
  163. border-radius: 12rpx;
  164. .item {
  165. padding: 20rpx;
  166. border-bottom: solid 2rpx $u-border-color;
  167. .username {
  168. font-size: 24rpx;
  169. color: #999999;
  170. }
  171. }
  172. .all-reply {
  173. padding: 20rpx;
  174. display: flex;
  175. color: #5677fc;
  176. align-items: center;
  177. .more {
  178. margin-left: 6rpx;
  179. }
  180. }
  181. }
  182. .bottom {
  183. margin-top: 20rpx;
  184. display: flex;
  185. font-size: 28rpx;
  186. font-weight: 400;
  187. color: #999999;
  188. .reply {
  189. color: #5677fc;
  190. margin-left: 10rpx;
  191. }
  192. }
  193. }
  194. }
  195. .feebtn {
  196. width: 690rpx;
  197. height: 90rpx;
  198. background: #4A8BFF;
  199. border-radius: 4rpx;
  200. font-size: 28rpx;
  201. text-align: center;
  202. line-height: 90rpx;
  203. font-family: Microsoft YaHei-3970(82674968);
  204. font-weight: bold;
  205. color: #FFFFFF;
  206. margin-top: 20rpx;
  207. }
  208. .cs-heig {
  209. height: calc(100vh - 140rpx);
  210. }
  211. </style>