|
@@ -1,14 +1,23 @@
|
|
const app = getApp();
|
|
const app = getApp();
|
|
|
|
+import WxValidate from '../../../utils/wxValidate';
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
frameStyle: { useTop: true, name: '裁判信息', leftArrow: true, useBar: false },
|
|
frameStyle: { useTop: true, name: '裁判信息', leftArrow: true, useBar: false },
|
|
- list: [
|
|
|
|
- { _id: '123456', name: '裁判信息', phone: '12345678901' },
|
|
|
|
- ],
|
|
|
|
|
|
+ list: [],
|
|
total: 0,
|
|
total: 0,
|
|
page: 0,
|
|
page: 0,
|
|
skip: 0,
|
|
skip: 0,
|
|
limit: 5,
|
|
limit: 5,
|
|
|
|
+ // 弹框
|
|
|
|
+ dialog: { title: '选择教练', show: false, type: '1' },
|
|
|
|
+ // 教练列表
|
|
|
|
+ coachList: [],
|
|
|
|
+ },
|
|
|
|
+ initValidate() {
|
|
|
|
+ const rules = { coach_id: { required: true } }
|
|
|
|
+ // 验证字段的提示信息,若不传则调用默认的信息
|
|
|
|
+ const messages = { coach_id: { required: '选择教练', } };
|
|
|
|
+ this.WxValidate = new WxValidate(rules, messages)
|
|
},
|
|
},
|
|
// 返回
|
|
// 返回
|
|
back: function () { wx.navigateBack({ delta: 1 }) },
|
|
back: function () { wx.navigateBack({ delta: 1 }) },
|
|
@@ -19,12 +28,6 @@ Page({
|
|
that.setData({ skip: 0, page: 0, list: [] })
|
|
that.setData({ skip: 0, page: 0, list: [] })
|
|
wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` });
|
|
wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` });
|
|
},
|
|
},
|
|
- // 账号绑定
|
|
|
|
- toBind: function (e) {
|
|
|
|
- const that = this;
|
|
|
|
- const { item } = e.currentTarget.dataset;
|
|
|
|
- console.log(item);
|
|
|
|
- },
|
|
|
|
// 信息删除
|
|
// 信息删除
|
|
toDel: async function (e) {
|
|
toDel: async function (e) {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -46,6 +49,21 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 选择教练
|
|
|
|
+ toBind: function () {
|
|
|
|
+ const that = this;
|
|
|
|
+ that.setData({ dialog: { titl: '选择教练', show: true, type: '1' } })
|
|
|
|
+ },
|
|
|
|
+ // 确认教练
|
|
|
|
+ coachChange: function (e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let data = that.data.coachList[e.detail.value];
|
|
|
|
+ if (data) that.setData({ 'form.caoch_id': data.coach_id, 'form.coach_id_name': data.coach_id_name, 'form.school_id': data.school_id })
|
|
|
|
+ },
|
|
|
|
+ // 添加裁判
|
|
|
|
+ toAdd: function () {
|
|
|
|
+ console.log('2');
|
|
|
|
+ },
|
|
// 分页
|
|
// 分页
|
|
toPage: function () {
|
|
toPage: function () {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -72,10 +90,20 @@ Page({
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
*/
|
|
- onShow: function () {
|
|
|
|
|
|
+ onShow: async function () {
|
|
const that = this;
|
|
const that = this;
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ await that.searchOther();
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
- that.watchLogin();
|
|
|
|
|
|
+ await that.watchLogin();
|
|
|
|
+ },
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ searchOther: async function () {
|
|
|
|
+ const that = this;
|
|
|
|
+ let arr;
|
|
|
|
+ // 查询教练列表
|
|
|
|
+ arr = await app.$get(`/rcs`)
|
|
|
|
+ if (arr.errcode == '0') { that.setData({ coachList: arr.data }) }
|
|
},
|
|
},
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
watchLogin: async function () {
|
|
watchLogin: async function () {
|