| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- const DefaultSecondArray=[5,40,60];
- Page({
- data: {
- IsChangeRecommend: true,
- SecondConfig: [{
- Key: "蓝色",
- }, {
- Key: "绿色",
- }, {
- Key: "黄色",
- }
- ]
- },
- onLoad: function (options) {
- 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){
- that.data.IsChangeRecommend = false;
- secondConfig=[0,0,0];
- }
- else{
- secondConfig = DefaultSecondArray;
- that.data.IsChangeRecommend = true;
- 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({
- IsChangeRecommend: that.data.IsChangeRecommend,
- 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);
- main.UploadUserConfig();
- }
- },
- switch1Change(e) {
- var that = this;
- that.data.IsChangeRecommend = e.detail.value;
-
- that.setData({
- IsChangeRecommend: that.data.IsChangeRecommend,
- });
- if (that.data.IsChangeRecommend)
- wx.setStorageSync("SecondConfigArray", DefaultSecondArray);
- else
- wx.setStorageSync("SecondConfigArray", [0, 0, 0]);
-
- main.UploadUserConfig();
- that.init();
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|