index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import {
  2. updateConfig,
  3. snConfig
  4. } from '../../../utils/api/api'
  5. import {
  6. getWaterDrop,
  7. } from '../../../utils/index/index'
  8. const app = getApp()
  9. Page({
  10. data: {
  11. list: [{
  12. name: '支付宝刷脸人脸比对成功提示音',
  13. value: 'successVoice'
  14. },
  15. {
  16. name: '支付宝刷脸人脸比对失败提示音',
  17. value: 'failVoice'
  18. },
  19. {
  20. name: '访客信息登记成功提示音',
  21. value: 'registerSuccessVoice'
  22. },
  23. {
  24. name: '刷身份证提示音',
  25. value: 'readIdcardVoice'
  26. },
  27. {
  28. name: '输身份证提示音',
  29. value: 'inputIdcardVoice'
  30. },
  31. {
  32. name: '输手机号提示音',
  33. value: 'inputPhoneVoice'
  34. },
  35. {
  36. name: '联网信息查询提示音',
  37. value: 'connectSearchVoice'
  38. },
  39. {
  40. name: '签离扫码提示音',
  41. value: 'singOutVoice'
  42. },
  43. ],
  44. form: {
  45. successVoice: "比对成功",
  46. failVoice: "比对失败,请重试,或刷身份证",
  47. registerSuccessVoice: "正在打印访客单",
  48. readIdcardVoice: "请刷身份证",
  49. inputIdcardVoice: "请输入身份证号",
  50. inputPhoneVoice: "请输入手机号",
  51. connectSearchVoice: "正在联网查询信息,请耐心等待",
  52. singOutVoice: "请将二维码对准设备的扫码窗",
  53. },
  54. },
  55. onLoad() {
  56. this.getForm()
  57. },
  58. clickAudio(){
  59. getWaterDrop()
  60. },
  61. async getForm() {
  62. my.showLoading()
  63. try {
  64. let dto = {
  65. sn: app.globalData.sn,
  66. token: app.globalData.FKJConfiguration,
  67. }
  68. let res = await snConfig(dto)
  69. this.setData({
  70. form: res.data
  71. })
  72. } catch (error) {} finally {
  73. my.hideLoading()
  74. }
  75. },
  76. getVal(e) {
  77. let key = e.currentTarget.dataset.item.value
  78. let value = e.detail.value
  79. let NameVal = `form[${key}]`
  80. this.setData({
  81. [NameVal]: value
  82. })
  83. },
  84. async sure() {
  85. let {
  86. form
  87. } = this.data
  88. form.modifyType = app.globalData.modifyType[3];
  89. form.token = app.globalData.FKJConfiguration;
  90. my.showLoading()
  91. try {
  92. let res = await updateConfig(form)
  93. app.globalData.snDisposition.successVoice = form.successVoice;
  94. app.globalData.snDisposition.failVoice = form.failVoice;
  95. app.globalData.snDisposition.registerSuccessVoice = form.registerSuccessVoice;
  96. app.globalData.snDisposition.readIdcardVoice = form.readIdcardVoice;
  97. app.globalData.snDisposition.inputIdcardVoice = form.inputIdcardVoice;
  98. app.globalData.snDisposition.inputPhoneVoice = form.inputPhoneVoice;
  99. app.globalData.snDisposition.connectSearchVoice = form.connectSearchVoice;
  100. app.globalData.snDisposition.singOutVoice = form.singOutVoice;
  101. // console.log(app.globalData.snDisposition);
  102. my.setStorageSync({
  103. data: app.globalData.snDisposition,
  104. key: 'snDisposition'
  105. });
  106. my.reLaunch({
  107. url: "/pages/settings/index/index"
  108. })
  109. } catch (error) {
  110. console.log(error);
  111. } finally {
  112. my.hideLoading()
  113. }
  114. },
  115. });