record-details.vue 6.2 KB

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