detail.vue 9.9 KB

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