vue axios上传身份证信息文件

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);
    },

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值