123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <template>
- <view class="container qualifications" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0' }">
- <view class="remarks-content">
- <view class="list-view-title"> <view class="list-view-h1">文字备注</view> </view>
- <view class="remarks-textarea"> {{ remarksParams.remarks }} </view>
- <view class="list-view-title" v-if="remarksParams.imageList.length>0"> <view class="list-view-h1">图片</view> </view>
- <view class="list-view-upload clearfix" v-if="remarksParams.imageList.length>0">
- <view class="photo-item" v-for="(image, imageIndex) in remarksParams.imageList" :key="imageIndex">
- <image
- :src="image"
- mode="aspectFill"
- @click.stop="previewImg(remarksParams.imageList, imageIndex)"
- ></image>
- </view>
- </view>
- <view class="list-view-title" v-if="remarksParams.fileList.length>0"> <view class="list-view-h1">文件</view> </view>
- <view class="list-view" v-for="(file, fileIndex) in remarksParams.fileList" :key="fileIndex" v-if="remarksParams.fileList.length>0">
- <view class="list-view-text">
- <view class="input">{{ file.fileName }}</view>
- <view class="delbtn" @click.stop="previewFile(file)">预览</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex'
- import authorize from '@/common/config/authorize.js'
- import { uploadFileImage, uploadFilePdfDocDocx } from '@/services/public.js'
- var isPreviewImg
- export default {
- data() {
- return {
- isIphoneX: this.$store.state.isIphoneX,
- productActions: [],
- remarksParams: {},
- remarksId:0
- }
- },
- onLoad(option) {
- console.log(option)
- this.remarksId = option.remarksId
- this.getUserClubRemarksDetail()
- },
- methods: {
- ...mapMutations(['login']),
- getUserClubRemarksDetail() {
- //资料详情
- this.UserService.getUserClubRemarksDetail({
- remarksId: this.remarksId
- })
- .then(response => {
- this.remarksParams = response.data
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- previewImg(image, index) {
- //顶部商品图片预览
- isPreviewImg = true
- let previewUrls = image
- uni.previewImage({
- current: index, //图片索引
- urls: previewUrls, //必须是http图片,本地图片无效
- longPressActions: ''
- })
- },
- previewFile(file){//预览文件
- this.openDocument(file)
- },
- openDocument(file) {// 打开文档
- uni.showLoading({
- title:'加载中'
- })
- // 获取文件后缀
- const index = file.fileName.lastIndexOf('.')
- const suffix = file.fileName.substring(index + 1)
- // 下载文件
- uni.downloadFile({
- url: file.fileUrl,
- success(res) {
- const filePath = res.tempFilePath
- console.log(filePath)
- // 打开文件
- uni.openDocument({
- filePath: filePath,
- fileType: suffix,
- success(res) {
- uni.showToast({
- icon:'success',
- title:'打开成功',
- duration: 1200
- })
- uni.hideLoading()
- },
- fail(err) {
- if(err.errMsg.indexOf('fail filetype not supported')){
- uni.showModal({
- content: '不支持的文件预览',
- cancelColor: '#666',
- confirmColor: '#E15616'
- })
- }
- uni.hideLoading()
- }
- })
- },
- fail(err){
- uni.showToast({
- title: JSON.stringify(err),
- icon:'none',
- duration: 5000
- })
- uni.hideLoading()
- },
- })
- }
- },
- onShow() {}
- }
- </script>
- <style lang="scss">
- page {
- height: auto;
- background: #ffffff;
- }
- .remarks-content {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding: 0 24rpx;
- .list-view-title {
- width: 100%;
- height: auto;
- margin-bottom: 16rpx;
- margin-top: 40rpx;
- .list-view-h1 {
- line-height: 40rpx;
- font-size: $font-size-28;
- color: #333333;
- text-align: left;
- }
- }
- .remarks-textarea {
- width: 100%;
- height: 340rpx;
- padding: 16rpx;
- margin: 20rpx 0 0 0;
- border-radius: 6rpx;
- position: relative;
- border: 1px solid #b2b2b2;
- box-sizing: border-box;
- overflow-y: scroll;
- line-height: 38rpx;
- font-size: $font-size-26;
- color: #333333;
- }
- .list-view {
- width: 100%;
- height: auto;
- margin-top: 20rpx;
- .list-view-text {
- width: 100%;
- float: left;
- .input {
- width: 560rpx;
- height: 50rpx;
- box-sizing: border-box;
- line-height: 50rpx;
- color: #333333;
- text-overflow: ellipsis;
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- line-clamp: 1;
- -webkit-box-orient: vertical;
- float: left;
- font-size: 26rpx;
- }
- .delbtn{
- width: 96rpx;
- height: 44rpx;
- border-radius: 8rpx;
- background-color: #fff2ec;
- font-size: $font-size-24;
- color: #e15616;
- line-height: 44rpx;
- text-align: center;
- float: left;
- }
- }
- }
- .list-view-upload {
- width: 100%;
- height: auto;
- .photo-item {
- display: inline-block;
- width: 112rpx;
- height: 112rpx;
- margin: 10rpx 0;
- margin-right: 25rpx;
- border-radius: 10rpx;
- border: 1px solid #f5f5f5;
- position: relative;
- float: left;
- image {
- width: 112rpx;
- height: 112rpx;
- border-radius: 10rpx;
- }
- }
- .photo-list {
- width: 100%;
- height: 116rpx;
- overflow: hidden;
- white-space: nowrap;
- display: flex;
- align-items: flex-start;
- }
- }
- }
- </style>
|