| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- IsTempCardNoSaved:false,
- IsExit:false,
- },
- onLoad: function (options) {
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- });
- if (options.Share==1){
- var id = options.MiaoguoCardID;
- wx.navigateTo({
- url: './preview?type=share&id=' + id,
- });
- }
- if (app.globalData.IsIPad){
- that.setData({
- IsIPad: "_iPad",
- });
- if (app.globalData.systemInfo.windowHeight < app.globalData.systemInfo.windowWidth){
- that.setData({
- IsExit:true,
- });
- }
- }
-
- },
- onShow: function () {
- var that = this;
- wx.getSetting({
- success(res) {
- if (res.authSetting['scope.userInfo']) {
- if (!app.globalData.userInfo.IsMember && app.globalData.userInfo.IsShow == 1){
- wx.navigateTo({
- url: '../other/payinfo',
- });
- }
- if (app.globalData.userInfo.IsMember && app.globalData.LessonID && app.globalData.LessonID>0) {
- wx.navigateTo({
- url: '../other/lesson?id=' + app.globalData.LessonID,
- });
- }
- that.setData({
- IsAccredit: true,
- });
- common.getStorageValue(that, "UserName", "秒过", function () {
- wx.setNavigationBarTitle({
- title: that.data.UserName
- });
- });
- that.init();
- that.getTaskTodayList();
- that.isNoSavedCard();
- }
- else {
- wx.navigateTo({
- url: '../index/accredit',
- });
- }
- }
- });
- },
- init:function(){
- //题卡主题色
- var arrColorIndex = wx.getStorageSync("ColorIndexArr");
- if (!arrColorIndex) {
- app.globalData.ColorIndex = common.random(1,4);
- }
- else {
- app.globalData.ColorIndex = arrColorIndex[common.random(0, arrColorIndex.length - 1)];
- }
- //显示答案操作方式
- var clickType = wx.getStorageSync("ClickType");
- if (!clickType)
- clickType = 0;
- app.globalData.ClickType=clickType;
- //选择建议
- var SecondConfigArray = wx.getStorageSync("SecondConfigArray");
- if (SecondConfigArray)
- app.globalData.SecondConfigArray = SecondConfigArray;
- },
- goto: function (e) {
- var url = e.currentTarget.dataset.url;
- wx.navigateTo({
- url: './' + url,
- })
- },
- //得到当天任务
- getTaskTodayList: function () {
- var that=this;
- main.getTaskTodayList(function(data){
- var TodayTaskNumber = data.ListNew.length + data.ListReview.length + data.ListHistory.length;
- that.setData({
- List: data,
- DayNumber: data.DayNumber,
- TodayTaskNumber: TodayTaskNumber,
- IsStart: data.IsStart,
- });
- });
- },
- gotoCard: function () {
- wx.redirectTo({
- url: './searchCard',
- })
- },
- isNoSavedCard:function(){
- var that=this;
- //判断是否有未保存的卡
- if (wx.getStorageSync("TempCardNoSaved")) {
- that.setData({
- IsTempCardNoSaved: true,
- });
- wx.setNavigationBarColor({
- frontColor: "#ffffff",
- backgroundColor: "#0B8457",
- })
- }
- else{
- that.setData({
- IsTempCardNoSaved: false,
- });
- wx.setNavigationBarColor({
- frontColor: "#ffffff",
- backgroundColor: "#3157BA",
- });
- }
- },
- onOpenTempCard:function(){
- var card = wx.getStorageSync("TempCardNoSaved");
- app.globalData.CardList=[card];
- wx.navigateTo({
- url: './add?type=add2&id='+card.MiaoguoCardID,
- });
- },
- onGiveupTempCard:function(){
- var that=this;
- wx.removeStorageSync("TempCardNoSaved");
- that.isNoSavedCard();
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|