| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- import constant from '../../utils/constant';
- const app = getApp();
- var DistrictName="";
- Page({
- data: {
- YearIndex:0,
- District:[],
- ListNullData:false,
- PublicOrPrivate2:constant.arrPublicOrPrivate2,
- PanelType:1,//1是自主招生,2是国际班
- },
- onLoad: function (options) {
- var that = this;
- var districtID=0;
- var title="自招·市重点和特高";
- if (Number(options.PanelType)==2){
- districtID=-1;
- title="自招·国际和中外合办";
- }
- else{
- districtID=Number(options.DistrictID);
- var arr=[{ID:0,Name:"委属",CSS:""}];
- for(var i=0;i<constant.arrDistrict.length;i++){
- var obj={};
- obj.ID=Number(constant.arrDistrict[i].ID);
- obj.Name=constant.arrDistrict[i].Name.substr(0,2);
- obj.CSS="";
- arr.push(obj);
- }
- arr[districtID].CSS="Selected";
- DistrictName=arr[districtID].Name;
- }
- that.setData({
- Containnerheight: main.getWindowHeight(),
- Years:app.globalData.userInfo.ArrYear,
- IsShow:app.globalData.userInfo.IsShow,
- District:arr,
- PanelType:options.PanelType,
- DistrictID:districtID,
- YearIndex:0,
- });
- wx.setNavigationBarTitle({
- title: title,
- });
- that.init();
- },
- init:function(){
- var that = this;
- var districtID=Number(that.data.DistrictID);
- var year=that.data.Years[that.data.YearIndex].Name;
- var scoreTypeID="自主招生";
- wx.showLoading();
- main.getData("GetMPSScore?ScoreYear="+year+"&ScoreType="+scoreTypeID+"&DistrictID="+districtID, function (data) {
- if (data) {
- for(var i=0;i<data.length;i++){
- var item=data[i];
- item.IsPublicOrPrivate=true;
- }
- for(var i=0;i<that.data.PublicOrPrivate2.length;i++){
- var item=that.data.PublicOrPrivate2[i];
- item.CSS="Selected";
- }
-
- that.setData({
- List:data,
- PublicOrPrivate2:that.data.PublicOrPrivate2,
- });
- }
- setTimeout(function(){
- wx.hideLoading();
- },800);
- });
- },
-
- onSelect:function(event){
- var that=this;
- main.onSelect(that,event,function(obj,e,result){
- if (e.currentTarget.dataset.object=="District"){
- that.setData({
- DistrictID:e.currentTarget.dataset.index,
- });
- that.init();
- }
- else if (e.currentTarget.dataset.object=="Years"){
- that.setData({
- YearIndex:e.currentTarget.dataset.index,
- });
- that.init();
- }
- else if (e.currentTarget.dataset.object=="PublicOrPrivate2"){
- var selectIndex=e.currentTarget.dataset.index;
- var selectText=that.data.PublicOrPrivate2[selectIndex].Name;
- var isSelect=that.data.PublicOrPrivate2[selectIndex].CSS=="Selected";
-
- var isNull=true;
- for(var i=0;i<that.data.List.length;i++){
- var item=that.data.List[i];
- if (selectText==item.PublicOrPrivate)
- item.IsPublicOrPrivate=isSelect;
-
- if (item.IsPublicOrPrivate)
- isNull=false;
- }
- that.setData({
- List:that.data.List,
- ListNullData:isNull,
- });
- }
- });
- },
- goto: function (e) {
- main.goto(e);
- },
- onShareTimeline: function () {
- return this.onShareAppMessage();
- },
- onShareAppMessage: function () {
- var that=this;
- var title="上海中招自主招生";
- if (that.data.DistrictID>=0)
- title="上海中招自主招生·"+DistrictName;
- return {
- title: title,
- path: app.globalData.SharePath + '?type=recruitment&PanelType='+that.data.PanelType+'&DistrictID='+that.data.DistrictID+'&UserID=' + app.globalData.userInfo.UserID,
- }
- },
- })
|