import common from '../../utils/util'; import main from '../../utils/main'; import constant from '../../utils/constant'; const app = getApp(); Page({ data: { ImagePath: app.globalData.uploadImageUrl, ArticleList:[], District:constant.arrDistrict, Version:app.globalData.Version, Years:constant.arrYear, YearIndex:0, HideAddProgram:1, }, adLoad() { console.log('原生模板广告加载成功') }, adError(err) { console.error('原生模板广告加载失败', err) }, adClose() { console.log('原生模板广告关闭') }, onLoad: function (options) { var that = this; that.setData({ Containnerheight: main.getWindowHeight(), IsShow:app.globalData.userInfo.IsShow, }); if (app.globalData.GotoUrl) { //console.log(app.globalData.GotoUrl); wx.navigateTo({ url: app.globalData.GotoUrl, }); app.globalData.GotoUrl = ""; } else{ //获得收藏学校数据 main.getCollect(); } that.getNotice(function(){ that.getPersonNum(function(){ that.getArticle(function(){ that.getWish(); }); }); }); var hideAddProgram=wx.getStorageSync('HideAddProgram'); if (!hideAddProgram){ wx.checkIsAddedToMyMiniProgram({ success:function(e){ console.log(e.added); that.setData({ HideAddProgram:e.added, }); } }) } var programList=main.getProgramList(); that.setData({ ProgramList:programList, }); }, onShow:function(){ this.getWish(); }, onHideAddProgram:function(){ wx.setStorageSync('HideAddProgram', 1); this.setData({ HideAddProgram:1, }); }, showMore:function(e){ var that = this; var id=e.currentTarget.dataset.id; if (id==1){ that.setData({ Page1:0, }); } else if (id==2){ that.setData({ Page2:0, }); } }, getPersonNum:function(callback){ var that = this; main.getData("GetMPSCityPersonNum", function (data) { if (data) { that.setData({ PersonNum: data, }); if (callback) callback(); } }); }, getWish:function(callback){ var that = this; main.getData("GetMPSWish?WishType=all", function (data) { if (data) { that.setData({ WishList: data, Page1:1, Page2:1, }); if (callback) callback(); } }); }, getNotice:function(callback){ var that = this; main.getData("GetMPSNotice", function (data) { if (data) { that.setData({ Notice: data, }); if (callback) callback(); } }); }, getArticle:function(callback){ var that = this; main.getData("GetMPSArticle", function (data) { if (data) { that.setData({ ArticleList: data, }); app.globalData.ArticleList=data; if (callback) callback(); } }); }, goto: function (e) { main.goto(e); }, onShareTimeline: function () { return this.onShareAppMessage(); }, gotoMiniprogram:function(e){ var appid=e.currentTarget.dataset.appid; var path=e.currentTarget.dataset.path; main.gotoMiniprogram(appid,path); }, onSelect:function(event){ var that=this; main.onSelect(that,event,function(obj,e,result){ if (e.currentTarget.dataset.object=="Years"){ that.setData({ YearIndex:e.currentTarget.dataset.index }); } }); }, onShareAppMessage: function () { return { title: "上海中考招生信息查询工具", path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID, imageUrl: app.globalData.ShareImage, } }, })