detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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)" class="item" hover-class="navigator-hover">
  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" hover-class="navigator-hover">
  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/202406011717209838416B6150695f.webp'"
  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, viewMedias } 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(item) {
  124. viewMedias(this.detail.attinfos.filter(v => v.fileType == 'image'),this.detail.attinfos.indexOf(item),'image')
  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.$Http.setCallCount()
  146. this.loading = false
  147. if (this.cutoff(res.msg, '评论成功')) return;
  148. this.commentText = '';
  149. this.getComment(true)
  150. })
  151. },
  152. onClear() {
  153. let that = this;
  154. uni.showModal({
  155. title: '提示',
  156. content: '是否确定清空评论?',
  157. success: ({ confirm }) => {
  158. if (confirm) that.commentText = ""
  159. },
  160. })
  161. },
  162. },
  163. onLoad(options) {
  164. this.id = options.id
  165. this.getDetail(options.id)
  166. this.getComment(true)
  167. },
  168. onUnload () {
  169. delete this.$Http.setCallCount
  170. }
  171. }
  172. </script>
  173. <style lang="scss">
  174. .detail {
  175. box-sizing: border-box;
  176. font-family: Source Han Sans SC, Source Han Sans SC;
  177. .header-info {
  178. display: flex;
  179. flex-direction: column;
  180. padding: 15px 10px;
  181. margin: 10px;
  182. border-radius: 8px 8px 8px 8px;
  183. background: #FFFFFF;
  184. .title {
  185. font-weight: bold;
  186. font-size: 16px;
  187. color: #333333;
  188. }
  189. .type {
  190. display: flex;
  191. align-items: center;
  192. font-weight: 400;
  193. font-size: 12px;
  194. color: #666666;
  195. margin: 10px 0;
  196. text {}
  197. }
  198. .remarks {
  199. font-weight: 400;
  200. font-size: 12px;
  201. color: #666666;
  202. margin-bottom: 10px;
  203. }
  204. .file-box {
  205. display: block;
  206. .item {
  207. margin: 0 10px 10px 0;
  208. display: inline-block;
  209. border-radius: 5px;
  210. &:nth-child(3n) {
  211. margin-right: 0 !important;
  212. }
  213. }
  214. }
  215. }
  216. .message-box {
  217. background: #FFFFFF;
  218. padding: 12px 10px 0 10px;
  219. .message-header {
  220. display: flex;
  221. justify-content: space-between;
  222. padding-bottom: 20px;
  223. text {
  224. color: #333333;
  225. &:first-child {
  226. font-weight: 500;
  227. font-size: 16px;
  228. }
  229. &:last-child {
  230. font-weight: 400;
  231. font-size: 14px;
  232. }
  233. }
  234. }
  235. .content {
  236. .message-item {
  237. margin-bottom: 20px;
  238. display: flex;
  239. align-self: self-start;
  240. padding-bottom: 10px;
  241. .user-info {
  242. display: flex;
  243. flex-direction: column;
  244. margin-left: 10px;
  245. .name {
  246. font-weight: 500;
  247. font-size: 14px;
  248. color: #666666;
  249. }
  250. .message-text {
  251. font-weight: 400;
  252. font-size: 14px;
  253. color: #333333;
  254. margin: 10px 0;
  255. }
  256. .time {
  257. font-weight: 400;
  258. font-size: 12px;
  259. color: #999999;
  260. }
  261. }
  262. }
  263. }
  264. }
  265. .footer {
  266. display: flex;
  267. position: fixed;
  268. bottom: 0;
  269. left: 0;
  270. width: 375px;
  271. background: #FFFFFF;
  272. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  273. padding: 10px 10px 15px 10px;
  274. .add-box {
  275. padding: 0 20px 0 20px;
  276. }
  277. .add {
  278. display: flex;
  279. align-items: center;
  280. align-content: center;
  281. justify-content: center;
  282. width: 95px;
  283. height: 45px;
  284. background: #C30D23;
  285. border-radius: 5px;
  286. font-family: PingFang SC, PingFang SC;
  287. font-size: 14px;
  288. color: #FFFFFF;
  289. }
  290. .input-box {
  291. display: flex;
  292. align-items: center;
  293. flex: 1;
  294. height: 45px;
  295. background: #F7F7F7;
  296. border-radius: 50px;
  297. border: 1px solid #CCCCCC;
  298. padding: 0 10px 0 20px;
  299. box-sizing: border-box;
  300. .input {
  301. flex: 1;
  302. height: 45px;
  303. line-height: 45px;
  304. }
  305. .icon {
  306. margin-left: 5px;
  307. }
  308. }
  309. }
  310. }
  311. </style>