app.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. import {getVisitDeviceUser, publicInterface, QRCodeQuery, snConfig, tracking} from './utils/api/api'
  2. import {getForm} from './utils/index/index'
  3. import {closeSecondaryScreen, openCycleSecondaryScreen, openSecondaryScreen} from './utils/index/callAmpe'
  4. App({
  5. data: {
  6. // 用户输入身份证号
  7. inputIdCard: '',
  8. // 用户输入手机号
  9. inputPhone: '',
  10. //设备上报心跳
  11. TIME_COUNT: 60,
  12. timer: null,
  13. //用户信息
  14. userInfo: {
  15. avatar: '',
  16. idCardPhoto: '',
  17. xm: '',
  18. sfzh: '',
  19. phone: '',
  20. workPlace: '',
  21. carNumber: '',
  22. // xm: '张佳燕',
  23. // sfzh: '331082199910045826',
  24. // phone: '15888632412',
  25. },
  26. // 刷证获取到的用户信息
  27. brushingCardUserIInfo: {},
  28. // 拜访成功数据信息
  29. visitoMsgData: {},
  30. // 签离成功的用户信息
  31. signOffMsg: {},
  32. // 刷身份证是否开始
  33. isOkBrushingCard: false,
  34. // 扫码登记是否开始
  35. isOkQrCodeSignIn: false,
  36. // 刷脸是否开始
  37. isokFaceScan: false,
  38. // 刷脸初始化是否成功
  39. isFaceScanInitialize: false, // 是否捕获到联网查询错误
  40. isNetworkQueryError: true,
  41. clickRetryNum: 0, //获取用户信息重试次数
  42. isSecondaryScreenState: true, // 是否能加载到副屏
  43. cycleIntervalId: null, // 副屏展示定时器
  44. cycleIntervalSwitch: false, // 副屏展示是否开启
  45. secondaryPageImagesIndex: 0,
  46. },
  47. onLaunch(options) {
  48. // this.initGlobalDataWatcher();
  49. let snDisposition = my.getStorageSync({
  50. key: 'snDisposition'
  51. }).data;
  52. if (snDisposition) {
  53. this.globalData.snDisposition = snDisposition
  54. }
  55. this.globalData.snDisposition.id = null
  56. this.globalData.expirationDateTodayOpen = false
  57. this.getSecondaryScreenState()
  58. this.getSystemInfo()
  59. this.getSystemInfoSync()
  60. this.getDeviceInformation()
  61. this.initialize()
  62. this.brushingCard()
  63. this.scanCode()
  64. // this.snConfig()
  65. },
  66. onShow(options) {
  67. // 从后台被 scheme 重新打开
  68. },
  69. // 初始化
  70. initialize() {
  71. // 刷脸初始化
  72. let params = {
  73. "action": "initFace",
  74. "event": "open",
  75. "taskId": "2",
  76. "params": {
  77. "scope": "auth_user,order_service"
  78. }
  79. }
  80. console.log('刷脸初始化开始');
  81. my.call("ampeHHCommunication", params, res => {
  82. console.log(res, '刷脸初始化结束')
  83. if (res.success) {
  84. this.data.isFaceScanInitialize = true
  85. }
  86. });
  87. },
  88. initSecondaryScreen() {
  89. // 启用首页副屏
  90. console.log(this.data.isSecondaryScreenState && this.globalData.snDisposition.secondaryPageSwitch)
  91. if (this.data.isSecondaryScreenState && this.globalData.snDisposition.secondaryPageSwitch) {
  92. console.log('打开副屏轮播', this.data.isSecondaryScreenState);
  93. openCycleSecondaryScreen()
  94. }
  95. // console.log('关闭副屏', app.data.isSecondaryScreenState)
  96. // if (app.data.isSecondaryScreenState && app.globalData.snDisposition.secondaryPageSwitch) {
  97. // // closeSecondaryScreen()
  98. // closeCycleSecondaryScreen()
  99. // }
  100. },
  101. // 获取副屏状态
  102. getSecondaryScreenState() {
  103. let params = {
  104. "action": "getSecondaryScreenState",
  105. "event": "open",
  106. "taskId": "10",
  107. }
  108. try {
  109. my.call("ampeHHCommunication", params, res => {
  110. console.log(res, '获取副屏状态')
  111. this.data.cycleIntervalId && clearInterval(this.data.cycleIntervalId);
  112. this.data.isSecondaryScreenState = false
  113. this.data.secondaryPageImagesIndex = 0
  114. if (res.success) {
  115. // 副屏展示状态 显示1 关闭 0 暂不支持 -1(没加载到副屏)
  116. let screenState = res.data.getSecondaryScreenState;
  117. this.data.isSecondaryScreenState = true
  118. if (screenState == -1) {
  119. this.data.cycleIntervalSwitch = false
  120. } else if (screenState == 1) {
  121. closeSecondaryScreen()
  122. }
  123. this.initSecondaryScreen()
  124. console.log('ampeHHCommunication', res);
  125. console.log(this.data.isSecondaryScreenState)
  126. } else {
  127. this.data.cycleIntervalSwitch = false
  128. }
  129. })
  130. } catch (error) {
  131. console.log(error);
  132. }
  133. },
  134. //设备上报心跳的接口 60秒调一次
  135. trackingInterval() {
  136. let {
  137. TIME_COUNT,
  138. timer,
  139. count
  140. } = this.data
  141. if (!timer) {
  142. count = TIME_COUNT;
  143. timer = setInterval(async () => {
  144. if (count > 0 && count <= TIME_COUNT) {
  145. count--;
  146. } else {
  147. clearInterval(timer);
  148. this.data.timer = null;
  149. await this.tracking()
  150. this.trackingInterval()
  151. }
  152. }, 60 * 1000)
  153. }
  154. },
  155. async tracking() {
  156. let form = {
  157. sn: this.globalData.sn
  158. }
  159. try {
  160. let res = await tracking(form)
  161. } catch (error) {
  162. console.log(error);
  163. }
  164. },
  165. // 获取设备信息
  166. getDeviceInformation() {
  167. let params = {
  168. "action": "getDeviceInfo",
  169. "event": "open",
  170. "taskId": "4"
  171. }
  172. let that = this
  173. try {
  174. my.call('ampeHHCommunication', params, res => {
  175. console.log(res, '获取设备信息');
  176. if (res.data) {
  177. that.globalData.deviceInformation = res.data
  178. that.globalData.sn = res.data.sn
  179. that.snConfig()
  180. that.tracking()
  181. that.trackingInterval()
  182. }
  183. });
  184. } catch (error) {
  185. console.log(error);
  186. }
  187. },
  188. getSystemInfo() {
  189. // 利用callback回调 解决页面异步调取 数据的问题 todo
  190. my.getSystemInfo({
  191. success: (res) => {
  192. // 通过宽高比例判断屏幕类型
  193. if (res.screenWidth / res.screenHeight > 1) {
  194. this.globalData.isPortraitScreen = false
  195. console.log('getSystemInfo====>横屏模式');
  196. } else {
  197. this.globalData.isPortraitScreen = true
  198. console.log('getSystemInfo====>竖屏模式');
  199. }
  200. },
  201. fail: (err) => {
  202. console.log(err);
  203. }
  204. });
  205. },
  206. // 获取版本号
  207. getSystemInfoSync() {
  208. const accountInfo = my.getAccountInfoSync();
  209. this.globalData.appVersion = accountInfo.miniProgram.version
  210. },
  211. // 获取设备配置
  212. async snConfig() {
  213. let data = {
  214. "token": this.globalData.FKJConfiguration,
  215. "sn": this.globalData.sn
  216. }
  217. try {
  218. let res = await snConfig(data)
  219. this.globalData.snDisposition = res.data
  220. my.setStorageSync({
  221. data: res.data,
  222. key: 'snDisposition'
  223. });
  224. } catch (error) {
  225. console.log(error);
  226. }
  227. },
  228. // 刷身份证监听
  229. brushingCard() {
  230. my.on('initIDCardListener', res => {
  231. console.log("刷身份证监听", this.data.isOkBrushingCard, res.data)
  232. if (!this.data.isOkBrushingCard && !this.data.isokFaceScan) {
  233. if (res.data) {
  234. this.data.isOkBrushingCard = true
  235. this.data.brushingCardUserIInfo = res.data
  236. this.data.brushingCardUserIInfo.name = this.data.brushingCardUserIInfo.name.replace(/\s*/g, "")
  237. setTimeout(()=>{
  238. closeSecondaryScreen()
  239. this.data.cycleIntervalSwitch = false
  240. }, 1000)
  241. this.data.userInfo.idCardPhoto = res.data.photoBase64
  242. my.reLaunch({
  243. url: '/pages/resultPage/index?result=首页刷证',
  244. })
  245. } else {
  246. my.showToast({
  247. content: '刷证失败,请重试',
  248. duration: 2000
  249. });
  250. }
  251. } else {
  252. return
  253. }
  254. })
  255. },
  256. //开启⼆维码监听
  257. scanCode() {
  258. my.on('initQRListener', async res => {
  259. console.log('⼆维码监听 ', res.data)
  260. let specialCodeSwitch = this.globalData.snDisposition.specialCodeSwitch || false;
  261. let specialCodePrefix = this.globalData.snDisposition.specialCodePrefix || '';
  262. if (res.data && res.data.qrCode && res.data.qrCode.indexOf('HHFKJ') > -1) { // 扫码登记
  263. if (!this.data.isOkQrCodeSignIn) {
  264. this.data.isOkQrCodeSignIn = true
  265. let data = getForm(res.data.qrCode)
  266. await this.getVisitDeviceUser(data)
  267. }
  268. } else if (specialCodeSwitch && res.data && res.data.qrCode && res.data.qrCode.indexOf(specialCodePrefix) > -1) { // 特殊码换三要素
  269. let content = res.data;
  270. await this.specialCodeUrlCheck(content)
  271. } else if (res.data && res.data.qrCode) { // 扫码签离
  272. if (res.data.qrCode.indexOf('\\000026') > -1 || res.data.qrCode.indexOf('\\000029') > -1) {
  273. res.data.qrCode = res.data.qrCode.slice(7)
  274. }
  275. console.log(res.data.qrCode);
  276. // 扫码签离
  277. let data = {
  278. sn: this.globalData.sn,
  279. code: res.data.qrCode
  280. }
  281. console.log(data);
  282. try {
  283. let res = await publicInterface({
  284. prop: 'fkjCodeSignOutUrl',
  285. defaultProp: '/visitorCodeSignOut',
  286. data: data,
  287. method: 'post',
  288. errorTip: ''
  289. })
  290. this.data.signOffMsg = res.data
  291. setTimeout(()=>{
  292. closeSecondaryScreen()
  293. this.data.cycleIntervalSwitch = false
  294. }, 1000)
  295. my.reLaunch({
  296. url: '/pages/resultPage/index?result=签离成功'
  297. });
  298. } catch (error) {
  299. console.log(error);
  300. my.showToast({
  301. content: error.msg || '扫码签离api请求失败',
  302. duration: 2000
  303. });
  304. }
  305. } else {
  306. my.showToast({
  307. content: '扫码失败,请重试',
  308. duration: 2000
  309. });
  310. }
  311. })
  312. },
  313. /**
  314. * 特殊码换三要素扫码登记
  315. * @param content
  316. * @returns {Promise<void>}
  317. */
  318. async specialCodeUrlCheck(content) {
  319. console.log(content)
  320. let specialCodeUrl = this.globalData.snDisposition.specialCodeUrl || '';
  321. let specialCodeTimeout = this.globalData.snDisposition.specialCodeTimeout || 5;
  322. let specialCodeFailedTips = this.globalData.snDisposition.specialCodeFailedTips || '特殊码换三要素接口请求超时';
  323. let specialCodeTimeoutTips = this.globalData.snDisposition.specialCodeTimeoutTips || '特殊码换三要素接口请求失败';
  324. try {
  325. let res = await QRCodeQuery({
  326. // specialCodeUrl: 'http://192.168.77.15:8109/hanghui-openapi/v1/proof/user/info/query',
  327. specialCodeUrl,
  328. specialCodeTimeout,
  329. specialCodeFailedTips,
  330. specialCodeTimeoutTips
  331. }, content);
  332. console.log('特殊码换三要素扫码登记', res)
  333. let resultData = res.data || {};
  334. let extInfo = JSON.parse(resultData.extInfo || '')
  335. // this.data.userInfo.avatar = resultData.avatar
  336. this.data.userInfo.idCardPhoto = resultData.photoBase64 || '';
  337. this.data.userInfo.xm = resultData.certName || '';
  338. this.data.userInfo.sfzh = resultData.certNo || '';
  339. this.data.userInfo.phone = resultData.phone || '';
  340. this.data.userInfo.visitorUnit = extInfo.visitorUnit || '';
  341. this.data.userInfo.carnum = extInfo.carnum || '';
  342. this.data.userInfo.verifyType = 5; // 二维码1:1
  343. this.data.brushingCardUserIInfo = {
  344. name: resultData.certName || '',
  345. idNum: resultData.certNo || '',
  346. photoBase64: resultData.photoBase64 || '',
  347. }
  348. my.reLaunch({
  349. url: '/pages/resultPage/index?result=1:1比对&type=二维码1:1',
  350. })
  351. } catch (error) {
  352. console.log(error)
  353. let resultPageTimeout = this.globalData.snDisposition.resultPageTimeout || 5;
  354. my.reLaunch({
  355. url: '/pages/resultPage/index?result=失败&timer=' + resultPageTimeout + '&resultText=请重试',
  356. })
  357. return
  358. }
  359. },
  360. // 小程序二维码登记
  361. async getVisitDeviceUser(data) {
  362. let data1 = {
  363. userId: data.serId,
  364. timestamp: data.timestamp,
  365. }
  366. try {
  367. let res = await getVisitDeviceUser(data1)
  368. console.log('小程序二维码登记', res)
  369. this.data.userInfo.avatar = res.data.avatar
  370. this.data.userInfo.idCardPhoto = res.data.avatar
  371. this.data.userInfo.xm = res.data.username
  372. this.data.userInfo.sfzh = res.data.idNumber
  373. this.data.userInfo.phone = res.data.phone
  374. this.data.userInfo.visitorUnit = res.data.workPlace
  375. this.data.userInfo.carnum = res.data.carNumber
  376. this.data.userInfo.verifyType = 6; // 二维码
  377. this.data.userInfo.certContent = res.data; // 身份证阅读器返回全部
  378. let reminderAuth = this.globalData.snDisposition.reminderAuth;
  379. // 是否跳转到提示页
  380. if (reminderAuth) {
  381. my.reLaunch({
  382. url: '/pages/tipsPage/index'
  383. })
  384. } else {
  385. // 是否启用副屏处理中页面
  386. let processingPageSwitch = this.globalData.snDisposition.processingPageSwitch;
  387. if (this.data.isSecondaryScreenState && processingPageSwitch) {
  388. console.log('打开副屏', this.data.isSecondaryScreenState);
  389. closeSecondaryScreen()
  390. this.data.cycleIntervalSwitch = false
  391. openSecondaryScreen(this.globalData.snDisposition.processingPageImage || '')
  392. }
  393. my.reLaunch({
  394. url: '/pages/interviewee/index'
  395. })
  396. }
  397. } catch (error) {
  398. console.log(error);
  399. this.data.isOkQrCodeSignIn = false
  400. setTimeout(()=>{
  401. closeSecondaryScreen()
  402. this.data.cycleIntervalSwitch = false
  403. }, 1000)
  404. my.reLaunch({
  405. url: '/pages/resultPage/index?result=结果页超时&&timer=' + this.globalData.snDisposition.resultPageTimeout,
  406. })
  407. }
  408. },
  409. globalData: {
  410. isPortraitScreen: null,// 是否为竖屏:true竖屏 false横屏
  411. // 13CD002006700011 137D002002300009 118D002000500012 136D002002300012
  412. sn: '',
  413. appVersion: '', //app版本号
  414. // 获取访客机配置token
  415. FKJConfiguration: '01f8624317168a4a52fd89f673a3ccbc',
  416. // 所修改内容的类型 0:修改基本设置 1:修改高级设置 2:超时时长设置 3:语音设置 4:密码设置
  417. modifyType: [0, 1, 2, 3, 4],
  418. //访客机配置
  419. snDisposition: {
  420. mode: null,
  421. sn: null,
  422. status: null,
  423. useAlipayFace: true,
  424. useIdcard: true,
  425. usePersonCard: true,
  426. voiceVolume: 80,
  427. mpassword: "117521",
  428. purchaserId: null,
  429. applicationTypeId: null,
  430. deviceModelHardwareId: null,
  431. deviceModelEnvironmentId: null,
  432. systemTypeCode: null,
  433. noIdcardRegister: false,
  434. noIdcardInputPhone: true,
  435. wxScanRegister: false,
  436. zfbScanRegister: false,
  437. wxQrcodeUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/faceCheckVisitor?type=2",
  438. zfbQrcodeUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/faceCheckVisitor?type=2",
  439. visiteeUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/api/v1/fkj/visitee/list",
  440. areaUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/api/v1/fkj/area/info",
  441. fkjCodeSignOutUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/visitorCodeSignOut", //扫码签离
  442. fkjHistoryRecordUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/history", // 历史拜访查询
  443. fkjRecordUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/visitorReportPageList", //访客记录接口
  444. fkjSignOutUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/visitorSignOut", //手动签离
  445. transitPushSwitch: true, // 启用进出记录推送 默认值:true
  446. transitPushUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/visitorReport",
  447. specialCodeSwitch: false, // 启用特殊码换三要素接口 默认值:false
  448. specialCodeUrl: '', // 特殊码换三要素接口地址
  449. specialCodeTimeout: 5, // 特殊码换三要素接口超时时间(s) TODO ADD_FIELD
  450. specialCodeTimeoutTips: '特殊码换三要素接口请求超时', // 特殊码换三要素接口超时提示语 TODO ADD_FIELD
  451. specialCodeFailedTips: '特殊码换三要素接口请求失败', // 特殊码换三要素接口失败提示语 TODO ADD_FIELD
  452. specialCodePrefix: '', // 二维码标识(首位) TODO ADD_FIELD
  453. printVisitorList: false,
  454. signOut: true,
  455. riskCheck: false,
  456. hiddenButton: false,
  457. reminderAuth: false, // 是否启用注意事项提示语
  458. reminder: '', // 注意事项提示图片
  459. reminderPlayText: '', // 提示标语播报文本
  460. confirmCountdownSwitch: true, // 是否启用确定倒计时
  461. confirmCountdownTime: 15,
  462. secondaryPageSwitch: true, // 是否启用副屏轮播图
  463. secondaryPageImages: [], // 副屏轮播图(0/5)
  464. processingPageSwitch: true, // 是否启用副屏处理中页面
  465. processingPageImage: '', // 副屏处理中页面图
  466. generalQrcode: true,
  467. generalQrcodeTitle: "",
  468. ethQrcode: true,
  469. ethQrcodeTitle: "梯控二维码",
  470. ethQrcodeUrl: "https://tx.hz-hanghui.com:8088/yx-fyzd/api/v1/fkj/visitor/eth/qrCode",
  471. chooseVisiteeTimeout: 90,
  472. readIdcardTimeout: 15,
  473. inputIdcardTimeout: 30,
  474. inputPhoneTimeout: 30,
  475. singOutTimeout: 15,
  476. resultPageTimeout: 5,
  477. successVoice: "比对成功",
  478. failVoice: "比对失败,请重试,或刷身份证",
  479. registerSuccessVoice: "正在打印访客单",
  480. readIdcardVoice: "请刷身份证",
  481. inputIdcardVoice: "请输入身份证号",
  482. inputPhoneVoice: "请输入手机号",
  483. connectSearchVoice: "正在联网查询信息,请耐心等待",
  484. singOutVoice: "请将二维码对准设备的扫码窗",
  485. notDesensitizedColumn: [],
  486. registerNotDesensitizedColumn: [],
  487. faceTimeout: 40,
  488. oneToOneTimeout: 40,
  489. connectSearchTimeout: 40,
  490. faceFailHandInput: false,
  491. visitReason: '', // 拜访事由选项
  492. expirationDate: null, // 使用时间期限
  493. },
  494. // 设备信息
  495. deviceInformation: {},
  496. // 获取三要素在线配置接口
  497. serviceAddress: '',
  498. // 获取用户信息
  499. appId: '3292340fd1d913395fe32f781399604a',
  500. appKey: 'hhLOhU8Wb5x',
  501. appSecret: '3ade6850270e2964bb7499492493e464ceccf937',
  502. privateKey: 'wxuoukkrts68aqwv',
  503. // ⾃然⼈⻛险评分查询
  504. appIdRisk: 'be454b553daa209177e8d51883e828d2',
  505. appKeyRisk: 'hh0SLerEB5E',
  506. appSecretRisk: '2ec80e28fa7c98936fd053c9b72aa81692bb5ec5',
  507. privateKeyRisk: 'yfxrbbnnmsyuteaj',
  508. // ⾃然⼈⻛险评分查询结果 1:正常2:逃犯3:其他
  509. riskResult: 1,
  510. expirationDateTodayOpen: false, // 今天是否已经到期提醒
  511. },
  512. /*globalDataWatchers: {},
  513. /!**
  514. * 初始化递归监听
  515. *!/
  516. initGlobalDataWatcher() {
  517. this.observe(this.globalData);
  518. },
  519. /!**
  520. * 递归监听对象
  521. * @param {Object} obj 要监听的对象
  522. * @param {String} parentKey 父路径
  523. *!/
  524. observe(obj, parentKey = '') {
  525. const watchers = this.globalDataWatchers;
  526. Object.keys(obj).forEach(key => {
  527. let value = obj[key];
  528. const fullPath = parentKey ? `${parentKey}.${key}` : key; // 完整路径
  529. // 如果是对象,递归监听其子属性
  530. if (value && typeof value === 'object') {
  531. this.observe(value, fullPath);
  532. }
  533. // 定义 getter 和 setter
  534. Object.defineProperty(obj, key, {
  535. configurable: true,
  536. enumerable: true,
  537. get() {
  538. return value;
  539. },
  540. set: newValue => {
  541. if (newValue !== value) {
  542. value = newValue;
  543. console.log(`${fullPath} 被更新为:`, newValue);
  544. // 触发监听器
  545. if (watchers[fullPath]) {
  546. watchers[fullPath].forEach(callback => callback(newValue));
  547. }
  548. // 如果新值是对象,递归监听其子属性
  549. if (newValue && typeof newValue === 'object') {
  550. this.observe(newValue, fullPath);
  551. }
  552. }
  553. },
  554. });
  555. });
  556. },
  557. /!**
  558. * 添加监听器
  559. * @param {String} path 属性路径
  560. * @param {Function} callback 回调函数
  561. *!/
  562. watchGlobalData(path, callback) {
  563. if (!this.globalDataWatchers[path]) {
  564. this.globalDataWatchers[path] = [];
  565. }
  566. this.globalDataWatchers[path].push(callback);
  567. },
  568. /!**
  569. * 移除监听器
  570. * @param path 属性路径
  571. * @param callback 回调函数
  572. *!/
  573. unwatchGlobalData(path, callback) {
  574. const watchers = this.globalDataWatchers[path];
  575. if (watchers) {
  576. this.globalDataWatchers[path] = watchers.filter(cb => cb !== callback);
  577. }
  578. },*/
  579. });