| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- import constant from '../../utils/constant';
- const app = getApp();
- Page({
- data: {
- IsIPhoneX:app.globalData.IsIPhoneX,
- ImagePath: app.globalData.uploadImageUrl,
- ArticleList:[],
- District:constant.arrDistrict,
- Version:app.globalData.Version,
- YearIndex:0,
- HideAddProgram:1,
- },
- onLoad: function (options) {
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- IsShow:app.globalData.userInfo.IsShow,
- Years:app.globalData.userInfo.ArrYear,
- });
- 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) {
- //debugger;
- 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 || "wx80059777521b897c";
- var path=e.currentTarget.dataset.path || "pages/index/index?SourceID="+app.globalData.ProgramID;
-
- 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
- });
- }
- });
- },
- gotoRedirectTo: function (e) {
- let that=this;
- var url=e.currentTarget.dataset.url;
- wx.redirectTo({
- url: url,
- });
- },
- onShareAppMessage: function () {
- return {
- title: "上海中考招生信息查询工具",
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|