import common from '../../utils/util'; import main from '../../utils/main'; const app = getApp(); Page({ data: { IsChangeRecommend: true, SecondConfig: [{ Key: "蓝色", Value: 10, }, { Key: "绿色", Value: 30, }, { Key: "黄色", Value: 50, } ] }, onLoad: function (options) { wx.hideShareMenu(); var that = this; that.init(); that.setData({ Containnerheight: main.getWindowHeight(), }); }, init:function(){ var that=this; var secondConfig = wx.getStorageSync("SecondConfigArray"); if (!secondConfig || (secondConfig[0]==0)) secondConfig = [10, 30, 50]; for (var j = 0; j < 3; j++) { var arr = []; for (var i = 3; i <= 90; i++) { arr.push(i); } that.data.SecondConfig[j].Value = secondConfig[j]; that.data.SecondConfig[j].NumberArray = arr; } that.setData({ SecondConfig: that.data.SecondConfig, }); wx.setStorageSync("SecondConfigArray", secondConfig); }, bindRecommendTime: function (e) { var that = this; var index = e.currentTarget.dataset.index; this.data.SecondConfig[index].Value = Number(e.detail.value) + 3; if (this.data.SecondConfig[0].Value >= this.data.SecondConfig[1].Value) { wx.showToast({ title: '绿需大于蓝', }); } else if (this.data.SecondConfig[1].Value >= this.data.SecondConfig[2].Value) { wx.showToast({ title: '黄需大于绿', }); } else { this.setData({ SecondConfig: this.data.SecondConfig, }); var arr = [this.data.SecondConfig[0].Value, this.data.SecondConfig[1].Value, this.data.SecondConfig[2].Value]; wx.setStorageSync("SecondConfigArray", arr); } }, switch1Change(e) { var that = this; that.data.IsChangeRecommend = e.detail.value; that.setData({ IsChangeRecommend: that.data.IsChangeRecommend, }); if (that.data.IsChangeRecommend) that.init(); else wx.setStorageSync("SecondConfigArray", [0,0,0]); }, onShareAppMessage: function () { return { title: app.globalData.ShareTitle, path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID, imageUrl: app.globalData.ShareImage, } }, })