Browse Source

人脸页面

wmaple 1 year ago
parent
commit
998e0589a0
4 changed files with 113 additions and 1 deletions
  1. 12 0
      pages.json
  2. 61 0
      pages/fac.vue
  3. 1 1
      pages/login.vue
  4. 39 0
      pages/redirect_fac.vue

+ 12 - 0
pages.json

@@ -3,6 +3,18 @@
     "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
   },
   "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+    {
+      "path": "pages/fac",
+      "style": {
+        "navigationBarTitleText": "人脸"
+      }
+    },
+    {
+      "path": "pages/redirect_fac",
+      "style": {
+        "navigationBarTitleText": "人脸"
+      }
+    },
     {
       "path": "pages/login",
       "style": {

+ 61 - 0
pages/fac.vue

@@ -0,0 +1,61 @@
+<template>
+  <view class="container">
+    <view class="box">
+      <u-form :model="form" ref="uForm">
+        <u-form-item label="姓名"><u-input v-model="form.realName" /></u-form-item>
+        <u-form-item label="身份证号"><u-input v-model="form.idCard" /></u-form-item>
+      </u-form>
+      <button @click="toFac()">人脸识别</button>
+    </view>
+  </view>
+</template>
+
+<script>
+  import uniWeb from '../static/uni.webview.1.5.4.js'
+  export default {
+    data() {
+      return {
+        form: {
+          realName: '',
+          idCard: '',
+        }
+      }
+    },
+    methods: {
+      toFac() {
+        if (!this.form.realName) {
+          uni.$u.toast('请先输入真实姓名');
+        }
+        if (!this.form.idCard) {
+          uni.$u.toast('请先输入身份证号');
+        }
+        this.$http.post('/auth/build_fac', this.form).then(res => {
+          try {
+            uniWeb.webView.postMessage({
+              data: res.data
+            })
+          } catch (err) {
+            console.log('err==>', err)
+          }
+        })
+      }
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  .container {
+    width: 100vw;
+    height: 100vh;
+    overflow: hidden;
+    // background: url('../static/img/loginBg.png');
+    background-size: contain;
+    position: relative;
+
+    .box {
+      padding: 30rpx;
+      padding-top: 200rpx;
+      word-break: break-all;
+    }
+  }
+</style>

+ 1 - 1
pages/login.vue

@@ -49,7 +49,7 @@
 			if (this.yigeauth) {
 				// 需要授权
 				this.getYigeauth()
-			} else(options.yigeopenid) {
+			} else if (options.yigeopenid) {
 				// 如果已经授权,并且返回了 openid,则通过 openid 去获取用户信息
 				this.getUerByOpenId(options.yigeopenid)
 			}

+ 39 - 0
pages/redirect_fac.vue

@@ -0,0 +1,39 @@
+<template>
+  <view class="container">
+    <view class="box">
+      人脸校验成功
+    </view>
+  </view>
+</template>
+
+<script>
+  export default {
+    data() {
+      return {
+        userInfo: null
+      }
+    },
+    onLoad(options) {
+      console.log(options, 'redirect')
+    },
+    methods: {
+
+    }
+  }
+</script>
+
+<style lang="scss">
+  .container {
+    width: 100vw;
+    height: 100vh;
+    overflow: hidden;
+    background-size: contain;
+    position: relative;
+
+    .box {
+      padding: 30rpx;
+      padding-top: 200rpx;
+      word-break: break-all;
+    }
+  }
+</style>