detail.vue 9.8 KB

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