Commit 3d1ad0e6 authored by xinzhedeai's avatar xinzhedeai

add:商户详情门头图片爱山东sdk拍照上传功能修改

parent dde796b1
......@@ -203,7 +203,7 @@
<span></span>
</h5>
<!-- 详情模式 -->
<div class="img-wrapper" style="display: flex;gap:.16rem;">
<!-- <div class="img-wrapper" style="display: flex;gap:.16rem;">
<div style="position: relative;" v-for="(imgItem, index) in formData.floorPlanPhotos">
<img :src="previewUrl + imgItem" style="width: 1.6rem; height: 1.6rem;"
@click="showImage(formData.floorPlanPhotos, index)" />
......@@ -217,7 +217,21 @@
<img src="../image/code/upload.png" style="width:1.6rem;height: 1.6rem;" alt="" srcset="">
</van-uploader>
</div>
</div>
</div> -->
<div class="img-wrapper">
<div style="position: relative;width:1.6rem;float: left;margin-right: .1rem;" v-for="(imgItem, index) in formData.floorPlanPhotos">
<img :src="previewUrl + imgItem" style="width: 1.6rem; height: 1.6rem;"
@click="showImage(formData.floorPlanPhotos, index)" />
<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 v-if="formData.floorPlanPhotos.length<6 && flag=='XG' ">
<img src="../image/code/upload.png" style="width:1.6rem;height: 1.6rem;"
alt="" srcset="" @click="paizhao('floorPlan',4)">
</div>
</div>
</div>
<div>
<h5 class="imager-item-title">
......
......@@ -49,6 +49,11 @@ window.addEventListener('load', function () {
businessHours: '',
type: '', // 新增类型字段
photos: [], // 新增图片数组字段
floorPlanPhotos:[],
businessLicensePhotos:[],
storefrontPhotos:[],
floorEvacuationPlan:[],
},
dict4changhsuoType: [],
dict4fangwuType: [],
......@@ -106,6 +111,88 @@ window.addEventListener('load', function () {
}
},
methods: {
paizhao(photosType, maxSelectNum) {
VUE.photosType = photosType
var data = ["相册", "相机"];
lightAppJssdk.notification.showMediaAlert({
arg0: data,
success: function (data) {
console.log('选择菜单的数据', data, photosType, maxSelectNum)
// formData.append('file', file.file); // 通过FormData构建要上传的文件数据
// alert(data);
var pam1 = {
"url": BASE_URL + '/common/uploads',
// url:'sdfsdfsd',
"fileKey": "files",
// "fileKey": "files",
"params": {
},
"header": {
'Authorization': gemhoUtil.getCookie('token'),
},
"chooseType": "chooseFileUpload",
"transmissionType": 0, //1-base64 0-图片地址"maxSize": 10, "maxSelectNum": 9,
"maxSize": 10,
"maxSelectNum": maxSelectNum,
}
if (data.index == 0) {
pam1.chooseType = "chooseImageUpload" // pam1.fileKey = "file"
} else if (data.index == 1) {
pam1.chooseType = "takingPicturesUpload" // pam1.fileKey = "picfile"
}
console.log('请求接口i偶路径', pam1)
chooseFileUploadTest(pam1)
// setTimeout('onHidePreloaders()', 2000);
},
fail: function (data) {
console.log(data);
}
});
function chooseFileUploadTest(pam) {
lightAppJssdk.uploadFile.chooseFileUpload({
arg0: pam,
success: function (value) {
console.log('chooseFileUpload方法', value)
var photosVar = []
// 根据选择的图片不同进行区分设置
if(VUE.photosType === 'floorPlan'){
photosVar = VUE.formData.floorPlanPhotos
}else if(VUE.photosType === 'license'){
photosVar = VUE.formData.businessLicensePhotos
}else if(VUE.photosType === 'storeFront'){
photosVar = VUE.formData.storefrontPhotos
}else if(VUE.photosType === 'floorEvacuationPlan'){
photosVar = VUE.formData.floorEvacuationPlan
}
if(!photosVar){ // 如果为空字符串则手动重置为[]
photosVar = []
}
console.log('photsVar方法', JSON.stringify(photosVar))
if (value) {
// VUE.formData.attachmentFile.push(...JSON.parse(value).fileNames)
if(gemhoUtil.isIOSStrict()){ // ios直接返回对象
photosVar.push(...value.fileNames)
}else{ // 俺安卓机 返回字符串
photosVar.push(...JSON.parse(value).fileNames)
}
if (photosVar.length > maxSelectNum) {
const result = photosVar.slice(0, maxSelectNum)
photosVar = result
}
}
},
fail: function (data1) {
console.log(data1);
}
});
};
},
// 添加脱敏处理函数
desensitize(value, type) {
if (!value) return '';
......@@ -155,7 +242,7 @@ window.addEventListener('load', function () {
}else if(type === 'storeFront'){
this.formData.storefrontPhotos.splice(index, 1);
}else if(type === 'floorEvacuationPlan'){
this.formData.storefrontPhotos.splice(index, 1);
this.formData.floorEvacuationPlan.splice(index, 1);
}
},
beforeRead(file) {
......@@ -671,15 +758,23 @@ window.addEventListener('load', function () {
let tempData = result.data
if(tempData['businessLicensePhotos']){
tempData['businessLicensePhotos'] = tempData['businessLicensePhotos'].split(',')
}else{
tempData['businessLicensePhotos'] = []
}
if(tempData['floorPlanPhotos']){
tempData['floorPlanPhotos'] = tempData['floorPlanPhotos'].split(',')
}else{
tempData['floorPlanPhotos'] = []
}
if(tempData['storefrontPhotos']){
tempData['storefrontPhotos'] = tempData['storefrontPhotos'].split(',')
}else{
tempData['storefrontPhotos'] = []
}
if(tempData['floorEvacuationPlan']){
tempData['floorEvacuationPlan'] = tempData['floorEvacuationPlan'].split(',')
}else{
tempData['floorEvacuationPlan'] = []
}
this.formData = tempData
......
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