|
@@ -6,15 +6,26 @@ Page({
|
|
user: {},
|
|
user: {},
|
|
id: '',
|
|
id: '',
|
|
form: {},
|
|
form: {},
|
|
|
|
+
|
|
// 选中
|
|
// 选中
|
|
tabs: {
|
|
tabs: {
|
|
- active: '0',
|
|
|
|
|
|
+ active: '2',
|
|
menu: [
|
|
menu: [
|
|
{ title: '羽校信息', active: '0' },
|
|
{ title: '羽校信息', active: '0' },
|
|
{ title: '师资信息', active: '1' },
|
|
{ title: '师资信息', active: '1' },
|
|
{ title: '课程信息', active: '2' },
|
|
{ title: '课程信息', active: '2' },
|
|
]
|
|
]
|
|
},
|
|
},
|
|
|
|
+ // 教练信息
|
|
|
|
+ coachList: [],
|
|
|
|
+ // 分页
|
|
|
|
+ total: 0,
|
|
|
|
+ page: 0,
|
|
|
|
+ skip: 0,
|
|
|
|
+ limit: 5,
|
|
|
|
+ // 字典表
|
|
|
|
+ // 教练等级
|
|
|
|
+ levelList: []
|
|
},
|
|
},
|
|
// 跳转菜单
|
|
// 跳转菜单
|
|
back(e) {
|
|
back(e) {
|
|
@@ -26,6 +37,17 @@ Page({
|
|
let data = e.detail;
|
|
let data = e.detail;
|
|
that.setData({ 'tabs.active': data.active })
|
|
that.setData({ 'tabs.active': data.active })
|
|
},
|
|
},
|
|
|
|
+ // 图片预览
|
|
|
|
+ imgView: function (e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ const { item } = e.currentTarget.dataset;
|
|
|
|
+ if (item && item.length > 0) {
|
|
|
|
+ wx.previewImage({
|
|
|
|
+ current: '',
|
|
|
|
+ urls: [item[0].url]
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
//申请入学
|
|
//申请入学
|
|
toApply: function () {
|
|
toApply: function () {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -36,10 +58,10 @@ Page({
|
|
let user = that.data.user;
|
|
let user = that.data.user;
|
|
let form = that.data.form;
|
|
let form = that.data.form;
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
- var params = { student_id: user.info.id, school_id: form._id, time: moment().format('YYYY-MM-DD HH:mm:ss') };
|
|
|
|
|
|
+ var params = { school_id: form._id, student_id: user.info.id, time: moment().format('YYYY-MM-DD HH:mm:ss') };
|
|
let arr = await app.$post(`/safs`, params);
|
|
let arr = await app.$post(`/safs`, params);
|
|
- if (arr.errcode == '0') { wx.showToast({ title: `申请入学成功`, icon: 'success', duration: 2000 }); that.watchLogin(); }
|
|
|
|
- else wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
|
|
|
+ if (arr.errcode == '0') { wx.showToast({ title: `申请入学成功`, icon: 'success', duration: 2000 }); }
|
|
|
|
+ else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
} else if (res.cancel) { }
|
|
} else if (res.cancel) { }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -50,15 +72,31 @@ Page({
|
|
const { item } = e.currentTarget.dataset;
|
|
const { item } = e.currentTarget.dataset;
|
|
wx.navigateTo({ url: `/pages/stuAdmin/open/sign?id=${item._id}` })
|
|
wx.navigateTo({ url: `/pages/stuAdmin/open/sign?id=${item._id}` })
|
|
},
|
|
},
|
|
|
|
+ // 分页
|
|
|
|
+ toPage: function () {
|
|
|
|
+ const that = this;
|
|
|
|
+ let list = that.data.list;
|
|
|
|
+ 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.searchRcs();
|
|
|
|
+ wx.hideLoading()
|
|
|
|
+ } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
- onLoad: function (options) {
|
|
|
|
- console.log(options);
|
|
|
|
|
|
+ onLoad: async function (options) {
|
|
const that = this;
|
|
const that = this;
|
|
that.setData({ id: options.id || '62fc48778f740d555aa5035d' })
|
|
that.setData({ id: options.id || '62fc48778f740d555aa5035d' })
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ await that.searchOther();
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
- that.watchLogin();
|
|
|
|
|
|
+ await that.watchLogin();
|
|
},
|
|
},
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
watchLogin: async function () {
|
|
watchLogin: async function () {
|
|
@@ -66,17 +104,13 @@ Page({
|
|
wx.getStorage({
|
|
wx.getStorage({
|
|
key: 'user',
|
|
key: 'user',
|
|
success: async res => {
|
|
success: async res => {
|
|
- that.setData({ user: res.data })
|
|
|
|
if (that.data.id) {
|
|
if (that.data.id) {
|
|
- let arr;
|
|
|
|
// 学校信息
|
|
// 学校信息
|
|
- arr = await app.$get(`/school/${that.data.id}`)
|
|
|
|
- if (arr.errcode == '0') { that.setData({ form: arr.data }) }
|
|
|
|
- else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
|
- // 公开课
|
|
|
|
- arr = await app.$get(`/lesson`, { school_id: that.data.id });
|
|
|
|
- if (arr.errcode == '0') { that.setData({ openList: arr.data }) }
|
|
|
|
- else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
|
|
|
|
+ await that.searchSchool(that.data.id);
|
|
|
|
+ // 师资信息
|
|
|
|
+ await that.searchRcs(that.data.id);
|
|
|
|
+ // 课程信息
|
|
|
|
+ await that.searchLesson(that.data.id);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
fail: async res => {
|
|
fail: async res => {
|
|
@@ -84,6 +118,49 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 学校信息
|
|
|
|
+ searchSchool: async function (e) {
|
|
|
|
+ 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 () {
|
|
|
|
+ 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 })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 查询类型
|
|
|
|
+ searchLevel: function () {
|
|
|
|
+ const that = this;
|
|
|
|
+ let levelList = that.data.levelList;
|
|
|
|
+ let data = levelList.find(i => i.value == e);
|
|
|
|
+ if (data) return data.label;
|
|
|
|
+ else return '暂无'
|
|
|
|
+ },
|
|
|
|
+ // 查询课程信息
|
|
|
|
+ searchLesson: function () {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ searchOther: async function () {
|
|
|
|
+ const that = this;
|
|
|
|
+ let arr;
|
|
|
|
+ // 教练等级
|
|
|
|
+ arr = await app.$get(`/dict`, { code: 'coach_grade' })
|
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) {
|
|
|
|
+ let data = arr.data[0];
|
|
|
|
+ if (data.list && data.list.length > 0) that.setData({ levelList: data.list })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
*/
|