personInfo.js 711 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const APP = getApp()
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. device: {},
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad(options) {
  13. this.getBindInfo();
  14. },
  15. getBindInfo() {
  16. APP.Get(APP.Url.getBindInfo, {}, false).then(res => {
  17. this.setData({
  18. device: res.data
  19. })
  20. })
  21. },
  22. submit: function (form) {
  23. const that = this;
  24. const params = {
  25. openNum: that.data.device.openNum,
  26. deviceName: form.detail.value.deviceName
  27. }
  28. APP.Post(APP.Url.updateBindInfo, params).then(res => {
  29. APP.Modal.tips("保存成功!")
  30. that.getBindInfo()
  31. }).catch(res => {
  32. APP.Modal.tips("保存失败!")
  33. })
  34. }
  35. })