123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- // pages/temporary_prove/index.js
- // index.js
- var verify = require('../../../utils/util/util')
- const face = require('../../../utils/faceCheck/faceCheck')
- const {
- pro_baseUrl_wxrlxf
- } = require('../../../utils/func/request');
- const getPhone = require('../../../utils/getPhone/wx_getPhone');
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- // 胶囊位置信息
- StatusBar: app.globalData.StatusBar,
- CustomBar: app.globalData.CustomBar,
- Custom: app.globalData.Custom,
- // 基础路径
- baseUrl: pro_baseUrl_wxrlxf,
- inputName: '',
- inputIdcard: '',
- phone: '',
- workPlace: '',
- carNumber: '',
- warnName: 1, //姓名校验信息
- warnIdcard: 1, //身份证校验信息
- disableSubmit: true,
- iscarNumber: false, //车牌键盘弹起
- },
- //获得姓名
- getInputName(e) {
- this.setData({
- warnName: 1,
- inputName: e.detail.value
- });
- if (!e.detail.value) {
- this.setData({
- warnName: '您输入的姓名不可以为空!'
- })
- } else {
- this.setData({
- warnName: 2
- })
- }
- },
- //获得身份证号
- getInputIdcard(e) {
- var result = verify.isCardID(e.detail.value);
- if (!result.state) {
- this.setData({
- warnIdcard: result.data
- })
- } else {
- this.setData({
- warnIdcard: 2,
- inputIdcard: e.detail.value
- })
- }
- },
- //获得手机号
- getPhoneNumber(e) {
- console.log(e);
- var result = verify.isCornet(e.detail.value);
- if (!result.state) {
- this.setData({
- warnPhone: result.data
- })
- } else {
- this.setData({
- warnPhone: null,
- phone: e.detail.value
- })
- }
- },
- //获取手机号
- // async getPhoneNumber(e) {
- // wx.showLoading({
- // title: '获取中...',
- // mask: true
- // });
- // var result = await getPhone(e);
- // wx.hideLoading()
- // this.setData({
- // phone: result
- // })
- // },
- // 单位
- getValue(e) {
- let type = e.currentTarget.dataset.type
- this.setData({
- [type]: type === 'workPlace' ? e.detail.value : e.detail
- })
- },
- // 车牌键盘弹起
- getCarNumber() {
- this.setData({
- iscarNumber: true
- })
- },
- //实名认证
- submit() {
- let {
- inputName,
- inputIdcard,
- phone,
- workPlace,
- carNumber
- } = this.data
- app.data.workPlace = workPlace
- app.data.carNumber = carNumber
- face.intoFace_wxrlxf_FKJ(inputName, inputIdcard, phone).then((suc) => {
- this.data.flag = 1
- }, (err) => {
- console.log(err)
- })
- },
- //验证人脸
- async doFaceCheck() {
- let taskId = wx.getStorageSync('wx_dateCode_FKJ');
- // taskId = '355411594437459968'
- if (!taskId) return;
- var res = await face.getFace_wxrlxf('/api/next/getVisitorUserInfo', 'get', {
- taskId,
- });
- //todo--人脸结果
- if (res.code === 200) {
- wx.setStorageSync('machineInfo_FKJ', res.data)
- wx.redirectTo({
- url: '/pages/temporary_prove_FKJ/rlxf_pass/rlxf_pass',
- })
- } else {
- wx.showModal({
- title: '提示',
- content: '认证失败请重新认证!',
- showCancel: false,
- })
- }
- },
- //查看照片
- watch() {
- wx.previewImage({
- urls: [this.data.baseUrl + '/file/img/instruction.png'],
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: async function (options) {
- var url = decodeURIComponent(options.q);
- var json = verify.GetQueryJson(url);
- // json = {
- // type: 2,
- // }
- if (json && json.type == 2) {
- // 判断缓存
- var machineInfo_FKJ = wx.getStorageSync('machineInfo_FKJ');
- if (machineInfo_FKJ) {
- wx.redirectTo({
- url: '/pages/temporary_prove_FKJ/rlxf_pass/rlxf_pass',
- })
- }
- } else {
- wx.showModal({
- title: '提示',
- content: '未检测到设备码,请扫正确的二维码进入小程序哦~',
- showCancel: false
- });
- this.setData({
- disableSubmit: false
- })
- return
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- if (this.data.flag === 1) {
- this.doFaceCheck();
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|