record-details.vue 5.9 KB

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