123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- const APP = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- devices: []
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.getList();
- },
- /**
- * 设备列表
- */
- getList: function () {
- const param = {
- openId: APP.globalData.openId
- }
- APP.Get(APP.Url.getDeviceList, param).then(res => {
- this.setData({
- devices: res.data
- })
- })
- },
- /**
- * 切换当前设备
- */
- changeDevice: function (event) {
- const params = {
- openNum: event.currentTarget.dataset.opennum
- }
- APP.Post(APP.Url.changeDefault, params).then(res => {
- APP.Modal.tips("切换成功");
- this.getList();
- })
- },
- toAdd: function () {
- wx.navigateTo({
- url: '/pages/device/add/add',
- })
- }
- })
|