Commit ac977ba8 by zhangxw

个人认证上传图片bug修复

1 parent c5c2fbb8
......@@ -87,23 +87,22 @@
<view class="section-desc">请上传本人的身份证照片,证件信息仅用于身份认证</view>
<view class="upload-section">
<view class="upload-item">
<uni-file-picker fileMediatype="image" :image-styles="imageStyles" @select="selectFile($event,'front')" mode="grid" :auto-upload="true"
:limit="1" file-extname="png,jpg,jpeg">
<uni-file-picker fileMediatype="image" :image-styles="imageStyles" @select="selectFile($event,'front')" @delete="deleteFile('front')" mode="grid" :auto-upload="true"
:limit="1" file-extname="png,jpg,jpeg">
<view class="upload-placeholder">
<image v-if="formData.idCardPortrait?.url || account?.idCardPortraitUrl" :src="formData.idCardPortrait?.url || account?.idCardPortraitUrl" mode="aspectFill" style="width: 100%; height: 150px;"></image>
<image v-else src="~@/static/images/account/certifition/idcard_0@2x.png" style="width: 100%; height: 150px;"></image>
<image src="~@/static/images/account/certifition/idcard_0@2x.png" style="width: 100%; height: 150px;"></image>
<text class="upload-text">上传人像面</text>
</view>
</uni-file-picker>
</view>
<view class="upload-item">
<uni-file-picker fileMediatype="image" :image-styles="imageStyles" @select="selectFile($event,'back')" :limit="1" file-extname="png,jpg,jpeg">
<view class="upload-placeholder">
<image v-if="formData.idCardNationalEmblem?.url || account?.idCardNationalEmblemUrl" :src="formData.idCardNationalEmblem?.url || account?.idCardNationalEmblemUrl" mode="aspectFill" style="width: 100%; height: 150px;"></image>
<image v-else src="~@/static/images/account/certifition/idcard_1@2x.png" style="width: 100%; height: 150px;"></image>
<text class="upload-text">上传国徽面</text>
</view>
</uni-file-picker>
<uni-file-picker fileMediatype="image" :image-styles="imageStyles" @select="selectFile($event,'back')" @delete="deleteFile('back')" :limit="1" file-extname="png,jpg,jpeg">
<view class="upload-placeholder">
<image class="add-img" src="~@/static/images/account/certifition/idcard_1@2x.png" style="width: 100%; height: 150px;"></image>
<text class="upload-text">上传国徽面</text>
</view>
</uni-file-picker>
</view>
</view>
</view>
......@@ -193,7 +192,6 @@ export default class CertificationResult extends Vue {
this.loadAgreement();
});
onShow(() => {
this.loadAccount();
});
}
......@@ -295,6 +293,14 @@ export default class CertificationResult extends Vue {
}
}
deleteFile(e) {
if (e == 'front') {
this.formData.idCardPortrait = null
} else {
this.formData.idCardNationalEmblem = null
}
}
uploadFiles(tempFile: any): Promise<FileInfo> {
const authService: AuthService = this.$auth;
const action = 'upload/uploadImage?directory=account/certification';
......@@ -323,15 +329,15 @@ export default class CertificationResult extends Vue {
submitForm() {
if (this.account?.accountType == "COMMON") {
if (!this.formData.idCardPortrait || !this.formData.idCardPortrait.url) {
uni.showToast({title: '请上传身份证人像面', icon: 'none'});
return;
}
if (!this.formData.idCardNationalEmblem || !this.formData.idCardNationalEmblem.url) {
uni.showToast({title: '请上传身份证国徽面', icon: 'none'});
return;
}
this.$refs.form.validate().then(() => {
if (!this.formData.idCardPortrait) {
uni.showToast({title: '请上传身份证人像面', icon: 'none'});
return;
}
if (!this.formData.idCardNationalEmblem) {
uni.showToast({title: '请上传身份证国徽面', icon: 'none'});
return;
}
uni.showLoading({title: '提交中...', mask: true});
AccountController.certifyAccount(this.axios, this.formData).then(() => {
uni.showToast({title: '提交成功', icon: 'success'});
......
......@@ -34,7 +34,7 @@
<view class="upload-section">
<view class="upload-item">
<uni-file-picker fileMediatype="image" :image-styles="imageStyles" @select="selectFile($event,'front')" mode="grid" :auto-upload="true"
<uni-file-picker fileMediatype="image" :image-styles="imageStyles" @select="selectFile($event,'front')" @delete="deleteFile('front')" mode="grid" :auto-upload="true"
:limit="1" file-extname="png,jpg,jpeg">
<view class="upload-placeholder">
<image src="~@/static/images/account/certifition/idcard_0@2x.png" style="width: 100%; height: 150px;"></image>
......@@ -43,7 +43,7 @@
</uni-file-picker>
</view>
<view class="upload-item">
<uni-file-picker fileMediatype="image" :image-styles="imageStyles" @select="selectFile($event,'back')" :limit="1" file-extname="png,jpg,jpeg">
<uni-file-picker fileMediatype="image" :image-styles="imageStyles" @select="selectFile($event,'back')" @delete="deleteFile('back')" :limit="1" file-extname="png,jpg,jpeg">
<view class="upload-placeholder">
<image class="add-img" src="~@/static/images/account/certifition/idcard_1@2x.png" style="width: 100%; height: 150px;"></image>
<text class="upload-text">上传国徽面</text>
......@@ -179,6 +179,14 @@ export default class PersonCertificationPage extends Vue {
}
}
deleteFile(e) {
if (e == 'front') {
this.formData.idCardPortrait = null
} else {
this.formData.idCardNationalEmblem = null
}
}
uploadFiles(tempFile: any): Promise<FileInfo> {
this.onload = true;
const authService: AuthService = this.$auth;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!