|
@@ -1,22 +1,22 @@
|
|
const app = getApp();
|
|
const app = getApp();
|
|
import WxValidate from '../../../utils/wxValidate';
|
|
import WxValidate from '../../../utils/wxValidate';
|
|
import QRCode from '../../../utils/weapp-qrcode.js';
|
|
import QRCode from '../../../utils/weapp-qrcode.js';
|
|
-
|
|
|
|
Page({
|
|
Page({
|
|
data: {
|
|
data: {
|
|
frameStyle: { useTop: true, name: '裁判信息', leftArrow: true, useBar: false },
|
|
frameStyle: { useTop: true, name: '裁判信息', leftArrow: true, useBar: false },
|
|
// 比赛系统用户
|
|
// 比赛系统用户
|
|
raceuser: {},
|
|
raceuser: {},
|
|
|
|
+ // 性别列表
|
|
|
|
+ genderList: [],
|
|
|
|
+ // 教练列表
|
|
|
|
+ coachList: [],
|
|
list: [],
|
|
list: [],
|
|
total: 0,
|
|
total: 0,
|
|
page: 0,
|
|
page: 0,
|
|
skip: 0,
|
|
skip: 0,
|
|
limit: 5,
|
|
limit: 5,
|
|
- genderList:[],
|
|
|
|
// 弹框
|
|
// 弹框
|
|
dialog: { title: '选择教练', show: false, type: '1' },
|
|
dialog: { title: '选择教练', show: false, type: '1' },
|
|
- // 教练列表
|
|
|
|
- coachList: [],
|
|
|
|
},
|
|
},
|
|
initValidate() {
|
|
initValidate() {
|
|
const rules = { coach_id: { required: true } }
|
|
const rules = { coach_id: { required: true } }
|
|
@@ -65,6 +65,7 @@ Page({
|
|
let data = that.data.coachList[e.detail.value];
|
|
let data = that.data.coachList[e.detail.value];
|
|
if (data) that.setData({ 'form.coach_id': data.coach_id, 'form.coach_id_name': data.coach_id_name })
|
|
if (data) that.setData({ 'form.coach_id': data.coach_id, 'form.coach_id_name': data.coach_id_name })
|
|
},
|
|
},
|
|
|
|
+ // 提交保存
|
|
onSubmit: async function (e) {
|
|
onSubmit: async function (e) {
|
|
const that = this;
|
|
const that = this;
|
|
let params = e.detail.value;
|
|
let params = e.detail.value;
|
|
@@ -86,6 +87,7 @@ Page({
|
|
that.makeQRCode();
|
|
that.makeQRCode();
|
|
that.setData({ dialog: { title: '账号绑定', show: true, type: '2' } })
|
|
that.setData({ dialog: { title: '账号绑定', show: true, type: '2' } })
|
|
},
|
|
},
|
|
|
|
+ // 生成二维码
|
|
makeQRCode(template = 0) {
|
|
makeQRCode(template = 0) {
|
|
const that = this;
|
|
const that = this;
|
|
const url = `${that.data.raceuser._id}&&2`;
|
|
const url = `${that.data.raceuser._id}&&2`;
|
|
@@ -102,11 +104,9 @@ Page({
|
|
// 关闭弹窗
|
|
// 关闭弹窗
|
|
toClose: function () {
|
|
toClose: function () {
|
|
const that = this;
|
|
const that = this;
|
|
- that.setData({ 'form.coach_id': '' })
|
|
|
|
- that.setData({ 'form.coach_id_name': '' })
|
|
|
|
|
|
+ that.setData({ 'form.coach_id': '', 'form.coach_id_name': '' })
|
|
that.setData({ dialog: { titl: '教练', show: false, type: '2' } })
|
|
that.setData({ dialog: { titl: '教练', show: false, type: '2' } })
|
|
},
|
|
},
|
|
-
|
|
|
|
// 分页
|
|
// 分页
|
|
toPage: function () {
|
|
toPage: function () {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -159,23 +159,24 @@ Page({
|
|
that.setData({ raceuser: res.data })
|
|
that.setData({ raceuser: res.data })
|
|
let arr;
|
|
let arr;
|
|
// 查询当前用户学校,学校id存比赛系统user中的_id,查询当前用户学校与教练的关系表
|
|
// 查询当前用户学校,学校id存比赛系统user中的_id,查询当前用户学校与教练的关系表
|
|
|
|
+ // 教练信息
|
|
arr = await app.$get(`/school`, { user_id: res.data.user_id._id })
|
|
arr = await app.$get(`/school`, { user_id: res.data.user_id._id })
|
|
if (arr.errcode == '0' && arr.total > 0) {
|
|
if (arr.errcode == '0' && arr.total > 0) {
|
|
let school = arr.data[0];
|
|
let school = arr.data[0];
|
|
that.setData({ 'form.parent_id': res.data._id })
|
|
that.setData({ 'form.parent_id': res.data._id })
|
|
const aee = await app.$get(`/rcs`, { school_id: school._id })
|
|
const aee = await app.$get(`/rcs`, { school_id: school._id })
|
|
- if (aee.errcode == '0') {
|
|
|
|
- that.setData({ coachList: aee.data })
|
|
|
|
- }
|
|
|
|
|
|
+ if (aee.errcode == '0') { that.setData({ coachList: aee.data }) }
|
|
}
|
|
}
|
|
|
|
+ // 裁判信息
|
|
let info = { skip: that.data.skip, limit: that.data.limit, parent_id: res.data._id, type: '2' };
|
|
let info = { skip: that.data.skip, limit: that.data.limit, parent_id: res.data._id, type: '2' };
|
|
const aee = await app.$get(`/user`, { ...info }, 'race')
|
|
const aee = await app.$get(`/user`, { ...info }, 'race')
|
|
if (aee.errcode == '0') {
|
|
if (aee.errcode == '0') {
|
|
- for (const val of aee.data) {
|
|
|
|
- let gender = that.data.genderList.find(i => i.value == val.user_id.gender);
|
|
|
|
|
|
+ let list = [...that.data.list, ...aee.data];
|
|
|
|
+ for (const val of list) {
|
|
|
|
+ let gender = that.data.genderList.find(i => i.value == val.user_id.gender);
|
|
if (gender) val.user_id.zhGender = gender.label;
|
|
if (gender) val.user_id.zhGender = gender.label;
|
|
}
|
|
}
|
|
- that.setData({ list: [...that.data.list, ...aee.data] })
|
|
|
|
|
|
+ that.setData({ list })
|
|
that.setData({ total: aee.total })
|
|
that.setData({ total: aee.total })
|
|
}
|
|
}
|
|
},
|
|
},
|