// 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(); } })