合同见证-图片PDF展示

This commit is contained in:
binbin_pan 2025-01-14 10:09:08 +08:00
parent a032a52523
commit c1372e3200
1 changed files with 38 additions and 21 deletions

View File

@ -272,16 +272,18 @@
<u--form class="addForm" :model="contractData">
<view class="form-input-box">
<view style="width: 30%; height: 100%">合同照片</view>
<view style="width: 70%; height: 100%" v-if="contractWitnessType == 'img'">
<image style="width: 200rpx; height: 200rpx; margin: 10rpx" :src="contractImgUrl" mode=""></image>
</view>
<view style="width: 70%; height: 100%" v-if="contractWitnessType == 'file'" @click="openPdf2">
<image
style="width: 200rpx; height: 200rpx; margin: 10rpx"
src="../../../../static/realName/pdf.png"
mode=""
></image>
</view>
<div v-for="(item, index) in contractImgUrl" :key="index">
<view style="width: 70%; height: 100%" v-if="item.type == 'img'" @click="previewImg(item.url)">
<image style="width: 118rpx; height: 118rpx; margin: 10rpx" :src="item.url" mode=""></image>
</view>
<view style="width: 70%; height: 100%" v-else-if="item.type == 'file'" @click="openPdf2(item.url)">
<image
style="width: 118rpx; height: 118rpx; margin: 10rpx"
src="../../../../static/realName/pdf.png"
mode=""
></image>
</view>
</div>
</view>
<view class="form-input-box">
<view style="width: 30%; height: 100%">合同编号</view>
@ -403,7 +405,7 @@ export default {
showPopup1: false, //
showPopup2: false, //
contractData: {}, //
contractImgUrl: '',
contractImgUrl: [],
contractWitnessType: '',
showPopup3: false, //
listCertificate: {}, //
@ -464,13 +466,22 @@ export default {
},
openContract() {
this.contractData = this.detailData.listContract[0]
const isPdf = (this.contractData.witnessPath.split('.')[1] == 'pdf' || this.contractData.witnessPath.split('.')[1] == 'PDF') ? true : false
if (this.contractData.witnessPath && isPdf) {
this.contractWitnessType = 'file'
} else {
this.contractWitnessType = 'img'
}
this.contractImgUrl = config.realFileUrl + this.contractData.witnessPath
this.contractImgUrl = []
let arr = this.contractData.witnessPath.split(',')
arr.forEach(item => {
if (item.split('.')[1] == 'pdf' || item.split('.')[1] == 'PDF') {
this.contractImgUrl.push({
type: 'file',
url: config.realFileUrl + item
})
} else {
this.contractImgUrl.push({
type: 'img',
url: config.realFileUrl + item
})
}
})
// console.log('', this.contractImgUrl)
this.showPopup3 = true
},
closePopup3() {
@ -489,11 +500,11 @@ export default {
url: `/pages/realName/workbench/qualifications/listCertificatePdf?pdfUrl=${this.listCertificate.certificateTypeFile}`
})
},
openPdf2() {
console.log('附件打开', this.contractImgUrl)
openPdf2(url) {
console.log('附件打开', url)
// let url = config.realFileUrl+this.contractData.witnessPath
uni.navigateTo({
url: `/pages/realName/workbench/qualifications/listCertificatePdf?pdfUrl=${this.contractImgUrl}`
url: `/pages/realName/workbench/qualifications/listCertificatePdf?pdfUrl=${url}`
})
},
leftClick() {
@ -501,6 +512,12 @@ export default {
uni.navigateBack({
delta: 1 //
})
},
//
previewImg(url) {
uni.previewImage({
urls: [url]
})
}
},
// onShow() {},