Commit 937d9ca1 authored by xinzhedeai's avatar xinzhedeai

add: 图片显示自定义url格式 修改

parent b487ed54
...@@ -17,12 +17,12 @@ axios.defaults.headers.post['Content-Type'] = 'application/json' ...@@ -17,12 +17,12 @@ axios.defaults.headers.post['Content-Type'] = 'application/json'
// 商户token // 商户token
axios.defaults.headers.common['Authorization'] = // axios.defaults.headers.common['Authorization'] =
'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxNTcyMTAzMTg4NiIsImxvZ2luX3VzZXJfa2V5IjoiNGJjY2JjYzUtNmY0Yy00ZDhlLWJiYzEtZjYzMzVlZDBlZTgwIn0.j3jEfHzeu3kklm60kKCirwwyKaWD51ABicOzxEnuFOfGe63FFqYOQ122ojAhukbInnKj4try3DjrST6wNDVjVQ' // 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxNTcyMTAzMTg4NiIsImxvZ2luX3VzZXJfa2V5IjoiNGJjY2JjYzUtNmY0Yy00ZDhlLWJiYzEtZjYzMzVlZDBlZTgwIn0.j3jEfHzeu3kklm60kKCirwwyKaWD51ABicOzxEnuFOfGe63FFqYOQ122ojAhukbInnKj4try3DjrST6wNDVjVQ'
// admin账号token // admin账号token
// axios.defaults.headers.common['Authorization'] = axios.defaults.headers.common['Authorization'] =
// 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiNTljMWVhMTMtODNmYy00OWI2LWI5YzMtM2VkNzliODFhZjg4In0.XHl0IpagNwLJBqW_s2n6Kzhs9eY-TrMUBfAO8oeikYRUH72eshEXwMsTyTWgVnX_okY4tuB4U124AeF6EO_qiQ' 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiOTEyODc0N2ItNGE4NC00MWRjLTg0ZGUtZTY1ODNkMzBiNDcwIn0.w_JRlifng-sUQqvGnuRFH5-wiL-1tfwI1cF7E97gjaOZ37bvRQld3120Myf9MYqLtVHUVX_vhlcBj7Kmg9exZw'
// 请求拦截器 // 请求拦截器
......
...@@ -16,8 +16,8 @@ if (window.env == 'dev') { ...@@ -16,8 +16,8 @@ if (window.env == 'dev') {
'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiLlvKDlrZ3lvakiLCJsb2dpbl91c2VyX2tleSI6IjNjMmRiMWFiLWIyZGMtNDBjYi04YjM5LWRiNTJmM2VmYzNkYyJ9.sfZyPP-COShNCjwxKR26zGDsPHXss97gu7JEpaMapIZyMQEsxzMigVickcqdhaqDwTRcfr0IxAj64vnrriS9Cw' 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiLlvKDlrZ3lvakiLCJsb2dpbl91c2VyX2tleSI6IjNjMmRiMWFiLWIyZGMtNDBjYi04YjM5LWRiNTJmM2VmYzNkYyJ9.sfZyPP-COShNCjwxKR26zGDsPHXss97gu7JEpaMapIZyMQEsxzMigVickcqdhaqDwTRcfr0IxAj64vnrriS9Cw'
// admin账号token // admin账号token
// axios.defaults.headers.common['Authorization'] = axios.defaults.headers.common['Authorization'] =
// 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiNTljMWVhMTMtODNmYy00OWI2LWI5YzMtM2VkNzliODFhZjg4In0.XHl0IpagNwLJBqW_s2n6Kzhs9eY-TrMUBfAO8oeikYRUH72eshEXwMsTyTWgVnX_okY4tuB4U124AeF6EO_qiQ' 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiOTEyODc0N2ItNGE4NC00MWRjLTg0ZGUtZTY1ODNkMzBiNDcwIn0.w_JRlifng-sUQqvGnuRFH5-wiL-1tfwI1cF7E97gjaOZ37bvRQld3120Myf9MYqLtVHUVX_vhlcBj7Kmg9exZw'
}else{ }else{
axios.defaults.baseURL = 'https://gqyjpt.weihai.cn/prod-api' axios.defaults.baseURL = 'https://gqyjpt.weihai.cn/prod-api'
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<div class="form-input-wrap"> <div class="form-input-wrap">
<input <input
type="text" type="text"
v-model="formData.owner" v-model="formData.merchantName"
class="form-input" class="form-input"
:disabled="flag=='XQ'" :disabled="flag=='XQ'"
/> />
...@@ -230,16 +230,15 @@ ...@@ -230,16 +230,15 @@
<div style="position: relative;" v-for="(imgItem, index) in formData.floorPlanPhotos"> <div style="position: relative;" v-for="(imgItem, index) in formData.floorPlanPhotos">
<img <img
:src="previewUrl + imgItem" :src="previewUrl + imgItem"
alt="平面图"
style="width: 1.6rem; height: 1.6rem;" style="width: 1.6rem; height: 1.6rem;"
@click="showImage(formData.floorPlanPhotos, index)" @click="showImage(formData.floorPlanPhotos, index)"
/> />
<div class="van-uploader__preview-delete" @click="handleDeleteFloorPlan(index)"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon"><!----></i></div> <div v-if="flag=='XG'" class="van-uploader__preview-delete" @click="handleDeleteFloorPlan(index, 'floorPlan')"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon"></i></div>
</div> </div>
<div v-if="formData.floorPlanPhotos.length<4"> <div v-if="formData.floorPlanPhotos.length<4 && flag=='XG' ">
<van-uploader <van-uploader
:before-read="beforeRead" :before-read="beforeRead"
:after-read="afterRead" :after-read="(file) => afterRead(file, 'floorPlan')"
class="uploader-wrapper" class="uploader-wrapper"
:deletable="false" :deletable="false"
:preview-image="false" :preview-image="false"
...@@ -257,7 +256,31 @@ ...@@ -257,7 +256,31 @@
<span class="form-label">营业执照</span> <span class="form-label">营业执照</span>
<span></span> <span></span>
</h5> </h5>
<div v-if="flag=='XG'"> <!-- 详情模式 -->
<div class="img-wrapper" style="display: flex;gap:.16rem;">
<div style="position: relative;" v-for="(imgItem, index) in formData.businessLicensePhotos">
<img
:src="previewUrl + imgItem"
style="width: 1.6rem; height: 1.6rem;"
@click="showImage(formData.businessLicensePhotos, index)"
/>
<div v-if="flag=='XG'" class="van-uploader__preview-delete" @click="handleDeleteFloorPlan(index, 'license')"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon"></i></div>
</div>
<div v-if="formData.businessLicensePhotos.length<1 && flag=='XG' ">
<van-uploader
:before-read="beforeRead"
:after-read="(file) => afterRead(file, 'license')"
class="uploader-wrapper"
:deletable="false"
:preview-image="false"
>
<img src="../image/code/upload.png" style="width:1.6rem;height: 1.6rem;" alt="" srcset="">
</van-uploader>
</div>
</div>
<!-- <div v-if="flag=='XG'">
<van-uploader <van-uploader
v-model="formData.businessLicensePhotosH5" v-model="formData.businessLicensePhotosH5"
:max-count="1" :max-count="1"
...@@ -274,14 +297,36 @@ ...@@ -274,14 +297,36 @@
@click="showImage(formData.businessLicensePhotos,subIndex)" @click="showImage(formData.businessLicensePhotos,subIndex)"
/> />
</div> </div>
</div> </div> -->
<div> <div>
<h5 class="imager-item-title"> <h5 class="imager-item-title">
<span class="form-label">门头图</span> <span class="form-label">门头图</span>
<span></span> <span></span>
</h5> </h5>
<div v-if="flag=='XG'"> <!-- 详情模式 -->
<div class="img-wrapper" style="display: flex;gap:.16rem;">
<div style="position: relative;" v-for="(imgItem, index) in formData.storefrontPhotos">
<img
:src="previewUrl + imgItem"
style="width: 1.6rem; height: 1.6rem;"
@click="showImage(formData.storefrontPhotos, index)"
/>
<div v-if="flag=='XG'" class="van-uploader__preview-delete" @click="handleDeleteFloorPlan(index, 'storeFront')"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon"></i></div>
</div>
<div v-if="formData.storefrontPhotos.length<1 && flag=='XG' ">
<van-uploader
:before-read="beforeRead"
:after-read="(file) => afterRead(file, 'storeFront')"
class="uploader-wrapper"
:deletable="false"
:preview-image="false"
>
<img src="../image/code/upload.png" style="width:1.6rem;height: 1.6rem;" alt="" srcset="">
</van-uploader>
</div>
</div>
<!-- <div v-if="flag=='XG'">
<van-uploader <van-uploader
v-model="formData.storefrontPhotosH5" v-model="formData.storefrontPhotosH5"
:max-count="1" :max-count="1"
...@@ -297,7 +342,7 @@ ...@@ -297,7 +342,7 @@
style="width: 1.2rem; height: 1.2rem; margin-right: 0.2rem" style="width: 1.2rem; height: 1.2rem; margin-right: 0.2rem"
@click="showImage(formData.storefrontPhotos,subIndex)" @click="showImage(formData.storefrontPhotos,subIndex)"
/> />
</div> </div> -->
</div> </div>
<button <button
......
...@@ -64,7 +64,7 @@ window.addEventListener('load', function () { ...@@ -64,7 +64,7 @@ window.addEventListener('load', function () {
mounted() { mounted() {
// 详情编辑权限控制 // 详情编辑权限控制
const userType = gemhoUtil.getCookie('userType') const userType = gemhoUtil.getCookie('userType')
if (userType !== 'wgy') { if (userType == 'wgy') {
this.flag = 'XG' this.flag = 'XG'
} else { } else {
this.flag = 'XQ' this.flag = 'XQ'
...@@ -104,8 +104,14 @@ window.addEventListener('load', function () { ...@@ -104,8 +104,14 @@ window.addEventListener('load', function () {
}); });
}, },
// 处理平面图删除 // 处理平面图删除
handleDeleteFloorPlan(index) { handleDeleteFloorPlan(index, type) {
this.formData.floorPlanPhotos.splice(index, 1); if(type === 'floorPlan'){
this.formData.floorPlanPhotos.splice(index, 1);
}else if(type === 'license'){
this.formData.businessLicensePhotos.splice(index, 1);
}else if(type === 'storeFront'){
this.formData.storefrontPhotos.splice(index, 1);
}
}, },
beforeRead(file) { beforeRead(file) {
if(!['image/png','image/jpeg','image/jpg'].includes(file.type)){ if(!['image/png','image/jpeg','image/jpg'].includes(file.type)){
...@@ -124,7 +130,8 @@ window.addEventListener('load', function () { ...@@ -124,7 +130,8 @@ window.addEventListener('load', function () {
} }
return true; return true;
}, },
afterRead(file) { // 调用爱山东中台系统,将数据流传递过去 afterRead(file, type) { // 调用爱山东中台系统,将数据流传递过去
alert(type)
vant.Toast.loading({ vant.Toast.loading({
message: '正在处理...', message: '正在处理...',
forbidClick: true, forbidClick: true,
...@@ -152,7 +159,13 @@ window.addEventListener('load', function () { ...@@ -152,7 +159,13 @@ window.addEventListener('load', function () {
.then(value => { .then(value => {
console.log(value, 'value图片上********'); // 处理后端返回的数据 console.log(value, 'value图片上********'); // 处理后端返回的数据
if(value){ // 返回信息不为空,则进行解密操作 if(value){ // 返回信息不为空,则进行解密操作
this.formData.floorPlanPhotos.push(value.fileName) if(type === 'floorPlan'){
this.formData.floorPlanPhotos.push(value.fileName)
}else if(type === 'license'){
this.formData.businessLicensePhotos.push(value.fileName)
}else if(type === 'storeFront'){
this.formData.storefrontPhotos.push(value.fileName)
}
// 可根据后端返回的数据做进一步处理,如显示上传成功信息等 // 可根据后端返回的数据做进一步处理,如显示上传成功信息等
setTimeout(() => { setTimeout(() => {
vant.Toast.clear() vant.Toast.clear()
...@@ -463,10 +476,10 @@ window.addEventListener('load', function () { ...@@ -463,10 +476,10 @@ window.addEventListener('load', function () {
}) })
return return
} }
// 删除对应参数
delete reqParam['floorPlanPhotosH5'] reqParam.floorPlanPhotos = this.formData.floorPlanPhotos.join(',')
delete reqParam['businessLicensePhotosH5'] reqParam.businessLicensePhotos = this.formData.businessLicensePhotos.join(',')
delete reqParam['storefrontPhotosH5'] reqParam.storefrontPhotos = this.formData.storefrontPhotos.join(',')
http3.put('/gq/merchant', reqParam).then((res) => { http3.put('/gq/merchant', reqParam).then((res) => {
console.log('添加结果', res) console.log('添加结果', res)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment