123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- import {
- snConfig,
- getVisitDeviceUser
- } from '../../utils/api/api'
- import {
- getQRCodeUrl,
- getForm,
- getWaterDrop,
- throttle,
- } from '../../utils/index/index'
- import {
- receiptPrinting
- } from '../../utils/index/receiptPrinting'
- import { closeSecondaryScreen, openSecondaryScreen } from "../../utils/index/callAmpe";
- const app = getApp()
- Page({
- data: {
- snDisposition: {},
- tabList: [{
- img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/tab-one.png',
- tit: '设置',
- path: '/pages/settings/login/index'
- },
- {
- img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/tab-two.png',
- tit: '通讯录',
- path: '/pages/settings/interviewee/index?formPath="通讯录"'
- },
- {
- img: '../../image/fkjl-icon.png',
- tit: '访客记录',
- path: '/pages/settings/visitorLog/index?formPath="访客记录"'
- },
- ],
- centerList: [{
- img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/center-one.png',
- tit: '刷脸登记',
- path: '/pages/resultPage/index?result=刷脸登记',
- isShow: true,
- id: 1,
- },
- {
- img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/center-two.png',
- tit: '持证登记',
- path: '/pages/resultPage/index?result=刷身份证',
- isShow: true,
- id: 2,
- },
- {
- img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/center-three.png',
- tit: '输身份证登记',
- path: '/pages/inputIDCard/index',
- isShow: true,
- id: 3,
- },
- {
- img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/center-four.png',
- tit: '签离',
- path: '/pages/resultPage/index?result=扫码签离',
- isShow: true,
- id: 4,
- },
- ],
- centerListCope: [],
- qrImgWX: '', // 微信二维码图片地址
- qrImgZFB: '', // 支付宝二维码图片地址
- intervalId: null, //定时器
- intervalId1: null, //定时器
- },
- onLoad() {
- app.data.cycleIntervalSwitch = true
- let url = app.globalData.snDisposition.secondaryPageImages[app.data.secondaryPageImagesIndex] || ''
- if (url) {
- openSecondaryScreen(url)
- }
- this.data.centerListCope = JSON.parse(JSON.stringify(this.data.centerList))
- this.snConfig()
- },
- async onShow() {
- my.hideBackHome();
- app.data.userInfo.xm = ''
- app.data.userInfo.sfzh = ''
- app.data.userInfo.phone = ''
- app.data.userInfo.avatar = ''
- app.data.userInfo.idCardPhoto = ''
- app.data.userInfo.workPlace = ''
- app.data.userInfo.carNumber = ''
- app.data.userInfo.verifyType = 1;
- app.data.userInfo.certContent = '';
- app.globalData.signOffQrcodeUrl = ''
- app.globalData.ethQrcodeUrl = ''
- app.globalData.gateGrcodeUrl = ''
- app.data.inputPhone = ''
- app.globalData.brushingCardUserIInfo = {}
- app.globalData.visitoMsgData = {}
- app.data.isOkBrushingCard = false
- app.data.isOkQrCodeSignIn = false
- app.data.isokFaceScan = false
- app.globalData.riskResult = 1
- app.data.isNetworkQueryError = true
- app.data.clickRetryNum = 0
- },
- clickAudio() {
- getWaterDrop()
- },
- // 获取设备配置
- snConfig() {
- let that = this
- that.assignData()
- if (!app.globalData.snDisposition.id) {
- that.data.intervalId = setInterval(function () {
- if (app.globalData.snDisposition.id) {
- that.assignData()
- clearInterval(that.data.intervalId);
- }
- }, 1000);
- }
- },
- // 赋值
- async assignData() {
- this.data.centerList = JSON.parse(JSON.stringify(this.data.centerListCope))
- let centerList = this.data.centerList
- centerList[0].isShow = app.globalData.snDisposition.useAlipayFace
- centerList[1].isShow = app.globalData.snDisposition.useIdcard
- centerList[2].isShow = app.globalData.snDisposition.noIdcardRegister
- centerList[3].isShow = app.globalData.snDisposition.signOut
- this.setData({
- snDisposition: app.globalData.snDisposition,
- centerList
- })
- // 生成二维码
- if (app.globalData.snDisposition.wxQrcodeUrl) {
- let qrImgWX = await getQRCodeUrl(app.globalData.snDisposition.wxQrcodeUrl)
- this.setData({
- qrImgWX
- })
- }
- if (app.globalData.snDisposition.zfbQrcodeUrl) {
- let qrImgZFB = await getQRCodeUrl(app.globalData.snDisposition.zfbQrcodeUrl)
- this.setData({
- qrImgZFB
- })
- }
- },
- // 跳转
- goto: throttle(function (e) {
- let item = e.currentTarget.dataset.item;
- switch (item.id) {
- case 1:
- console.log(app.data.isFaceScanInitialize);
- if (!app.data.isFaceScanInitialize) {
- my.showToast({
- content: '刷脸初始化失败,请重试',
- duration: 2000
- });
- return
- }
- app.data.isokFaceScan = true
- break;
- case 2:
- item.path = item.path + `&&timer=${app.globalData.snDisposition.readIdcardTimeout}`
- break;
- case 4:
- item.path = item.path + `&&timer=${app.globalData.snDisposition.singOutTimeout}`
- break;
- default:
- break;
- }
- if (item.id) {
- setTimeout(() => {
- closeSecondaryScreen()
- app.data.cycleIntervalSwitch = false
- }, 1000)
- }
- if (item.path) {
- my.reLaunch({
- url: item.path,
- })
- }
- }, 5000),
- isMoreThan15Days(date) {
- var fifteenDaysAgo = new Date();
- fifteenDaysAgo.setDate(fifteenDaysAgo.getDate() - 15);
- return date < fifteenDaysAgo;
- },
- sure() {},
- });
|