|
|
|
const app = getApp();
|
|
|
|
const typeMap = {
|
|
|
|
course: 0,
|
|
|
|
shixun: 1,
|
|
|
|
path: 2,
|
|
|
|
subject:2
|
|
|
|
}
|
|
|
|
const titleMap = {
|
|
|
|
course:"教学课堂",
|
|
|
|
shixun:"实训项目",
|
|
|
|
path:"实践课程"
|
|
|
|
}
|
|
|
|
Page({
|
|
|
|
data:{
|
|
|
|
statusBarHeight: 24,
|
|
|
|
current:0,
|
|
|
|
show:[1],
|
|
|
|
showSearch:0,
|
|
|
|
title:"我的教学课堂",
|
|
|
|
list:[
|
|
|
|
{text:"课堂", type:"course"},
|
|
|
|
{text:"实训", type:"shixun"},
|
|
|
|
{text:"课程", type:"path"}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
onLoad(options){
|
|
|
|
let { statusBarHeight=24 } = wx.getSystemInfoSync();
|
|
|
|
this.setData({ statusBarHeight });
|
|
|
|
if(options.type){
|
|
|
|
let current = typeMap[options.type]||0;
|
|
|
|
this.switch({current});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
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}}){
|
|
|
|
if(source=="touch"){
|
|
|
|
this.switch({current});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShareAppMessage(){
|
|
|
|
let {list, current} = this.data;
|
|
|
|
return app.shareApp({
|
|
|
|
imageUrl: global.config.attachDir + "944406",
|
|
|
|
path: "/"+this.route+"?type="+list[current].type
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|