|
@@ -5,19 +5,21 @@ Page({
|
|
|
frameStyle: { useTop: true, name: '羽校信息', leftArrow: true, useBar: false },
|
|
|
user: {},
|
|
|
id: '',
|
|
|
- form: {},
|
|
|
-
|
|
|
// 选中
|
|
|
tabs: {
|
|
|
- active: '2',
|
|
|
+ active: '0',
|
|
|
menu: [
|
|
|
{ title: '羽校信息', active: '0' },
|
|
|
{ title: '师资信息', active: '1' },
|
|
|
{ title: '课程信息', active: '2' },
|
|
|
]
|
|
|
},
|
|
|
+ // 学校信息
|
|
|
+ form: {},
|
|
|
// 教练信息
|
|
|
coachList: [],
|
|
|
+ // 课程信息
|
|
|
+ lessonList: [],
|
|
|
// 分页
|
|
|
total: 0,
|
|
|
page: 0,
|
|
@@ -25,7 +27,11 @@ Page({
|
|
|
limit: 5,
|
|
|
// 字典表
|
|
|
// 教练等级
|
|
|
- levelList: []
|
|
|
+ levelList: [],
|
|
|
+ // 课程类型
|
|
|
+ typeList: [],
|
|
|
+ // 课程状态
|
|
|
+ statusList: [],
|
|
|
},
|
|
|
// 跳转菜单
|
|
|
back(e) {
|
|
@@ -66,11 +72,11 @@ Page({
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- //报名
|
|
|
- toSign: function (e) {
|
|
|
+ //课程报名
|
|
|
+ lessonView: function (e) {
|
|
|
const that = this;
|
|
|
const { item } = e.currentTarget.dataset;
|
|
|
- wx.navigateTo({ url: `/pages/stuAdmin/open/sign?id=${item._id}` })
|
|
|
+ wx.navigateTo({ url: `/pages/stuAdmin/course/sign?id=${item._id}` })
|
|
|
},
|
|
|
// 分页
|
|
|
toPage: function () {
|
|
@@ -83,7 +89,7 @@ Page({
|
|
|
that.setData({ page: page })
|
|
|
let skip = page * limit;
|
|
|
that.setData({ skip: skip })
|
|
|
- that.searchRcs();
|
|
|
+ that.watchLogin();
|
|
|
wx.hideLoading()
|
|
|
} else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
|
|
|
},
|
|
@@ -104,6 +110,7 @@ Page({
|
|
|
wx.getStorage({
|
|
|
key: 'user',
|
|
|
success: async res => {
|
|
|
+ that.setData({ user: res.data })
|
|
|
if (that.data.id) {
|
|
|
// 学校信息
|
|
|
await that.searchSchool(that.data.id);
|
|
@@ -120,26 +127,25 @@ Page({
|
|
|
},
|
|
|
// 学校信息
|
|
|
searchSchool: async function (e) {
|
|
|
+ const that = this;
|
|
|
const arr = await app.$get(`/school/${e}`)
|
|
|
if (arr.errcode == '0') { that.setData({ form: arr.data }) }
|
|
|
else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
},
|
|
|
// 师资信息
|
|
|
- searchRcs: async function () {
|
|
|
+ searchRcs: async function (e) {
|
|
|
const that = this;
|
|
|
- if (that.data.id) {
|
|
|
- let info = { skip: that.data.skip, limit: that.data.limit }
|
|
|
- const arr = await app.$get(`/rcs`, { school_id: that.data.id, ...info });
|
|
|
- if (arr.errcode == '0') {
|
|
|
- let list = [...that.data.coachList, ...arr.data];
|
|
|
- for (const val of list) { val.zhLevel = that.searchLevel(val.coach_id_level) }
|
|
|
- that.setData({ coachList: list });
|
|
|
- that.setData({ total: arr.total })
|
|
|
- }
|
|
|
+ let info = { skip: that.data.skip, limit: that.data.limit }
|
|
|
+ const arr = await app.$get(`/rcs`, { school_id: e, ...info });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ let list = [...that.data.coachList, ...arr.data];
|
|
|
+ for (const val of list) { val.zhLevel = that.searchLevel(val.coach_id_level) }
|
|
|
+ that.setData({ coachList: list });
|
|
|
+ that.setData({ total: arr.total })
|
|
|
}
|
|
|
},
|
|
|
// 查询类型
|
|
|
- searchLevel: function () {
|
|
|
+ searchLevel: function (e) {
|
|
|
const that = this;
|
|
|
let levelList = that.data.levelList;
|
|
|
let data = levelList.find(i => i.value == e);
|
|
@@ -147,8 +153,34 @@ Page({
|
|
|
else return '暂无'
|
|
|
},
|
|
|
// 查询课程信息
|
|
|
- searchLesson: function () {
|
|
|
+ searchLesson: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ let info = { skip: that.data.skip, limit: that.data.limit }
|
|
|
+ const arr = await app.$get(`/lesson`, { school_id: e, ...info });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ let list = [...that.data.lessonList, ...arr.data];
|
|
|
+ for (const val of list) {
|
|
|
+ val.zhType = that.searchType(val.type);
|
|
|
+ val.zhStatus = that.searchStatus(val.status);
|
|
|
+ }
|
|
|
+ that.setData({ lessonList: list });
|
|
|
+ that.setData({ total: arr.total })
|
|
|
|
|
|
+ }
|
|
|
+ },
|
|
|
+ searchType: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let typeList = that.data.typeList;
|
|
|
+ let data = typeList.find(i => i.value == e);
|
|
|
+ if (data) return data.label;
|
|
|
+ else return '暂无'
|
|
|
+ },
|
|
|
+ searchStatus: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let statusList = that.data.statusList;
|
|
|
+ let data = statusList.find(i => i.value == e);
|
|
|
+ if (data) return data.label;
|
|
|
+ else return '暂无'
|
|
|
},
|
|
|
// 查询其他信息
|
|
|
searchOther: async function () {
|
|
@@ -160,6 +192,18 @@ Page({
|
|
|
let data = arr.data[0];
|
|
|
if (data.list && data.list.length > 0) that.setData({ levelList: data.list })
|
|
|
}
|
|
|
+ // 课程类型
|
|
|
+ arr = await app.$get(`/dict`, { code: 'lesson_type' })
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) {
|
|
|
+ let data = arr.data[0];
|
|
|
+ if (data.list && data.list.length > 0) that.setData({ typeList: data.list })
|
|
|
+ }
|
|
|
+ // 课程状态
|
|
|
+ arr = await app.$get(`/dict`, { code: 'lesson_status' })
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) {
|
|
|
+ let data = arr.data[0];
|
|
|
+ if (data.list && data.list.length > 0) that.setData({ statusList: data.list })
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|