index.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import {
  2. snConfig,
  3. getVisitDeviceUser
  4. } from '../../utils/api/api'
  5. import {
  6. getQRCodeUrl,
  7. getForm,
  8. getWaterDrop,
  9. throttle,
  10. } from '../../utils/index/index'
  11. import {
  12. receiptPrinting
  13. } from '../../utils/index/receiptPrinting'
  14. import { closeSecondaryScreen, openSecondaryScreen } from "../../utils/index/callAmpe";
  15. const app = getApp()
  16. Page({
  17. data: {
  18. snDisposition: {},
  19. tabList: [{
  20. img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/tab-one.png',
  21. tit: '设置',
  22. path: '/pages/settings/login/index'
  23. },
  24. {
  25. img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/tab-two.png',
  26. tit: '通讯录',
  27. path: '/pages/settings/interviewee/index?formPath="通讯录"'
  28. },
  29. {
  30. img: '../../image/fkjl-icon.png',
  31. tit: '访客记录',
  32. path: '/pages/settings/visitorLog/index?formPath="访客记录"'
  33. },
  34. ],
  35. centerList: [{
  36. img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/center-one.png',
  37. tit: '刷脸登记',
  38. path: '/pages/resultPage/index?result=刷脸登记',
  39. isShow: true,
  40. id: 1,
  41. },
  42. {
  43. img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/center-two.png',
  44. tit: '持证登记',
  45. path: '/pages/resultPage/index?result=刷身份证',
  46. isShow: true,
  47. id: 2,
  48. },
  49. {
  50. img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/center-three.png',
  51. tit: '输身份证登记',
  52. path: '/pages/inputIDCard/index',
  53. isShow: true,
  54. id: 3,
  55. },
  56. {
  57. img: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/static/home/center-four.png',
  58. tit: '签离',
  59. path: '/pages/resultPage/index?result=扫码签离',
  60. isShow: true,
  61. id: 4,
  62. },
  63. ],
  64. centerListCope: [],
  65. qrImgWX: '', // 微信二维码图片地址
  66. qrImgZFB: '', // 支付宝二维码图片地址
  67. intervalId: null, //定时器
  68. intervalId1: null, //定时器
  69. },
  70. onLoad() {
  71. app.data.cycleIntervalSwitch = true
  72. let url = app.globalData.snDisposition.secondaryPageImages[app.data.secondaryPageImagesIndex] || ''
  73. if (url) {
  74. openSecondaryScreen(url)
  75. }
  76. this.data.centerListCope = JSON.parse(JSON.stringify(this.data.centerList))
  77. this.snConfig()
  78. },
  79. async onShow() {
  80. my.hideBackHome();
  81. app.data.userInfo.xm = ''
  82. app.data.userInfo.sfzh = ''
  83. app.data.userInfo.phone = ''
  84. app.data.userInfo.avatar = ''
  85. app.data.userInfo.idCardPhoto = ''
  86. app.data.userInfo.workPlace = ''
  87. app.data.userInfo.carNumber = ''
  88. app.data.userInfo.verifyType = 1;
  89. app.data.userInfo.certContent = '';
  90. app.globalData.signOffQrcodeUrl = ''
  91. app.globalData.ethQrcodeUrl = ''
  92. app.globalData.gateGrcodeUrl = ''
  93. app.data.inputPhone = ''
  94. app.globalData.brushingCardUserIInfo = {}
  95. app.globalData.visitoMsgData = {}
  96. app.data.isOkBrushingCard = false
  97. app.data.isOkQrCodeSignIn = false
  98. app.data.isokFaceScan = false
  99. app.globalData.riskResult = 1
  100. app.data.isNetworkQueryError = true
  101. app.data.clickRetryNum = 0
  102. },
  103. clickAudio() {
  104. getWaterDrop()
  105. },
  106. // 获取设备配置
  107. snConfig() {
  108. let that = this
  109. that.assignData()
  110. if (!app.globalData.snDisposition.id) {
  111. that.data.intervalId = setInterval(function () {
  112. if (app.globalData.snDisposition.id) {
  113. that.assignData()
  114. clearInterval(that.data.intervalId);
  115. }
  116. }, 1000);
  117. }
  118. },
  119. // 赋值
  120. async assignData() {
  121. this.data.centerList = JSON.parse(JSON.stringify(this.data.centerListCope))
  122. let centerList = this.data.centerList
  123. centerList[0].isShow = app.globalData.snDisposition.useAlipayFace
  124. centerList[1].isShow = app.globalData.snDisposition.useIdcard
  125. centerList[2].isShow = app.globalData.snDisposition.noIdcardRegister
  126. centerList[3].isShow = app.globalData.snDisposition.signOut
  127. this.setData({
  128. snDisposition: app.globalData.snDisposition,
  129. centerList
  130. })
  131. // 生成二维码
  132. if (app.globalData.snDisposition.wxQrcodeUrl) {
  133. let qrImgWX = await getQRCodeUrl(app.globalData.snDisposition.wxQrcodeUrl)
  134. this.setData({
  135. qrImgWX
  136. })
  137. }
  138. if (app.globalData.snDisposition.zfbQrcodeUrl) {
  139. let qrImgZFB = await getQRCodeUrl(app.globalData.snDisposition.zfbQrcodeUrl)
  140. this.setData({
  141. qrImgZFB
  142. })
  143. }
  144. },
  145. // 跳转
  146. goto: throttle(function (e) {
  147. let item = e.currentTarget.dataset.item;
  148. switch (item.id) {
  149. case 1:
  150. console.log(app.data.isFaceScanInitialize);
  151. if (!app.data.isFaceScanInitialize) {
  152. my.showToast({
  153. content: '刷脸初始化失败,请重试',
  154. duration: 2000
  155. });
  156. return
  157. }
  158. app.data.isokFaceScan = true
  159. break;
  160. case 2:
  161. item.path = item.path + `&&timer=${app.globalData.snDisposition.readIdcardTimeout}`
  162. break;
  163. case 4:
  164. item.path = item.path + `&&timer=${app.globalData.snDisposition.singOutTimeout}`
  165. break;
  166. default:
  167. break;
  168. }
  169. if (item.id) {
  170. setTimeout(() => {
  171. closeSecondaryScreen()
  172. app.data.cycleIntervalSwitch = false
  173. }, 1000)
  174. }
  175. if (item.path) {
  176. my.reLaunch({
  177. url: item.path,
  178. })
  179. }
  180. }, 5000),
  181. isMoreThan15Days(date) {
  182. var fifteenDaysAgo = new Date();
  183. fifteenDaysAgo.setDate(fifteenDaysAgo.getDate() - 15);
  184. return date < fifteenDaysAgo;
  185. },
  186. sure() {},
  187. });