detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <view class="detail">
  3. <view class="header-info">
  4. <view class="title">反馈描述</view>
  5. <view class="type">
  6. <text>反馈类型:</text>
  7. {{ detail.type }}
  8. </view>
  9. <view class="remarks">
  10. <text>反馈描述:</text>
  11. {{ detail.remarks }}
  12. </view>
  13. <view class="file-box">
  14. <block v-for="item in detail.attinfos" :key="item.attachmentid">
  15. <view v-if="item.fileType == 'image'" @click="viewImages(item.url)" class="item">
  16. <u-image :src="item.url" :width="tovw(105)" :height="tovw(105)" :lazy-load="true"
  17. radius="5"></u-image>
  18. </view>
  19. <view v-else-if="item.fileType == 'video'" class="item">
  20. <video class="video" :style="{ width: tovw(105), height: tovw(105) }" :poster="item.subfiles[0].url"
  21. :src="item.url" />
  22. </view>
  23. </block>
  24. </view>
  25. </view>
  26. <view class="message-box">
  27. <view class="message-header">
  28. <text>回复</text>
  29. <text>共<text style="padding: 0 5px;">{{ total }}</text>条</text>
  30. </view>
  31. <view class="content">
  32. <view class="message-item" v-for="item in list" :key="item.sys_datacommentid">
  33. <u-image
  34. :src="item.headpic ? item.headpic : 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404231713854678447B26b4363.svg'"
  35. :width="tovw(32)" :height="tovw(32)" :lazy-load="true" radius="50%"></u-image>
  36. <view class="user-info">
  37. <text class="name">{{ item.name }}</text>
  38. <view class="message-text">
  39. {{ item.content }}
  40. </view>
  41. <text class="time">{{ item.createdate }}</text>
  42. </view>
  43. </view>
  44. <view v-if="!list.length" style="padding:50px 0 100px 0;">
  45. <u-empty mode="data" text="暂无回复" />
  46. </view>
  47. <view v-else style="padding-bottom: 10px;">
  48. <u-divider text="已经到底部" :dashed="true" />
  49. </view>
  50. </view>
  51. </view>
  52. <view :style="{ height: tovw(75) }"></view>
  53. <view class="footer">
  54. <view class="input-box" hover-class="navigator-hover">
  55. <input class="input" type="text" placeholder="评论" :value="commentText" maxlength="499"
  56. @input="changeComment" confirm-type="send" @confirm="onSend">
  57. <icon v-if="commentText" class="icon" type="clear" size="3.733vw" @click="onClear" />
  58. </view>
  59. <view class="add-box">
  60. <view class="add" hover-class="navigator-hover" @click="loading ? '' : onSend()">
  61. <u-loading-icon v-if="loading" />
  62. <block v-else>
  63. 发送
  64. </block>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import { formattedFiles, viewImage } from "../../utils/settleFiles.js"
  72. export default {
  73. data() {
  74. return {
  75. detail: { attinfos: [] },
  76. "content": {
  77. "sa_feedbackid": '',
  78. "pageNumber": 1,
  79. "pageSize": 20
  80. },
  81. list: [],
  82. id: '',
  83. commentText: '',
  84. total: 0,
  85. loading: false
  86. }
  87. },
  88. onReachBottom() {
  89. if (!this.loadingGetList) this.getComment();
  90. },
  91. methods: {
  92. async getDetail(id) {
  93. let res = await this.$Http.basic({
  94. "id": 20240517102602,
  95. "content": {
  96. sa_feedbackid: id
  97. },
  98. })
  99. res.data.attinfos = formattedFiles(res.data.attinfos)
  100. this.detail = res.data
  101. console.log(this.detail, '反馈信息');
  102. },
  103. async getComment(init = false) {
  104. return new Promise(async (resolve, reject) => {
  105. if (this.paging(this.content, init)) return resolve();
  106. this.content.sa_feedbackid = this.id
  107. await this.$Http.basic({
  108. "id": 20240517103002,
  109. content: this.content
  110. }).then(res => {
  111. resolve();
  112. if (this.cutoff(res.msg)) return;
  113. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  114. this.content.pageNumber = res.pageNumber - 0 + 1;
  115. this.content.pageTotal = res.pageTotal;
  116. this.content.pageSize = res.pageSize;
  117. this.total = res.total;
  118. console.log('回复列表', this.list);
  119. })
  120. })
  121. },
  122. /* 预览图片 */
  123. viewImages(url) {
  124. viewImage(url)
  125. },
  126. changeComment(e) {
  127. this.commentText = e.detail.value;
  128. },
  129. onSend() {
  130. if (this.commentText == '') return uni.showToast({
  131. title: '还未输入评论内容!',
  132. duration: 2000,
  133. icon: "none"
  134. });
  135. this.loading = true
  136. this.$Http.basic({
  137. "id": 20240417161502,
  138. "content": {
  139. "ownertable": "sa_feedback",
  140. "ownerid": this.id,
  141. "contentstr": this.commentText
  142. },
  143. }).then(res => {
  144. console.log("发送评论", res)
  145. this.loading = false
  146. if (this.cutoff(res.msg, '评论成功')) return;
  147. this.commentText = '';
  148. this.getComment(true)
  149. })
  150. },
  151. onClear() {
  152. let that = this;
  153. uni.showModal({
  154. title: '提示',
  155. content: '是否确定清空评论?',
  156. success: ({ confirm }) => {
  157. if (confirm) that.commentText = ""
  158. },
  159. })
  160. },
  161. },
  162. onLoad(options) {
  163. this.id = options.id
  164. this.getDetail(options.id)
  165. this.getComment(true)
  166. }
  167. }
  168. </script>
  169. <style lang="scss">
  170. .detail {
  171. box-sizing: border-box;
  172. font-family: Source Han Sans SC, Source Han Sans SC;
  173. .header-info {
  174. display: flex;
  175. flex-direction: column;
  176. padding: 15px 10px;
  177. margin: 10px;
  178. border-radius: 8px 8px 8px 8px;
  179. background: #FFFFFF;
  180. .title {
  181. font-weight: bold;
  182. font-size: 16px;
  183. color: #333333;
  184. }
  185. .type {
  186. display: flex;
  187. align-items: center;
  188. font-weight: 400;
  189. font-size: 12px;
  190. color: #666666;
  191. margin: 10px 0;
  192. text {}
  193. }
  194. .remarks {
  195. font-weight: 400;
  196. font-size: 12px;
  197. color: #666666;
  198. margin-bottom: 10px;
  199. }
  200. .file-box {
  201. display: block;
  202. .item {
  203. margin: 0 10px 10px 0;
  204. display: inline-block;
  205. &:nth-child(3n) {
  206. margin-right: 0 !important;
  207. }
  208. }
  209. }
  210. }
  211. .message-box {
  212. background: #FFFFFF;
  213. padding: 12px 10px 0 10px;
  214. .message-header {
  215. display: flex;
  216. justify-content: space-between;
  217. padding-bottom: 20px;
  218. text {
  219. color: #333333;
  220. &:first-child {
  221. font-weight: 500;
  222. font-size: 16px;
  223. }
  224. &:last-child {
  225. font-weight: 400;
  226. font-size: 14px;
  227. }
  228. }
  229. }
  230. .content {
  231. .message-item {
  232. margin-bottom: 20px;
  233. display: flex;
  234. align-self: self-start;
  235. padding-bottom: 10px;
  236. .user-info {
  237. display: flex;
  238. flex-direction: column;
  239. margin-left: 10px;
  240. .name {
  241. font-weight: 500;
  242. font-size: 14px;
  243. color: #666666;
  244. }
  245. .message-text {
  246. font-weight: 400;
  247. font-size: 14px;
  248. color: #333333;
  249. margin: 10px 0;
  250. }
  251. .time {
  252. font-weight: 400;
  253. font-size: 12px;
  254. color: #999999;
  255. }
  256. }
  257. }
  258. }
  259. }
  260. .footer {
  261. display: flex;
  262. position: fixed;
  263. bottom: 0;
  264. left: 0;
  265. width: 375px;
  266. background: #FFFFFF;
  267. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  268. padding: 10px 10px 15px 10px;
  269. .add-box {
  270. padding: 0 20px 0 20px;
  271. }
  272. .add {
  273. display: flex;
  274. align-items: center;
  275. align-content: center;
  276. justify-content: center;
  277. width: 95px;
  278. height: 45px;
  279. background: #C30D23;
  280. border-radius: 5px;
  281. font-family: PingFang SC, PingFang SC;
  282. font-size: 14px;
  283. color: #FFFFFF;
  284. }
  285. .input-box {
  286. display: flex;
  287. align-items: center;
  288. flex: 1;
  289. height: 45px;
  290. background: #F7F7F7;
  291. border-radius: 50px;
  292. border: 1px solid #CCCCCC;
  293. padding: 0 10px 0 20px;
  294. box-sizing: border-box;
  295. .input {
  296. flex: 1;
  297. height: 45px;
  298. line-height: 45px;
  299. }
  300. .icon {
  301. margin-left: 5px;
  302. }
  303. }
  304. }
  305. }
  306. </style>