123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- // pages/teacher/index/index.ts
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- tabJson: [{ icon: "../../image/teacher/monitor.png", selectedIcon: "../../image/teacher/monitor_selected.png", title: "监控" },
- { icon: "../../image/teacher/file.png", selectedIcon: "../../image/teacher/file_selected.png", title: "文件库" },
- { icon: "../../image/teacher/fault.png", selectedIcon: "../../image/teacher/fault_selected.png", title: "报修" },
- { icon: "../../image/teacher/my.png", selectedIcon: "../../image/teacher/my_selected.png", title: "我的" }
- ],
- currPageIndex: 0,
- canChangeIndex: true
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad() {
- console.log(this.data.tabJson)
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- //禁止用户手滑选项卡
- catchTouchMove: function () {
- },
- //是否能切换index
- canChangeIndex: function (event: any) {
- this.setData({
- canChangeIndex: event.detail.canChange
- })
- },
- //选项卡滑动
- selectItemIndex: function (event: any) {
- console.log("click selected", event.detail.selectIndex)
- let titleName = "";
- switch (Number(event.detail.selectIndex)) {
- case 0:
- titleName = "开始上课"
- break;
- case 1:
- titleName = "文件库"
- break;
- case 2:
- titleName = "故障报修"
- break;
- case 3:
- titleName = "我的"
- break;
- }
- wx.setNavigationBarTitle({
- title: titleName
- })
- this.setData({
- currPageIndex: Number(event.detail.selectIndex)
- })
- },
- showWindow: function (event: any) {
- console.log("clickId:", event.detail.item)
- let window = this.selectComponent("#popupwindow")
- window.showModal(event.detail.item, 0);
- },
- hideWindow: function () {
- this.selectComponent("#teacherFile").hideWindow();
- },
- fileDel: function () {
- console.log("有文件被删除了")
- this.selectComponent("#teacherFile").realod();
- }
- })
|