upLoad1(file, detail) {
//扫描身份证正面信息
let _this = this;
common.uploadImg(
file,
_this[detail.name],
_this[detail.name + "s"],
_this
);
_this.bg1 = _this.upLoad_zheng;
if (_this.upLoad_zheng != []) {
_this.bg1 = _this.upLoad_zheng;
}
const ff = JSON.parse(JSON.stringify(this.upLoad_zheng));
// console.log("ffff", ff[0]);
let formData = new FormData();
formData.append("file", ff[0].content);
formData.append("card_type", 0); //通过append向form对象添加数据
// console.log(formData.get("file")); //FormData私有类对象,访问不到,可以通过get判断值是否传进去
setTimeout(() => {
_this
.$ajax()
.post("/thirdapi/Applywxejing/checkIdcard", formData,{
})
.then((res) => {
if (res.status == 200) {
_this.user_idcard_photo = res.data.data.dir; //身份证正面照
_this.user_name = res.data.data.idcard.name; 姓名
_this.user_nation = res.data.data.idcard.nation; 民族
_this.user_idcard_no = res.data.data.idcard.id; //身份证号
_this.user_sex = res.data.data.idcard.sex; //性别
_this.user_birthday = res.data.data.idcard.birth; //生日
_this.user_idcard_address = res.data.data.idcard.address; //身份证地址
} else {
_this.Toast(res.info);
}
});
}, 500);
},
vue axios上传身份证信息文件
于 2022-08-02 14:38:34 首次发布