|
@@ -1,4 +1,5 @@
|
|
|
const app = getApp()
|
|
|
+const util = require('../../utils/util.js')
|
|
|
Page({
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
@@ -12,13 +13,16 @@ Page({
|
|
|
menu: [
|
|
|
{ title: '羽校信息', active: '0' },
|
|
|
{ title: '师资信息', active: '1' },
|
|
|
- { title: '课程信息', active: '2' },
|
|
|
+ { title: '学员信息', active: '2' },
|
|
|
+ { title: '课程信息', active: '3' },
|
|
|
]
|
|
|
},
|
|
|
// 学校详细信息
|
|
|
info: {},
|
|
|
- // 師資信息
|
|
|
+ // 师资信息
|
|
|
teacherList: [],
|
|
|
+ // 学员信息
|
|
|
+ studentList: [],
|
|
|
// 课程信息
|
|
|
lessonList: [],
|
|
|
// 分页
|
|
@@ -33,16 +37,27 @@ Page({
|
|
|
typeList: [],
|
|
|
// 课程状态
|
|
|
statusList: [],
|
|
|
+ //运动等级
|
|
|
+ stlevelList: [],
|
|
|
},
|
|
|
// 跳转菜单
|
|
|
back(e) {
|
|
|
wx.navigateBack({ delta: 1 })
|
|
|
},
|
|
|
+ // 清空列表
|
|
|
+ clearPage() {
|
|
|
+ const that = this;
|
|
|
+ that.setData({ teacherList: [], studentList: [], lessonList: [], skip: 0, limit: 6, page: 0 })
|
|
|
+ },
|
|
|
// 选项卡选择
|
|
|
tabsChange: function (e) {
|
|
|
const that = this;
|
|
|
let data = e.detail;
|
|
|
- that.setData({ 'tabs.active': data.active })
|
|
|
+ that.setData({ 'tabs.active': data.active });
|
|
|
+ if (data.active == '1' || data.active == '2' || data.active == '3') {
|
|
|
+ that.clearPage();
|
|
|
+ that.search();
|
|
|
+ }
|
|
|
},
|
|
|
// 公共跳转
|
|
|
toCommon(e) {
|
|
@@ -54,7 +69,7 @@ Page({
|
|
|
*/
|
|
|
onLoad: async function (options) {
|
|
|
const that = this;
|
|
|
- that.setData({ id: options.id || '630ddb17b5956e61e27b794a' });
|
|
|
+ that.setData({ id: options.id || '6355f251cb0f85380e83520b' });
|
|
|
await that.searchOther();
|
|
|
await that.search();
|
|
|
},
|
|
@@ -67,13 +82,15 @@ Page({
|
|
|
if (res.errcode == '0') { that.setData({ info: res.data }) }
|
|
|
else { wx.showToast({ title: res.errmsg, icon: 'none' }) }
|
|
|
// 查询师资信息
|
|
|
- that.searchTea();
|
|
|
+ that.searchCoach();
|
|
|
+ // 查询学员信息
|
|
|
+ that.searchStu();
|
|
|
// 查询课程信息
|
|
|
that.searchLess();
|
|
|
}
|
|
|
},
|
|
|
// 查询师资信息
|
|
|
- async searchTea() {
|
|
|
+ async searchCoach() {
|
|
|
const that = this;
|
|
|
let id = that.data.id;
|
|
|
let info = { skip: that.data.skip, limit: that.data.limit, school_id: id }
|
|
@@ -81,7 +98,10 @@ Page({
|
|
|
if (arr.errcode == '0') {
|
|
|
let list = [...that.data.teacherList, ...arr.data];
|
|
|
// 教练等级
|
|
|
- for (const val of list) { val.zhLevel = that.searchLevel(val.coach_id_level) }
|
|
|
+ for (const val of list) {
|
|
|
+ if (val.coach_id_phone) val.coach_id_phone = util.hidePhone(val.coach_id_phone);
|
|
|
+ val.zhLevel = that.searchLevel(val.coach_id_level)
|
|
|
+ }
|
|
|
that.setData({ teacherList: list });
|
|
|
that.setData({ total: arr.total })
|
|
|
}
|
|
@@ -94,6 +114,30 @@ Page({
|
|
|
if (data) return data.label;
|
|
|
else return '暂无'
|
|
|
},
|
|
|
+ // 查询学员信息
|
|
|
+ async searchStu() {
|
|
|
+ const that = this;
|
|
|
+ let id = that.data.id;
|
|
|
+ let info = { skip: that.data.skip, limit: that.data.limit, school_id: id }
|
|
|
+ const arr = await app.$get(`/rss`, { ...info });
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ let list = [...that.data.studentList, ...arr.data];
|
|
|
+ for (const val of list) {
|
|
|
+ if (val.student_id_phone) val.student_id_phone = util.hidePhone(val.student_id_phone);
|
|
|
+ val.student_id_zhlevel = that.searchstLevel(val.student_id_level)
|
|
|
+ }
|
|
|
+ that.setData({ studentList: list });
|
|
|
+ that.setData({ total: arr.total })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 运动等级
|
|
|
+ searchstLevel: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let stlevelList = that.data.stlevelList;
|
|
|
+ let data = stlevelList.find(i => i.value == e);
|
|
|
+ if (data) return data.label;
|
|
|
+ else return '暂无'
|
|
|
+ },
|
|
|
// 查询课程信息
|
|
|
async searchLess() {
|
|
|
const that = this;
|
|
@@ -126,6 +170,25 @@ Page({
|
|
|
if (data) return data.label;
|
|
|
else return '暂无'
|
|
|
},
|
|
|
+ // 分页
|
|
|
+ toPage: function () {
|
|
|
+ const that = this;
|
|
|
+ let active = that.data.tabs.active;
|
|
|
+ let list = [];
|
|
|
+ if (active == '1') list = that.data.teacherList;
|
|
|
+ else if (active == '2') list = that.data.studentList;
|
|
|
+ else if (active == '3') list = that.data.lessonList;
|
|
|
+ let limit = that.data.limit;
|
|
|
+ if (that.data.total > list.length) {
|
|
|
+ wx.showLoading({ title: '加载中', mask: true })
|
|
|
+ let page = that.data.page + 1;
|
|
|
+ that.setData({ page: page })
|
|
|
+ let skip = page * limit;
|
|
|
+ that.setData({ skip: skip })
|
|
|
+ that.search();
|
|
|
+ wx.hideLoading()
|
|
|
+ } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
|
|
|
+ },
|
|
|
// 查询其他信息
|
|
|
searchOther: async function () {
|
|
|
const that = this;
|
|
@@ -148,6 +211,12 @@ Page({
|
|
|
let data = arr.data[0];
|
|
|
if (data.list && data.list.length > 0) that.setData({ statusList: data.list })
|
|
|
}
|
|
|
+ // 运动等级
|
|
|
+ arr = await app.$get(`/dict`, { code: 'student_grade' });
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) {
|
|
|
+ let list = arr.data[0].list;
|
|
|
+ that.setData({ stlevelList: list })
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|