You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
const app = getApp();
|
|
const titleMap = ["实训项目", "实践课程","教学课堂"]
|
|
const typeMap = {
|
|
shixun:0,
|
|
path:1,
|
|
course:2
|
|
}
|
|
Page({
|
|
data: {
|
|
statusBarHeight: 24,
|
|
current: 0,
|
|
show: [1],
|
|
showSearch:1,
|
|
title:"实训项目",
|
|
list: [
|
|
{ text: "实训", type:"shixun"},
|
|
{ text: "课程", type:"path"},
|
|
//{ text: "课堂", type:"course"}
|
|
]
|
|
},
|
|
enterSearch() {
|
|
let type = this.data.list[this.data.current].type || '';
|
|
app.navigateTo({ url: `{search}?type=${type}`});
|
|
},
|
|
onLoad: function (options) {
|
|
let { statusBarHeight=24 } = wx.getSystemInfoSync();
|
|
this.setData({ statusBarHeight });
|
|
},
|
|
switch({current}){
|
|
let title = titleMap[current];
|
|
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: function () {
|
|
let {list, current} = this.data;
|
|
return app.shareApp({
|
|
path:"/"+this.route+"?type="+list[current].type
|
|
})
|
|
}
|
|
}) |