record.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="text-color-12">
  3. <view class="sys-background-fff m-20 p-20 r-20" v-for="(msg,index) in msgList" :key="index">
  4. <view class="record-box row-justify-sb">
  5. <view class="row-c">
  6. <image class="wh-80 sys-radius-50" :src="msg.head_img" mode="aspectFill"></image>
  7. <view class="column m-l16">
  8. <text class="size-26 sys-weight-600">{{ msg.name }}</text>
  9. <text class="size-24 text-color-999">{{ msg.position_name }}</text>
  10. </view>
  11. </view>
  12. <view class="reply-box size-24">
  13. <view class="reply-top size-24"></view>
  14. <view class="reply-buttom size-24" @click="onSendChat(msg.id)">回复</view>
  15. </view>
  16. </view>
  17. <view class="row m-t20 ">
  18. <view class="empty-box"></view>
  19. <view class="m-l16 size-26 flex">
  20. <!-- 自己发送 -->
  21. <text> {{ msg.msg }}</text>
  22. <view class="image-box">
  23. <image class="reply-img wh-60 m-t20 r-10 m-r20" :src="msg_img.url" mode="aspectFill"
  24. v-for="(msg_img,index) in msg.msg_img" :key="index"></image>
  25. <!-- <en-image :img="msg.msg_img" :width="130" height="130"></en-image>-->
  26. </view>
  27. <!-- 文件类型 -->
  28. <view class="sys-from-background-color p-20 r-20 m-t20" v-if="msg.file_list.length>0">
  29. <view class="file-item row-c m-b20" @click.stop="openFile(file)"
  30. v-for="(file,fileIndex) in msg.file_list" :key="index">
  31. <image class="wh-45 m-r20" src="/static/img/task-details/icon-pdf.png" v-if="file.file_type===1" mode="aspectFill"></image>
  32. <image class="wh-45 m-r20" src="/static/img/task-details/icon-word.png" v-else-if="file.file_type===2" mode="aspectFill"> </image>
  33. <image class="wh-45 m-r20" src="/static/img/task-details/icon-excel.png" v-else mode="aspectFill"> </image>
  34. <text class="size-24 color-111827">{{ file.name }}</text>
  35. </view>
  36. </view>
  37. <!-- 1对1回复 -->
  38. <view class="sys-from-background-color p-20 m-t20 r-20" v-if="msg.reply_list.length>0">
  39. <view class="" v-for="replyItem in msg.reply_list">
  40. <text class="color-00A775">{{ replyItem.name }}</text><text
  41. class="m-lr10 text-color-666">回复</text><text
  42. class="color-00A775">{{ replyItem.ru_name }}:</text>
  43. <view class="">
  44. <view class="m-t16">{{ replyItem.msg }}</view>
  45. <view class="image-box" v-if="replyItem.msg_img.length>0">
  46. <image class="reply-img wh-60 m-t20 r-10 m-r20" :src="r_img.url" mode="aspectFill"
  47. v-for="(r_img,index) in replyItem.msg_img" :key="index"></image>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="row m-t20 ">
  55. <view class="empty-box"></view>
  56. <view class="size-22 text-color-999 m-l16">{{ msg.created_at }}</view>
  57. </view>
  58. </view>
  59. <en-blank v-if="msgList.length<=0"></en-blank>
  60. <uni-popup background-color="#fff" ref="popup" type="bottom" borderRadius="10px 10px 0 0"
  61. @touchmove.stop.prevent="moveHandle">
  62. <view class="page-env-160">
  63. <view class="row-justify-sb center p-lr30 p-t30">
  64. <view class="wh-25"></view>
  65. <text class="size-30 sys-weight-600">任务反馈</text>
  66. <image class="wh-25" src="https://wealfavor-1257406827.cos.ap-beijing.myqcloud.com/new-xcx/task-details/close.png" mode="" @click="onClose"></image>
  67. </view>
  68. <SendChat is_button @butClick="setMsg" v-model="msgData"></SendChat>
  69. </view>
  70. </uni-popup>
  71. </view>
  72. </template>
  73. <script>
  74. import SendChat from "./send_chat.vue"
  75. import {
  76. getMsgList,
  77. setMsg
  78. } from "@/api/task";
  79. import EnImage from "@/components/en-utils/en-image/en-image.vue";
  80. import tools from "@/service/tools";
  81. import EnBlank from "@/components/en-utils/en-blank/en-blank.vue";
  82. export default {
  83. components: {
  84. EnBlank,
  85. EnImage,
  86. SendChat
  87. },
  88. props: {
  89. businessId: {
  90. default: 0
  91. }
  92. },
  93. watch: {
  94. 'businessId': function() {
  95. }
  96. },
  97. data() {
  98. return {
  99. msgList: [],
  100. replyId: '',
  101. msgData: {
  102. business_id: '',
  103. msg: '',
  104. reply_id: 0,
  105. msg_img: [],
  106. file_list: [],
  107. },
  108. isAjax: false
  109. }
  110. },
  111. methods: {
  112. startData() {
  113. this.getMsgList()
  114. },
  115. setMsg() {
  116. if (this.isAjax) {
  117. return;
  118. }
  119. // this.isAjax=true;
  120. this.msgData.business_id = this.businessId
  121. if (this.replyId) {
  122. this.msgData.reply_id = this.replyId;
  123. }
  124. setMsg(this.msgData).then((res) => {
  125. if (res.code === 1) {
  126. tools.success(res.msg)
  127. this.msgData.reply_id = ''
  128. this.msgData.msg = ''
  129. this.msgData.msg_img = []
  130. this.getMsgList()
  131. this.$refs.popup.close()
  132. } else {
  133. tools.error(res.msg)
  134. this.isAjax = false;
  135. }
  136. })
  137. },
  138. openFile(file) {
  139. if (!file.url) {
  140. tools.error('下载地址不存在')
  141. return
  142. }
  143. tools.showLoading()
  144. uni.downloadFile({
  145. url: file.url, //仅为示例,并非真实的资源
  146. success: (dRes) => {
  147. tools.hideLoading()
  148. if (dRes.statusCode === 200) {
  149. tools.success('下载成功')
  150. uni.saveFile({
  151. tempFilePath: dRes.tempFilePath,
  152. success: (res) => {
  153. uni.openDocument({
  154. filePath: res.savedFilePath,
  155. showMenu: true,
  156. success: function(res) {}
  157. });
  158. }
  159. });
  160. }
  161. }
  162. });
  163. },
  164. getMsgList() {
  165. if (this.businessId <= 0) {
  166. return
  167. }
  168. getMsgList({
  169. 'business_id': this.businessId
  170. }).then((res) => {
  171. if (res.code === 1) {
  172. this.msgList = res.data;
  173. // this.setImgList()
  174. }
  175. })
  176. },
  177. moveHandle() {
  178. return false
  179. },
  180. onSendChat(replyId) {
  181. this.replyId = replyId
  182. this.$refs.popup.open('bottom')
  183. },
  184. onClose() {
  185. this.$refs.popup.close('bottom')
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .record-box {
  192. .reply-box {
  193. position: relative;
  194. }
  195. .reply-top {
  196. width: 98rpx;
  197. height: 45rpx;
  198. background: #0FB160;
  199. border-radius: 6rpx;
  200. opacity: 0.1;
  201. }
  202. .reply-buttom {
  203. width: 98rpx;
  204. height: 45rpx;
  205. line-height: 45rpx;
  206. text-align: center;
  207. position: absolute;
  208. top: 0;
  209. color: #0FB160;
  210. }
  211. }
  212. .empty-box {
  213. width: 80rpx;
  214. }
  215. .image-box {
  216. display: flex;
  217. flex-wrap: wrap;
  218. .reply-img {
  219. width: 130rpx;
  220. height: 130rpx;
  221. display: block;
  222. }
  223. }
  224. .file-item:last-child {
  225. margin-bottom: 0;
  226. }
  227. </style>