index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {
  2. updateConfig
  3. } from '../../../utils/api/api'
  4. import {
  5. getWaterDrop
  6. } from '../../../utils/index/index'
  7. const app = getApp()
  8. Page({
  9. data: {
  10. password: '',
  11. },
  12. onLoad() {
  13. my.hideBackHome();
  14. },
  15. clickAudio(){
  16. getWaterDrop()
  17. },
  18. getVal(e) {
  19. this.setData({
  20. password: e.detail.value
  21. })
  22. },
  23. async sure() {
  24. let mpassword = this.data.password
  25. if (mpassword) {
  26. my.showLoading()
  27. let form = {
  28. mpassword,
  29. sn: app.globalData.sn,
  30. modifyType: app.globalData.modifyType[4],
  31. token: app.globalData.FKJConfiguration
  32. }
  33. try {
  34. let data = await updateConfig(form)
  35. app.globalData.snDisposition.mpassword = form.mpassword;
  36. // console.log(app.globalData.snDisposition);
  37. my.setStorageSync({
  38. data: app.globalData.snDisposition,
  39. key: 'snDisposition'
  40. });
  41. my.reLaunch({
  42. url: "/pages/settings/index/index"
  43. })
  44. } catch (error) {
  45. console.log(error);
  46. } finally {
  47. my.hideLoading()
  48. }
  49. }
  50. },
  51. });