|
@@ -7,6 +7,9 @@ Page({
|
|
page: 0,
|
|
page: 0,
|
|
skip: 0,
|
|
skip: 0,
|
|
limit: 5,
|
|
limit: 5,
|
|
|
|
+ info: {},
|
|
|
|
+ info: {},
|
|
|
|
+ dialog: { title: '详细信息', show: false, type: '1' },
|
|
// 性别
|
|
// 性别
|
|
genderList: [],
|
|
genderList: [],
|
|
//运动等级
|
|
//运动等级
|
|
@@ -16,6 +19,13 @@ Page({
|
|
back(e) {
|
|
back(e) {
|
|
wx.navigateBack({ delta: 1 })
|
|
wx.navigateBack({ delta: 1 })
|
|
},
|
|
},
|
|
|
|
+ // 查看
|
|
|
|
+ toView: async function (e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ that.setData({ skip: 0, page: 0, list: [] })
|
|
|
|
+ const { item } = e.currentTarget.dataset;
|
|
|
|
+ wx.navigateTo({ url: `/pages/sthrcoach/info?id=${item.coach_id}` })
|
|
|
|
+ },
|
|
// 分页
|
|
// 分页
|
|
toPage: function () {
|
|
toPage: function () {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -36,21 +46,29 @@ Page({
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
},
|
|
},
|
|
|
|
+ /**
|
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
|
+ */
|
|
|
|
+ onReady: function () { },
|
|
|
|
+ /**
|
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
|
+ */
|
|
|
|
+ onShow: async function () {
|
|
|
|
+ const that = this;
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ await that.searchOther();
|
|
|
|
+ // 监听用户是否登录
|
|
|
|
+ await that.watchLogin();
|
|
|
|
+ },
|
|
searchOther: async function () {
|
|
searchOther: async function () {
|
|
const that = this;
|
|
const that = this;
|
|
let arr;
|
|
let arr;
|
|
// 性别
|
|
// 性别
|
|
arr = await app.$get(`/dict`, { code: 'gender' });
|
|
arr = await app.$get(`/dict`, { code: 'gender' });
|
|
- if (arr.errcode == '0' && arr.total > 0) {
|
|
|
|
- let list = arr.data[0].list;
|
|
|
|
- that.setData({ genderList: list })
|
|
|
|
- }
|
|
|
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) that.setData({ genderList: arr.data[0].list });
|
|
// 运动等级
|
|
// 运动等级
|
|
arr = await app.$get(`/dict`, { code: 'student_grade' });
|
|
arr = await app.$get(`/dict`, { code: 'student_grade' });
|
|
- if (arr.errcode == '0' && arr.total > 0) {
|
|
|
|
- let list = arr.data[0].list;
|
|
|
|
- that.setData({ levelList: list })
|
|
|
|
- }
|
|
|
|
|
|
+ if (arr.errcode == '0' && arr.total > 0) that.setData({ levelList: arr.data[0].list });
|
|
},
|
|
},
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
watchLogin: async function () {
|
|
watchLogin: async function () {
|
|
@@ -60,17 +78,15 @@ Page({
|
|
wx.getStorage({
|
|
wx.getStorage({
|
|
key: 'user',
|
|
key: 'user',
|
|
success: async res => {
|
|
success: async res => {
|
|
- let info = { skip: that.data.skip, limit: that.data.limit, student_id: res.data._id };
|
|
|
|
|
|
+ let info = { skip: that.data.skip, limit: that.data.limit, student_id: res.data.info.id };
|
|
let arr = await app.$get(`/rsc`, { ...info });
|
|
let arr = await app.$get(`/rsc`, { ...info });
|
|
if (arr.errcode == '0') {
|
|
if (arr.errcode == '0') {
|
|
- let list = [{ icon: [{ url: '/image/beijing.jpeg' }], id: '1', name: '教练名称', gender: '0', age: 22, phone: '12345678901', level: '0', honor: '荣誉' }]
|
|
|
|
- that.setData({ list: list })
|
|
|
|
for (const val of arr.data) {
|
|
for (const val of arr.data) {
|
|
- let level = levelList.find(i => i.value == val.level); if (level) val.zhLevel = level.label;
|
|
|
|
- let gender = genderList.find(i => i.value == val.gender); if (gender) val.zhGender = level.label;
|
|
|
|
|
|
+ let level = levelList.find(i => i.value == val.coach_id_level); if (level) val.zhLevel = level.label;
|
|
|
|
+ let gender = genderList.find(i => i.value == val.coach_id_gender); if (gender) val.zhGender = level.label;
|
|
}
|
|
}
|
|
- // that.setData({ list: [...that.data.list, ...arr.data] })
|
|
|
|
- // that.setData({ total: arr.total })
|
|
|
|
|
|
+ that.setData({ list: [...that.data.list, ...arr.data] })
|
|
|
|
+ that.setData({ total: arr.total })
|
|
} else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
} else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
|
|
},
|
|
},
|
|
fail: async res => {
|
|
fail: async res => {
|
|
@@ -78,18 +94,6 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- /**
|
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
|
- */
|
|
|
|
- onReady: function () { },
|
|
|
|
- /**
|
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
|
- */
|
|
|
|
- onShow: function () {
|
|
|
|
- const that = this;
|
|
|
|
- // 监听用户是否登录
|
|
|
|
- that.watchLogin();
|
|
|
|
- },
|
|
|
|
/**
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
*/
|