record.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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" src="/static/img/index/index-avatar.png" 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">回复</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)" v-for="(file,fileIndex) in msg.file_list" :key="index">
  30. <image class="wh-45 m-r20" src="/static/img/task-details/icon-pdf.png" mode="aspectFill">
  31. </image>
  32. <text class="size-24 color-111827">{{ file.name }}</text>
  33. </view>
  34. </view>
  35. <!-- 1对1回复 -->
  36. <view class="sys-from-background-color p-20 m-t20 r-20" v-if="msg.reply_list.length>0">
  37. <view class="" v-for="replyItem in msg.reply_list">
  38. <text class="color-00A775">{{ replyItem.name }}</text><text
  39. class="m-lr10 text-color-666">回复</text><text class="color-00A775">{{ replyItem.ru_name }}:</text>
  40. <view class="">
  41. <view class="m-t16">{{ replyItem.msg }}</view>
  42. <view class="image-box" v-if="replyItem.msg_img.length>0">
  43. <image class="reply-img wh-60 m-t20 r-10 m-r20" :src="r_img.url"
  44. mode="aspectFill" v-for="(r_img,index) in replyItem.msg_img" :key="index"></image>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <en-blank v-if="msgList.length<=0"></en-blank>
  53. <uni-popup background-color="#fff" ref="popup" type="bottom" borderRadius="10px 10px 0 0"
  54. @touchmove.stop.prevent="moveHandle">
  55. <view class="page-env-160">
  56. <view class="row-justify-sb center p-lr30 p-t30">
  57. <view class="wh-25"></view>
  58. <text class="size-30 sys-weight-600">任务反馈</text>
  59. <image class="wh-25" src="/static/img/task-details/close.png" mode="" @click="onClose"></image>
  60. </view>
  61. <SendChat is_button></SendChat>
  62. </view>
  63. </uni-popup>
  64. </view>
  65. </template>
  66. <script>
  67. import SendChat from "./send_chat.vue"
  68. import {getMsgList} from "@/api/task";
  69. import EnImage from "@/components/en-utils/en-image/en-image.vue";
  70. import tools from "@/service/tools";
  71. import EnBlank from "@/components/en-utils/en-blank/en-blank.vue";
  72. export default {
  73. components: {
  74. EnBlank,
  75. EnImage,
  76. SendChat
  77. },
  78. props: {
  79. businessId:{
  80. default:0
  81. }
  82. },
  83. watch:{
  84. 'businessId':function () {
  85. this.getMsgList()
  86. }
  87. },
  88. data() {
  89. return {
  90. msgList: [],
  91. }
  92. },
  93. methods: {
  94. openFile(file) {
  95. if (!file.url) {
  96. tools.error('下载地址不存在')
  97. return
  98. }
  99. tools.showLoading()
  100. uni.downloadFile({
  101. url: file.url, //仅为示例,并非真实的资源
  102. success: (dRes) => {
  103. tools.hideLoading()
  104. if (dRes.statusCode === 200) {
  105. tools.success('下载成功')
  106. uni.saveFile({
  107. tempFilePath: dRes.tempFilePath,
  108. success: (res) => {
  109. uni.openDocument({
  110. filePath: res.savedFilePath,
  111. showMenu: true,
  112. success: function (res) {
  113. }
  114. });
  115. }
  116. });
  117. }
  118. }
  119. });
  120. },
  121. getMsgList() {
  122. if(this.businessId<=0){
  123. return
  124. }
  125. getMsgList({
  126. 'business_id': this.businessId
  127. }).then((res) => {
  128. if (res.code === 1) {
  129. this.msgList = res.data;
  130. // this.setImgList()
  131. }
  132. })
  133. },
  134. moveHandle() {
  135. return false
  136. },
  137. onSendChat() {
  138. this.$refs.popup.open('bottom')
  139. },
  140. onClose() {
  141. this.$refs.popup.close('bottom')
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. .record-box {
  148. .reply-box {
  149. position: relative;
  150. }
  151. .reply-top {
  152. width: 98rpx;
  153. height: 45rpx;
  154. background: #0FB160;
  155. border-radius: 6rpx;
  156. opacity: 0.1;
  157. }
  158. .reply-buttom {
  159. width: 98rpx;
  160. height: 45rpx;
  161. line-height: 45rpx;
  162. text-align: center;
  163. position: absolute;
  164. top: 0;
  165. color: #0FB160;
  166. }
  167. }
  168. .empty-box {
  169. width: 80rpx;
  170. }
  171. .image-box {
  172. display: flex;
  173. flex-wrap: wrap;
  174. .reply-img {
  175. width: 130rpx;
  176. height: 130rpx;
  177. display: block;
  178. }
  179. }
  180. .file-item:last-child {
  181. margin-bottom: 0;
  182. }
  183. </style>