import common from '../../utils/util'; import main from '../../utils/main'; const app = getApp(); Page({ data: { Menu1Array:[{ID:0,Name:"语文",CSS:"Selected"},{ID:1,Name:"English",CSS:""}], Menu2Array1:[{ID:0,Name:"全部",CSS:"Selected"},{ID:1,Name:"小学",CSS:""},{ID:2,Name:"初中",CSS:""},{ID:3,Name:"高中",CSS:""},{ID:4,Name:"大学",CSS:""}], Menu2Array2:[{ID:0,Name:"全部",CSS:"Selected"},{ID:1,Name:"课本",CSS:""},{ID:2,Name:"课外拓展",CSS:""}], IsShowMenu:false, Menu2Name1:"学段", Menu2Name2:"类型", }, onPullDownRefresh: function () { wx.stopPullDownRefresh(); }, onLoad: function (options) { var that = this; that.setData({ Containnerheight: main.getWindowHeight(), ImagePath: app.globalData.uploadImageUrl, }); that.init(options); }, init:function(options){ var that=this; main.getData('GetMiaoguoTestLibrary', function (data) { if (data) { that.setData({ List:data, }); let index=0; if (options.Category=="English") index=1; that.setMenu({currentTarget:{dataset:{type:1,index:index}}}); that.filterList(); } }); }, setMenu:function(e){ let that=this; let index=e.currentTarget.dataset.index; let type1=e.currentTarget.dataset.type; let arr=[]; if (type1==1){ arr=that.data.Menu1Array; that.data.Menu2Name1="学段"; that.data.Menu2Name2="类型"; that.data.Menu2Array1[0].CSS="Selected"; for(let i=1;i0) that.data.Menu2Name1=arr[i].Name; else if (type1==3 && index>0) that.data.Menu2Name2=arr[i].Name; } } that.setData({ IsShowMenu:false, Menu1Array:that.data.Menu1Array, Menu2Array1:that.data.Menu2Array1, Menu2Array2:that.data.Menu2Array2, Menu2Name1:that.data.Menu2Name1, Menu2Name2:that.data.Menu2Name2, }); that.filterList(); }, filterList:function(e){ let that=this; let arr=this.data.List; let count=0; for(let i=0;i=0) arr[i].GradeSelected2=1; break; } } arr[i].GradeSelected3=0; for(let j=0;j