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

const app = getApp();
5 years ago
const titleMap = ["实训项目", "实践课程","教学课堂"]
const typeMap = {
shixun:0,
path:1,
course:2
}
Page({
data: {
statusBarHeight: 24,
5 years ago
current: 0,
show: [1],
5 years ago
showSearch:1,
title:"实训项目",
5 years ago
list: [
5 years ago
{ text: "实训", type:"shixun"},
{ text: "课程", type:"path"},
//{ text: "课堂", type:"course"}
5 years ago
]
},
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 });
5 years ago
},
5 years ago
switch({current}){
let title = titleMap[current];
this.setData({ ['show[' + current + ']']: 1,current, title});
},
5 years ago
switchNav({ target: { dataset: { current } } }) {
5 years ago
this.switch({current});
5 years ago
},
switchTab({ detail: { current, source, value } }) {
if (source == "touch") {
5 years ago
this.switch({current});
5 years ago
}
},
onShareAppMessage: function () {
5 years ago
let {list, current} = this.data;
return app.shareApp({
path:"/"+this.route+"?type="+list[current].type
})
}
})