story#7189,认证页radio回显处理

This commit is contained in:
2025-09-10 09:20:41 +08:00
parent 620e6b5ad4
commit fda0139a06
2 changed files with 29 additions and 91 deletions

View File

@ -16,8 +16,8 @@
<div class="natureWrap"> <div class="natureWrap">
<span class="title"><span class="star">*</span>业务性质</span> <span class="title"><span class="star">*</span>业务性质</span>
<van-radio-group @change="radioChange" v-model="form.businessNature" class="flexWrap"> <van-radio-group @change="radioChange" v-model="form.businessNature" class="flexWrap">
<van-radio name="1">全国跑圈业务</van-radio> <van-radio :name="1">全国跑圈业务</van-radio>
<van-radio name="2">固定区域救援业务</van-radio> <van-radio :name="2">固定区域救援业务</van-radio>
</van-radio-group> </van-radio-group>
</div> </div>
<div class="natureWrap regionWrap" v-if="form.businessNature == 2" > <div class="natureWrap regionWrap" v-if="form.businessNature == 2" >
@ -225,6 +225,7 @@
verifyType: 3 verifyType: 3
}) })
leftCopy(this.form, {...res?.data?.vehicleInfoData}) leftCopy(this.form, {...res?.data?.vehicleInfoData})
console.log("this.form",this.form)
this.form.carrierLiabilityInsurancePhoto=this.form.carrierLiabilityInsurancePhoto ? res?.data?.vehicleInfoData?.carrierLiabilityInsurancePhoto?.split(',') : [] this.form.carrierLiabilityInsurancePhoto=this.form.carrierLiabilityInsurancePhoto ? res?.data?.vehicleInfoData?.carrierLiabilityInsurancePhoto?.split(',') : []
if(this.form.businessNature==2){ if(this.form.businessNature==2){
this.region=res?.data?.vehicleInfoData?.region this.region=res?.data?.vehicleInfoData?.region
@ -297,11 +298,11 @@
}, 100) }, 100)
}, },
carrierHandler(data) { // 承运人责任险照片 carrierHandler(data) { // 承运人责任险照片
console.log("data",data)
this.form.carrierLiabilityInsurancePhoto = data this.form.carrierLiabilityInsurancePhoto = data
}, },
insureHandle(val){ insureHandle(val){
this.form.hasInsurancePhoto=val this.form.hasInsurancePhoto=val
console.log(' this.form.hasInsurancePhoto', this.form.hasInsurancePhoto)
}, },
vehicleFrontInit() { vehicleFrontInit() {
this.form.licensePlateNumber = '' this.form.licensePlateNumber = ''

View File

@ -4,12 +4,12 @@
<div class="photo_title custom-title"> <div class="photo_title custom-title">
<span><span class="star">*</span>{{title}}</span> <span><span class="star">*</span>{{title}}</span>
<van-radio-group @change="radioChange" v-model="form.isInsure" class="flexWrap"> <van-radio-group @change="radioChange" v-model="form.isInsure" class="flexWrap">
<van-radio name="0"></van-radio> <van-radio :name="0"></van-radio>
<van-radio name="1"></van-radio> <van-radio :name="1"></van-radio>
</van-radio-group> </van-radio-group>
</div> </div>
<div class="photoWrap" v-if="form.isInsure == 1"> <div class="photoWrap" v-if="inSure == 1">
<van-uploader :after-read="(file) => afterRead(file,'urlList')" class="customUploadMul" max-count="3" :disabled="!showFun()"> <van-uploader :after-read="(file) => afterRead(file,'urlList')" class="customUploadMul" :max-count="3" :disabled="!showFun()">
<template v-if="urlList.length > 0"> <template v-if="urlList.length > 0">
<div v-for="(item, index) in urlList" :key="'uploaded-' + index" class="uploaded-item"> <div v-for="(item, index) in urlList" :key="'uploaded-' + index" class="uploaded-item">
<img class="photo_item" mode="widthFix" :src="item.replace(/http:\/\//g, 'https://')" /> <img class="photo_item" mode="widthFix" :src="item.replace(/http:\/\//g, 'https://')" />
@ -56,13 +56,12 @@
<script> <script>
import {uploadImage} from "@/api/mine"; import {uploadImage} from "@/api/mine";
/*let baseUrl=''
let baseUrl=''
if (window.location.href.includes('www.sinoassist.com')) { if (window.location.href.includes('www.sinoassist.com')) {
baseUrl = 'https://www.sinoassist.com' baseUrl = 'https://www.sinoassist.com'
} else { } else {
baseUrl = 'https://crm1.sino-assist.com' baseUrl = 'https://crm1.sino-assist.com'
} }*/
export default { export default {
name: "photoItem", name: "photoItem",
props: { props: {
@ -81,9 +80,10 @@ export default {
}, },
urlList: { urlList: {
type: Array, type: Array,
default: ()=>[]
}, },
inSure:{ inSure:{
type:String || Number, type:Number,
} }
}, },
data() { data() {
@ -92,26 +92,36 @@ export default {
leftImg: '', leftImg: '',
rightImg: '', rightImg: '',
urlList:[], urlList:[],
isInsure:1, isInsure:'',
}, },
options:[{value:0,name:'否'},{value:1,name:'是'}], options:[{value:0,name:'否'},{value:1,name:'是'}],
localUrlList: [...this.urlList] // 使用本地副本操作
} }
}, },
activated() { watch:{
console.log("inSure",this.inSure) // 监听父组件传入的urlList变化
urlList(newVal) {
this.localUrlList = [...newVal];
},
// 监听inSure变化
inSure(newVal) {
this.form.isInsure = newVal;
}
}, },
mounted() { mounted() {
setTimeout(()=>{
this.form.isInsure=this.inSure
},1500)
}, },
methods: { methods: {
async afterRead(file,type,index){ async afterRead(file,type,index){ // 支持多文件上传
const formData = new FormData(); const formData = new FormData();
formData.append("file" , file.file); formData.append("file" , file.file);
let res = await uploadImage(formData) let res = await uploadImage(formData)
if (type=='urlList' && (index==0 || index)){ if (type=='urlList' && (index==0 || index)){
this.$set( this.form.urlList,index,res.data) this.$set( this.form.urlList,index,res.data)
}else if(type=='urlList'){ }else if(type=='urlList'){
this.form[type].push(res.data) this.form[type].push(...this.urlList,res.data)
}else{ }else{
this.form[type] = res.data this.form[type] = res.data
} }
@ -130,79 +140,6 @@ export default {
} }
return true return true
}, },
async chooseHandler(type,i) {
console.log("type,i",type,i,baseUrl)
return
// #ifdef MP-WEIXIN
// await this.weChatImage(type,i)
// #endif
// #ifndef MP-WEIXIN
// await this.commonImage(type,i)
// #endif
},
/* commonImage(type,index) {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
uni.uploadFile({
url: baseUrl + '/order/uploadImage', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'file',
success: async (uploadFileRes) => {
if (type=='urlList' && (index==0 || index)){
this.$set( this.form.urlList,index,JSON.parse(uploadFileRes.data).data)
} else if(type=='urlList'){
this.form[type].push(JSON.parse(uploadFileRes.data).data)
}else {
this.form[type] = JSON.parse(uploadFileRes.data).data
}
this.$emit(type, this.form[type])
},
fail: () => {
this.$toast('上传失败')
}
});
},
fail: (res) => {
console.log('选择照片出错', res)
// this.$toast('选择照片出错,请重试')
}
})
},
weChatImage(type,index) {
uni.chooseMedia({
sourceType: ['album', 'camera'],
mediaType: ['image'],
count: 1,
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFiles[0].tempFilePath;
uni.uploadFile({
url: baseUrl + '/order/uploadImage', //仅为示例,非真实的接口地址
filePath: tempFilePaths,
name: 'file',
success: async (uploadFileRes) => {
if (type=='urlList' && (index==0 || index)){
this.$set( this.form.urlList,index,JSON.parse(uploadFileRes.data).data)
}else if(type=='urlList'){
this.form[type].push(JSON.parse(uploadFileRes.data).data)
}else{
this.form[type] = JSON.parse(uploadFileRes.data).data
}
this.$emit(type, this.form[type])
},
fail: () => {
this.$toast('上传失败')
}
});
},
fail: (res) => {
console.log('选择照片出错', res)
// this.$toast('选择照片出错,请重试')
}
})
}
*/
} }
} }
</script> </script>