devicename.js 735 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const APP = getApp();
  2. Page({
  3. data: {
  4. device: null //设置信息
  5. },
  6. /**
  7. * 生命周期函数--监听页面加载
  8. */
  9. onLoad: function (options) {
  10. this.getDefaultDevice();
  11. },
  12. getDefaultDevice: function () {
  13. const param = {
  14. openId: APP.globalData.openId
  15. }
  16. APP.Get(APP.Url.getDefaultDevice, param).then(res => {
  17. this.setData({
  18. device: res.data
  19. })
  20. })
  21. },
  22. /**
  23. * 设置名称
  24. */
  25. updateName: function (form) {
  26. const param = {
  27. openNum: APP.globalData.openNum,
  28. deviceName: form.detail.value.deviceName
  29. }
  30. APP.Post(APP.Url.updateName, param).then(res => {
  31. APP.Modal.tips("设置成功");
  32. this.getDefaultDevice();
  33. })
  34. }
  35. })