Ver código fonte

Merge branch 'dev-majunjie' into dev

ccf 4 anos atrás
pai
commit
960126822c
2 arquivos alterados com 81 adições e 7 exclusões
  1. 1 1
      pages/frontend/name_cert/index.vue
  2. 80 6
      pages/wo/cash.vue

+ 1 - 1
pages/frontend/name_cert/index.vue

@@ -307,7 +307,7 @@ export default {
                 cert_type,
                 z_file:this.z_file,
                 f_file:this.f_file,
-                is_face_check:0,
+                is_face_check:this.$route.query.is_face_check == 1 ? 1 : 0,
                 from_type: 1
             });
            this.loading=false;

+ 80 - 6
pages/wo/cash.vue

@@ -56,7 +56,7 @@
     </el-dialog>
     <SuccessToast :isShowToast="isShowToastSuccess" @close="isShowToastSuccess=false"/>
 
-    <el-dialog title="温馨提示" :visible.sync="centerDialogVisible" width="350px" center>
+    <el-dialog @close="qrcodeClose" title="温馨提示" :visible.sync="centerDialogVisible" width="350px" center>
         <p class="qrcode-tips">请打开支付宝扫码以下二维码</p>
         <div class="qrcode-img">
             <img :src="qrcodeBase64" />
@@ -93,7 +93,9 @@ export default {
       isIdCard: false, //是否是提现到银行卡
       isShowToastSuccess: false, //是否展示成功后的提示
       qrcodeBase64: "",
-      centerDialogVisible:false
+      centerDialogVisible:false,
+
+      timer:null,
     };
   },
   computed: {
@@ -196,12 +198,40 @@ export default {
       }
 
       // 判断是否已过人脸
-      let isFace = await this.checkIsFace()
+      let resutCheckUserCertInfo = await this.$axios.$post("/uapi/user/realName/check");
+
+
+      if(resutCheckUserCertInfo.status != 1){
+        this.$message.error(resutCheckUserCertInfo.info)
+        return
+      }
+
+      let isFace = resutCheckUserCertInfo.data.is_face === 1
+      let isNameCert = resutCheckUserCertInfo.data.type === 1
+
+      if(!isNameCert){
+        // 如果没有实名,跳到实名认证页,并需要过人脸
+        location.href = '/frontend/name_cert?is_face_check=1'
+        return
+      }
 
       if(!isFace) {
-        this.$message.info("为了您的资金安全,本次操作需要进行人脸认证。")
+
+        // 询问是否是否人脸认证
+        let res = await this.isFaceComfirmByAsync()
+        
+        if(!res){
+          return
+        }
+        // 请求二维码
         await this.callFaceQrcode()
-        return
+        // 启动定时器
+        let resutByTimer = await this.startCheckIsFaceTimer()
+
+        if(resutByTimer){
+          // 关闭二维码框
+          this.centerDialogVisible = false
+        }
       }
 
       this.dialogShow = true;
@@ -210,6 +240,24 @@ export default {
         type: 3
       });
     },
+
+    // 提示框async 包装
+    async isFaceComfirmByAsync(){
+      let that = this;
+      return new Promise(function(resolve) {
+        that.$confirm('为了您的资金安全,本次操作需要进行人脸认证。', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+        .then(() => {
+          resolve(true)
+        })
+        .catch(() => {
+          resolve(false)
+        })
+      })
+    },
     /**
      * 检查是否完成人脸认证
      */
@@ -226,6 +274,30 @@ export default {
         return false
       }
     },
+    /**
+     * 关闭二维码回调
+     */
+    qrcodeClose(){
+      clearInterval(this.timer)
+      this.timer = null
+    },
+    /**
+     * 检查是否过人脸定时器
+     */
+    startCheckIsFaceTimer(){
+      let that = this
+      return new Promise(function(resolve){
+        that.timer = setInterval(async () => {
+          let isFace = await that.checkIsFace()
+          // console.log("请求验证")
+          if(isFace){
+            clearInterval(that.timer)
+            that.timer = null
+            resolve(true)
+          }
+        },3000)
+      })
+    },
   /**
      * 获取人脸二维码
      */
@@ -233,8 +305,10 @@ export default {
       try{
 
          let res = await this.$axios.$post("/uapi/user/realName/face");
-
         let qrcode = res.data.kezhan_url;
+
+
+        // let qrcode = "http://baidu.com"
         let that = this;
         QRCode.toDataURL(
             qrcode, {