122 lines
2.2 KiB
JavaScript
122 lines
2.2 KiB
JavaScript
![]() |
// subpackage/student/teach/teach.js
|
||
|
const { getTeachType, getHotVic ,getTeachList, vicBtn} = require("../../../utils/serve/user");
|
||
|
const tabService = require("../../../utils/tab-serve");
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
teachTypeList:[],
|
||
|
teachList:[],
|
||
|
hotList:[],
|
||
|
typeId:1,
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
async onLoad(options) {
|
||
|
this.getData()
|
||
|
},
|
||
|
|
||
|
async getData(){
|
||
|
const that = this
|
||
|
const res = await getHotVic()
|
||
|
const re = await getTeachType()
|
||
|
await that.getListt(re.data[0].id)
|
||
|
this.setData({
|
||
|
teachTypeList:re.data,
|
||
|
hotList:res.data,
|
||
|
typeId:re.data[0].id,
|
||
|
})
|
||
|
},
|
||
|
|
||
|
//获取教学视频列表
|
||
|
async getListt(idd){
|
||
|
const res = await getTeachList({
|
||
|
TaxonomyId:idd,
|
||
|
PageIndex:1,
|
||
|
PageSize:50
|
||
|
})
|
||
|
this.setData({
|
||
|
teachList:res.data.datas
|
||
|
})
|
||
|
},
|
||
|
|
||
|
//点击tab
|
||
|
changeTab(e){
|
||
|
this.setData({
|
||
|
typeId:e.currentTarget.id
|
||
|
})
|
||
|
this.getListt(e.currentTarget.id)
|
||
|
},
|
||
|
|
||
|
//点击视频
|
||
|
async vicTap(e){
|
||
|
console.log(e)
|
||
|
await vicBtn(Number(e.currentTarget.id))
|
||
|
},
|
||
|
|
||
|
//跳转场馆列表
|
||
|
goList(){
|
||
|
wx.navigateTo({
|
||
|
url: '/subpackage/teacher/room-list/room-list',
|
||
|
})
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow() {
|
||
|
tabService.updateIndex(this,1)
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
async onPullDownRefresh() {
|
||
|
console.log('下拉刷新')
|
||
|
await this.getData()
|
||
|
wx.showToast({
|
||
|
title: '刷新成功',
|
||
|
icon:'none'
|
||
|
})
|
||
|
wx.stopPullDownRefresh()
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage() {
|
||
|
|
||
|
}
|
||
|
})
|