import { updateConfig, snConfig } from '../../../utils/api/api' import { getWaterDrop, } from '../../../utils/index/index' const app = getApp() Page({ data: { list: [{ name: '支付宝刷脸人脸比对成功提示音', value: 'successVoice' }, { name: '支付宝刷脸人脸比对失败提示音', value: 'failVoice' }, { name: '访客信息登记成功提示音', value: 'registerSuccessVoice' }, { name: '刷身份证提示音', value: 'readIdcardVoice' }, { name: '输身份证提示音', value: 'inputIdcardVoice' }, { name: '输手机号提示音', value: 'inputPhoneVoice' }, { name: '联网信息查询提示音', value: 'connectSearchVoice' }, { name: '签离扫码提示音', value: 'singOutVoice' }, ], form: { successVoice: "比对成功", failVoice: "比对失败,请重试,或刷身份证", registerSuccessVoice: "正在打印访客单", readIdcardVoice: "请刷身份证", inputIdcardVoice: "请输入身份证号", inputPhoneVoice: "请输入手机号", connectSearchVoice: "正在联网查询信息,请耐心等待", singOutVoice: "请将二维码对准设备的扫码窗", }, }, onLoad() { this.getForm() }, clickAudio(){ getWaterDrop() }, async getForm() { my.showLoading() try { let dto = { sn: app.globalData.sn, token: app.globalData.FKJConfiguration, } let res = await snConfig(dto) this.setData({ form: res.data }) } catch (error) {} finally { my.hideLoading() } }, getVal(e) { let key = e.currentTarget.dataset.item.value let value = e.detail.value let NameVal = `form[${key}]` this.setData({ [NameVal]: value }) }, async sure() { let { form } = this.data form.modifyType = app.globalData.modifyType[3]; form.token = app.globalData.FKJConfiguration; my.showLoading() try { let res = await updateConfig(form) app.globalData.snDisposition.successVoice = form.successVoice; app.globalData.snDisposition.failVoice = form.failVoice; app.globalData.snDisposition.registerSuccessVoice = form.registerSuccessVoice; app.globalData.snDisposition.readIdcardVoice = form.readIdcardVoice; app.globalData.snDisposition.inputIdcardVoice = form.inputIdcardVoice; app.globalData.snDisposition.inputPhoneVoice = form.inputPhoneVoice; app.globalData.snDisposition.connectSearchVoice = form.connectSearchVoice; app.globalData.snDisposition.singOutVoice = form.singOutVoice; // console.log(app.globalData.snDisposition); my.setStorageSync({ data: app.globalData.snDisposition, key: 'snDisposition' }); my.reLaunch({ url: "/pages/settings/index/index" }) } catch (error) { console.log(error); } finally { my.hideLoading() } }, });