import common from '../../utils/util'; import main from '../../utils/main'; import fanObj from '../../pages/template/FanObject'; const app = getApp(); Page({ data: { ImagePath: app.globalData.uploadImageUrl, BtnCss1:"panel12112", BtnCss5:"panel12113", BtnCss10:"panel12112", BtnImg1:"2", BtnImg5:"3", BtnImg10:"2", BasicCardLimit:0, Increase:5, CardType:0, }, onLoad: function (options) { var that = this; that.setData({ Containnerheight: main.getWindowHeight(), }); that.init(); }, init: function () { var that = this; var studyPlan = app.globalData.TaskToday; var newLength=0; if (studyPlan.ListNew && studyPlan.ListNew.length>0) newLength=studyPlan.ListNew.length; var reviewLength=0; if (studyPlan.ListReview && studyPlan.ListReview.length>0) reviewLength=studyPlan.ListReview.length; var historyLength=0; if (studyPlan.ListHistory && studyPlan.ListHistory.length>0) historyLength=studyPlan.ListHistory.length; var taskNumber = newLength + reviewLength + historyLength; that.setData({ StudyPlan: studyPlan, TaskNumber: taskNumber, LimitTimeCardNum:studyPlan.NewLimitTimeToday+studyPlan.HistoryLimitTimeToday, }); var backColor = "#f0f0f0"; var rate = 0; if (studyPlan.CommonNewLength > 0 || studyPlan.CommonOldLength > 0) { rate = studyPlan.CommonNewLength / (studyPlan.CommonNewLength + studyPlan.CommonOldLength); backColor = "#EF7F57"; } fanObj.init(that, rate, 96, 3.0, "#F8C6B4", backColor, studyPlan.CommonNewLength + studyPlan.CommonOldLength); wx.showLoading(); common.getStorageValue(that, "CardMaxNumberNew", 10, function () { common.getStorageValue(that, "CardMaxNumberHistory", 40, function () { common.getStorageValue(that, "BasicCardLimit", 0, function () { var basicCardLimit=that.data.BasicCardLimit; if (!basicCardLimit) basicCardLimit=that.data.CardMaxNumberNew + that.data.CardMaxNumberHistory; that.setData({ BasicCardLimit: basicCardLimit, }); wx.hideLoading(); }); }); }); }, clickBtnNumber:function(e){ var that = this; var num=e.currentTarget.dataset.num; that.data["BtnCss1"]="panel12112"; that.data["BtnCss5"]="panel12112"; that.data["BtnCss10"]="panel12112"; that.data["BtnCss"+num]="panel12113"; that.data["BtnImg1"]=that.data["BtnCss1"].substr(9,1); that.data["BtnImg5"]=that.data["BtnCss5"].substr(9,1); that.data["BtnImg10"]=that.data["BtnCss10"].substr(9,1); that.data["Increase"]=num; that.setData(that.data); }, changeNum:function(e){ var num=e.currentTarget.dataset.num; var total=this.data.BasicCardLimit+Number(num)*this.data.Increase; if (total<10) total=10; else if (total>300) total=300; this.setData({ BasicCardLimit:total, }); }, goto: function (e) { var url=e.currentTarget.dataset.url; wx.navigateTo({ url: url, }); }, gotoReLaunch: function (e) { var url = e.currentTarget.dataset.url; wx.reLaunch({ url: url, }); }, gotoTaskList: function (e) { var id=e.currentTarget.dataset.id; main.GotoTaskList(id,this.data.CardType); }, saveUserConfig:function(e){ var that = this; var url2=""; if (app.globalData.userInfo.CurrentUserID) url2='&CurrentUserID='+app.globalData.userInfo.CurrentUserID; main.getData("UpdateUserConfigBasicCardLimit?UserID=" + app.globalData.userInfo.UserID + "&BasicCardLimit=" + that.data.BasicCardLimit+url2, function (data) { wx.navigateBack({ delta: 1, }); }); }, onShareAppMessage: function () { return { title: app.globalData.ShareTitle, path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID, imageUrl: app.globalData.ShareImage, } }, })