|
|
|
const app = getApp();
|
|
|
|
const typeMap = {
|
|
|
|
course: 0,
|
|
|
|
shixun: 1,
|
|
|
|
path: 2,
|
|
|
|
subject:2
|
|
|
|
}
|
|
|
|
const titleMap = {
|
|
|
|
course:"教学课堂",
|
|
|
|
shixun:"实训项目",
|
|
|
|
path:"实践课程"
|
|
|
|
}
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data:{
|
|
|
|
statusBarHeight:20,
|
|
|
|
current:0,
|
|
|
|
show:[1],
|
|
|
|
showSearch:0,
|
|
|
|
title:"我的教学课堂",
|
|
|
|
list:[
|
|
|
|
{text:"课堂", type:"course"},
|
|
|
|
{text:"实训", type:"shixun"},
|
|
|
|
{text:"课程", type:"path"}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
onLoad(options){
|
|
|
|
if(options.type){
|
|
|
|
let current = typeMap[options.type]||0;
|
|
|
|
this.switch({current});
|
|
|
|
}
|
|
|
|
wx.getSystemInfo({
|
|
|
|
success: res=>{
|
|
|
|
let {statusBarHeight} = res;
|
|
|
|
this.setData({statusBarHeight});
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
|
|
|
enterSearch(){
|
|
|
|
let type = this.data.list[this.data.current].type||'';
|
|
|
|
app.navigateTo({url:`{search}?type=${type}`});
|
|
|
|
},
|
|
|
|
switch({current}){
|
|
|
|
let title = "我的"+titleMap[this.data.list[current].type];
|
|
|
|
this.setData({['show['+current+']']:1, current, title})
|
|
|
|
},
|
|
|
|
switchNav({target:{dataset:{current}}}){
|
|
|
|
this.switch({current});
|
|
|
|
},
|
|
|
|
switchTab({detail:{current, source, value}}){
|
|
|
|
//console.log(current, source, value);
|
|
|
|
if(source=="touch"){
|
|
|
|
this.switch({current});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShareAppMessage(){
|
|
|
|
let {list, current} = this.data;
|
|
|
|
return app.showApp({
|
|
|
|
path: "/"+this.route+"?type="+list[current].type
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|