record-details.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="container qualifications" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0' }">
  3. <view class="remarks-content">
  4. <view class="list-view-title">
  5. <view class="list-view-h1">咨询人</view>
  6. </view>
  7. <view class="remarks-input">{{ remarksParams.questionMan }}</view>
  8. <view class="list-view-title"> <view class="list-view-h1">咨询类别:{{ remarksParams.consultBack ? remarksParams.consultBack : '无' }}</view> </view>
  9. <view class="list-view-title"> <view class="list-view-h1">关键词记录:</view> </view>
  10. <view class="tui-remarks-content">
  11. <text class="tui-remarks-span" v-for="(label, labelIndex) in remarksParams.remarks" :key="labelIndex">
  12. {{ label }}
  13. </text>
  14. </view>
  15. <view class="list-view-title" v-if="remarksParams.imageList.length>0"> <view class="list-view-h1">图片</view> </view>
  16. <view class="list-view-upload clearfix" v-if="remarksParams.imageList.length>0">
  17. <view class="photo-item" v-for="(image, imageIndex) in remarksParams.imageList" :key="imageIndex">
  18. <image
  19. :src="image"
  20. mode="aspectFill"
  21. @click.stop="previewImg(remarksParams.imageList, imageIndex)"
  22. ></image>
  23. </view>
  24. </view>
  25. <view class="list-view-title" v-if="remarksParams.fileList.length>0"> <view class="list-view-h1">文件</view> </view>
  26. <view class="list-view" v-for="(file, fileIndex) in remarksParams.fileList" :key="fileIndex" v-if="remarksParams.fileList.length>0">
  27. <view class="list-view-text">
  28. <view class="input">{{ file.fileName }}</view>
  29. <view class="delbtn" @click.stop="previewFile(file)">预览</view>
  30. <!-- <view class="delbtn down" @click.stop="previewFile(file)">下载</view> -->
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { mapState, mapMutations } from 'vuex'
  38. import authorize from '@/common/config/authorize.js'
  39. import { uploadFileImage, uploadFilePdfDocDocx } from '@/services/public.js'
  40. var isPreviewImg
  41. export default {
  42. data() {
  43. return {
  44. isIphoneX: this.$store.state.isIphoneX,
  45. productActions: [],
  46. remarksParams: {},
  47. remarksId:0,
  48. categorys:'产品,二手,耗材'
  49. }
  50. },
  51. onLoad(option) {
  52. console.log(option)
  53. this.remarksId = option.remarksId
  54. this.getUserRemarksVisitDetail()
  55. },
  56. methods: {
  57. ...mapMutations(['login']),
  58. getUserRemarksVisitDetail() {
  59. //资料详情
  60. this.UserService.getUserRemarksVisitDetail({
  61. remarksId: this.remarksId
  62. })
  63. .then(response => {
  64. this.remarksParams = response.data
  65. })
  66. .catch(error => {
  67. this.$util.msg(error.msg, 2000)
  68. })
  69. },
  70. previewImg(image, index) {
  71. //顶部商品图片预览
  72. isPreviewImg = true
  73. let previewUrls = image
  74. uni.previewImage({
  75. current: index, //图片索引
  76. urls: previewUrls, //必须是http图片,本地图片无效
  77. longPressActions: ''
  78. })
  79. },
  80. previewFile(file){//预览文件
  81. this.openDocument(file)
  82. },
  83. openDocument(file) {// 打开文档
  84. uni.showLoading({
  85. title:'加载中'
  86. })
  87. // 获取文件后缀
  88. const index = file.fileName.lastIndexOf('.')
  89. const suffix = file.fileName.substring(index + 1)
  90. // 下载文件
  91. uni.downloadFile({
  92. url: file.fileUrl,
  93. success(res) {
  94. const filePath = res.tempFilePath
  95. console.log(filePath)
  96. // 打开文件
  97. uni.openDocument({
  98. filePath: filePath,
  99. fileType: suffix,
  100. success(res) {
  101. uni.showToast({
  102. icon:'success',
  103. title:'打开成功',
  104. duration: 1200
  105. })
  106. uni.hideLoading()
  107. },
  108. fail(err) {
  109. if(err.errMsg.indexOf('fail filetype not supported')){
  110. uni.showModal({
  111. content: '不支持的文件预览',
  112. cancelColor: '#666',
  113. confirmColor: '#E15616'
  114. })
  115. }
  116. uni.hideLoading()
  117. }
  118. })
  119. },
  120. fail(err){
  121. uni.showToast({
  122. title: JSON.stringify(err),
  123. icon:'none',
  124. duration: 5000
  125. })
  126. uni.hideLoading()
  127. },
  128. })
  129. },
  130. },
  131. onShow() {}
  132. }
  133. </script>
  134. <style lang="scss">
  135. page {
  136. height: auto;
  137. background: #ffffff;
  138. }
  139. .remarks-content {
  140. width: 100%;
  141. height: auto;
  142. box-sizing: border-box;
  143. padding: 0 24rpx;
  144. padding-bottom: 80rpx;
  145. .list-view-title {
  146. width: 100%;
  147. height: auto;
  148. margin-bottom: 16rpx;
  149. margin-top: 40rpx;
  150. .list-view-h1 {
  151. line-height: 40rpx;
  152. font-size: $font-size-28;
  153. color: #333333;
  154. text-align: left;
  155. }
  156. }
  157. .tui-remarks-content {
  158. width: 100%;
  159. height: auto;
  160. margin-bottom: 24rpx;
  161. .tui-remarks-span{
  162. height: 48rpx;
  163. line-height: 48rpx;
  164. text-align: center;
  165. padding: 0 20rpx;
  166. background-color: #FEF6F3;
  167. font-size: $font-size-26;
  168. color: #E15616;
  169. border-radius: 25rpx;
  170. display: inline-block;
  171. margin-right:24rpx;
  172. margin-bottom: 24rpx;
  173. &:nth-child(4n){
  174. margin-right: none;
  175. }
  176. }
  177. }
  178. .list-view {
  179. width: 100%;
  180. height: auto;
  181. margin-top: 20rpx;
  182. .list-view-text {
  183. width: 100%;
  184. float: left;
  185. .input {
  186. width: 500rpx;
  187. height: 50rpx;
  188. box-sizing: border-box;
  189. line-height: 50rpx;
  190. color: #333333;
  191. text-overflow: ellipsis;
  192. overflow: hidden;
  193. display: -webkit-box;
  194. -webkit-line-clamp: 1;
  195. line-clamp: 1;
  196. -webkit-box-orient: vertical;
  197. float: left;
  198. font-size: 26rpx;
  199. }
  200. .delbtn{
  201. width: 96rpx;
  202. height: 44rpx;
  203. border-radius: 8rpx;
  204. font-size: $font-size-24;
  205. color: #e15616;
  206. line-height: 44rpx;
  207. text-align: center;
  208. float: left;
  209. &.down{
  210. color: #1890F9;
  211. }
  212. }
  213. }
  214. }
  215. .list-view-upload {
  216. width: 100%;
  217. height: auto;
  218. .photo-item {
  219. display: inline-block;
  220. width: 112rpx;
  221. height: 112rpx;
  222. margin: 10rpx 0;
  223. margin-right: 25rpx;
  224. border-radius: 10rpx;
  225. border: 1px solid #f5f5f5;
  226. position: relative;
  227. float: left;
  228. image {
  229. width: 112rpx;
  230. height: 112rpx;
  231. border-radius: 10rpx;
  232. }
  233. }
  234. .photo-list {
  235. width: 100%;
  236. height: 116rpx;
  237. overflow: hidden;
  238. white-space: nowrap;
  239. display: flex;
  240. align-items: flex-start;
  241. }
  242. }
  243. }
  244. </style>