index.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import {
  2. isPhone,
  3. getWaterDrop
  4. } from '../../utils/index/index'
  5. const app = getApp()
  6. import {
  7. viceBroadcast
  8. } from '../../utils/index/callAmpe'
  9. Page({
  10. data: {
  11. toTitleRef: null,
  12. numVal: '',
  13. numList: [1, 2, 3, 4, 5, 6, 7, 8, 9, ' ', 0, ]
  14. },
  15. onLoad() {
  16. viceBroadcast(app.globalData.snDisposition.inputPhoneVoice)
  17. my.hideBackHome();
  18. this.setData({
  19. snDisposition: app.globalData.snDisposition
  20. })
  21. },
  22. clickAudio() {
  23. getWaterDrop()
  24. },
  25. //操作倒计时结束
  26. finish(event) {
  27. if (event == 'finish') {
  28. this.backToSpecifiedPage('/pages/resultPage/index?result=结果页超时')
  29. }
  30. },
  31. getVal(e) {
  32. let val = e.currentTarget.dataset.item
  33. let numVal = this.data.numVal
  34. if (this.data.numVal.length >= 11 && val != '退格') {
  35. return
  36. }
  37. if (val != undefined) {
  38. switch (val) {
  39. case '退格':
  40. this.setData({
  41. numVal: numVal.substr(0, numVal.length - 1)
  42. })
  43. break;
  44. default:
  45. this.setData({
  46. numVal: numVal + val
  47. })
  48. break;
  49. }
  50. } else {
  51. this.setData({
  52. numVal: e.detail.value
  53. })
  54. }
  55. },
  56. bindlongtap(e) {
  57. let val = e.currentTarget.dataset.item
  58. if (val == '退格') {
  59. this.setData({
  60. numVal: ''
  61. })
  62. }
  63. },
  64. // 确认
  65. sure(e) {
  66. if (!this.data.numVal) {
  67. my.showToast({
  68. content: '请输入手机号',
  69. duration: 3000,
  70. });
  71. return
  72. }
  73. app.data.inputPhone = this.data.numVal
  74. console.log(app.data.userInfo.xm);
  75. if (!app.data.userInfo.xm) {
  76. this.backToSpecifiedPage('/pages/resultPage/index?result=联网查询')
  77. } else {
  78. this.backToSpecifiedPage('/pages/resultPage/index?result=1:1比对&type=手输1:1')
  79. }
  80. },
  81. saveRef(ref){
  82. // 将ref存起来,在想要调用的地方使用
  83. this.toTitleRef = ref
  84. },
  85. /**
  86. * 跳转指定页面 并清除顶部计时器
  87. */
  88. backToSpecifiedPage(url) {
  89. this.toTitleRef && this.toTitleRef.clearIntervalAll()
  90. my.reLaunch({
  91. url: url,
  92. })
  93. },
  94. });