| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- import constant from '../../utils/constant';
- const app = getApp();
- Page({
- data: {
- MenuArr: constant.arrStudyPlay,
- },
- onLoad: function (options) {
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- CardType:options.CardType,
- MiaoguoCardID:options.ID,
- CardNumberUrgent: app.globalData.TaskToday.CardNumberUrgent,
- });
- if (app.globalData.IsIPhoneX) {
- that.setData({
- IsIPhoneX: "_IsIPhoneX",
- });
- }
- },
- changeCardType:function(e){
- var that = this;
- var cardType=e.currentTarget.dataset.cardtype;
- if (cardType!=that.data.CardType){
- if (cardType == 1 && that.data.CardNumberUrgent>=200){
- wx.showToast({
- title: '紧急练习容量已满',
- })
- }
- else{
- that.setData({
- CardType: cardType,
- });
- }
- }
- },
- close:function(){
- wx.navigateBack({
- delta: 1,
- });
- },
- save:function(){
- var that = this;
- var url = 'UpdateMiaoguoCardType?UserID=' + app.globalData.userInfo.UserID;
- url += "&CardType=" + that.data.CardType;
- url += "&ID=" + that.data.MiaoguoCardID;
- main.getData(url, function (data) {
- var list = app.globalData.CardList;
- for (var i = 0; i < list.length; i++) {
- if (list[i].MiaoguoCardID == that.data.MiaoguoCardID)
- list[i].CardType = that.data.CardType;
- }
- app.globalData.CardList = list;
- app.globalData.IsUpdateStudyPlan = 1;
-
- if (that.data.CardType==1){
- app.globalData.TaskToday.CardNumberUrgent++;
- var cardType=wx.getStorageSync('CardType');
- if (cardType==0 && app.globalData.TaskToday.CardNumberUrgent==1){
- wx.redirectTo({
- url: "../other/menu?Type=0",
- });
- }
- else{
- that.close();
- }
- }
- else{
- that.close();
- }
-
- });
-
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|