|
@@ -1,18 +1,8 @@
|
|
|
-import {
|
|
|
- tracking,
|
|
|
- snConfig,
|
|
|
- getVisitDeviceUser,
|
|
|
- publicInterface
|
|
|
-} from './utils/api/api'
|
|
|
-import {
|
|
|
- getForm,
|
|
|
- getDate,
|
|
|
- formatTime
|
|
|
-} from './utils/index/index'
|
|
|
+import {getVisitDeviceUser, publicInterface, QRCodeQuery, snConfig, tracking} from './utils/api/api'
|
|
|
+import {getForm} from './utils/index/index'
|
|
|
+
|
|
|
+import {closeSecondaryScreen, openCycleSecondaryScreen, openSecondaryScreen} from './utils/index/callAmpe'
|
|
|
|
|
|
-import {
|
|
|
- closeSecondaryScreen, openCycleSecondaryScreen, openSecondaryScreen
|
|
|
-} from './utils/index/callAmpe'
|
|
|
App({
|
|
|
data: {
|
|
|
// 用户输入身份证号
|
|
@@ -274,14 +264,18 @@ App({
|
|
|
scanCode() {
|
|
|
my.on('initQRListener', async res => {
|
|
|
console.log('⼆维码监听 ', res.data)
|
|
|
- // 扫码登记
|
|
|
- if (res.data && res.data.qrCode && res.data.qrCode.indexOf('HHFKJ') > -1) {
|
|
|
+ let specialCodeSwitch = this.globalData.snDisposition.specialCodeSwitch || false;
|
|
|
+ let specialCodePrefix = this.globalData.snDisposition.specialCodePrefix || '';
|
|
|
+ if (res.data && res.data.qrCode && res.data.qrCode.indexOf('HHFKJ') > -1) { // 扫码登记
|
|
|
if (!this.data.isOkQrCodeSignIn) {
|
|
|
this.data.isOkQrCodeSignIn = true
|
|
|
let data = getForm(res.data.qrCode)
|
|
|
- this.getVisitDeviceUser(data)
|
|
|
+ await this.getVisitDeviceUser(data)
|
|
|
}
|
|
|
- } else if (res.data && res.data.qrCode) {
|
|
|
+ } else if (specialCodeSwitch && res.data && res.data.qrCode && res.data.qrCode.indexOf(specialCodePrefix) > -1) { // 特殊码换三要素
|
|
|
+ let content = res.data;
|
|
|
+ await this.specialCodeUrlCheck(content)
|
|
|
+ } else if (res.data && res.data.qrCode) { // 扫码签离
|
|
|
if (res.data.qrCode.indexOf('\\000026') > -1 || res.data.qrCode.indexOf('\\000029') > -1) {
|
|
|
res.data.qrCode = res.data.qrCode.slice(7)
|
|
|
}
|
|
@@ -323,6 +317,53 @@ App({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 特殊码换三要素扫码登记
|
|
|
+ * @param content
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ async specialCodeUrlCheck(content) {
|
|
|
+ console.log(content)
|
|
|
+ let specialCodeUrl = this.globalData.snDisposition.specialCodeUrl || '';
|
|
|
+ let specialCodeTimeout = this.globalData.snDisposition.specialCodeTimeout || 5;
|
|
|
+ let specialCodeFailedTips = this.globalData.snDisposition.specialCodeFailedTips || '特殊码换三要素接口请求超时';
|
|
|
+ let specialCodeTimeoutTips = this.globalData.snDisposition.specialCodeTimeoutTips || '特殊码换三要素接口请求失败';
|
|
|
+ try {
|
|
|
+ let res = await QRCodeQuery({
|
|
|
+ // specialCodeUrl: 'http://192.168.77.15:8109/hanghui-openapi/v1/proof/user/info/query',
|
|
|
+ specialCodeUrl,
|
|
|
+ specialCodeTimeout,
|
|
|
+ specialCodeFailedTips,
|
|
|
+ specialCodeTimeoutTips
|
|
|
+ }, content);
|
|
|
+ console.log('特殊码换三要素扫码登记', res)
|
|
|
+ let resultData = res.data || {};
|
|
|
+ let extInfo = JSON.parse(resultData.extInfo || '')
|
|
|
+ // this.data.userInfo.avatar = resultData.avatar
|
|
|
+ this.data.userInfo.idCardPhoto = resultData.photoBase64 || '';
|
|
|
+ this.data.userInfo.xm = resultData.certName || '';
|
|
|
+ this.data.userInfo.sfzh = resultData.certNo || '';
|
|
|
+ this.data.userInfo.phone = resultData.phone || '';
|
|
|
+ this.data.userInfo.visitorUnit = extInfo.visitorUnit || '';
|
|
|
+ this.data.userInfo.carnum = extInfo.carnum || '';
|
|
|
+ this.data.userInfo.verifyType = 5; // 二维码1:1
|
|
|
+ this.data.brushingCardUserIInfo = {
|
|
|
+ name: resultData.certName || '',
|
|
|
+ idNum: resultData.certNo || '',
|
|
|
+ photoBase64: resultData.photoBase64 || '',
|
|
|
+ }
|
|
|
+ my.reLaunch({
|
|
|
+ url: '/pages/resultPage/index?result=1:1比对&type=二维码1:1',
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ let resultPageTimeout = this.globalData.snDisposition.resultPageTimeout || 5;
|
|
|
+ my.reLaunch({
|
|
|
+ url: '/pages/resultPage/index?result=失败&timer=' + resultPageTimeout + '&resultText=请重试',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ },
|
|
|
// 小程序二维码登记
|
|
|
async getVisitDeviceUser(data) {
|
|
|
let data1 = {
|
|
@@ -410,6 +451,14 @@ App({
|
|
|
fkjSignOutUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/visitorSignOut", //手动签离
|
|
|
transitPushSwitch: true, // 启用进出记录推送 默认值:true
|
|
|
transitPushUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/visitorReport",
|
|
|
+
|
|
|
+ specialCodeSwitch: false, // 启用特殊码换三要素接口 默认值:false
|
|
|
+ specialCodeUrl: '', // 特殊码换三要素接口地址
|
|
|
+ specialCodeTimeout: 5, // 特殊码换三要素接口超时时间(s) TODO ADD_FIELD
|
|
|
+ specialCodeTimeoutTips: '特殊码换三要素接口请求超时', // 特殊码换三要素接口超时提示语 TODO ADD_FIELD
|
|
|
+ specialCodeFailedTips: '特殊码换三要素接口请求失败', // 特殊码换三要素接口失败提示语 TODO ADD_FIELD
|
|
|
+ specialCodePrefix: '', // 二维码标识(首位) TODO ADD_FIELD
|
|
|
+
|
|
|
printVisitorList: false,
|
|
|
signOut: true,
|
|
|
riskCheck: false,
|