task#,身份证上传添加验证
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
|
||||
max-count="1"
|
||||
:preview-size="54"
|
||||
accept="image "
|
||||
accept="image/*"
|
||||
/>
|
||||
<!-- :max-size="5 * 1024 * 1024"-->
|
||||
</div>
|
||||
@ -173,6 +173,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.requestPermissions();
|
||||
this.id = this.$route.params?.id;
|
||||
this.driverName = this.$route.params?.name;
|
||||
this.driverPhone = this.$route.params?.phone;
|
||||
@ -213,11 +214,23 @@ export default {
|
||||
|
||||
},
|
||||
methods:{
|
||||
requestPermissions() {
|
||||
// 请求访问摄像头的权限
|
||||
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
||||
navigator.mediaDevices.getUserMedia({ video: true })
|
||||
.then(() => {
|
||||
console.log('Camera permission granted');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Camera permission denied:', error);
|
||||
});
|
||||
}
|
||||
},
|
||||
isUse(e){
|
||||
this.states=e
|
||||
},
|
||||
async identityCardFrontHandler(file) { // 上传身份证正面照片
|
||||
console.log("file",file)
|
||||
console.log("上传身份证正面照片",file)
|
||||
// 检查文件大小
|
||||
if (file.file.size > 5 * 1024 * 1024) {
|
||||
this.$toast('文件大小不能超过 5MB');
|
||||
|
Reference in New Issue
Block a user