feebacklist.vue 4.3 KB

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