|
@@ -1,11 +1,62 @@
|
|
|
const app = getApp();
|
|
|
Page({
|
|
|
data: {
|
|
|
- frameStyle: { useTop: true, name: '基本页面', leftArrow: true, useBar: false },
|
|
|
+ frameStyle: { useTop: true, name: '赛组信息', leftArrow: true, useBar: false },
|
|
|
+ // 赛事列表
|
|
|
+ matchList: [],
|
|
|
+ // 组别列表
|
|
|
+ groupList: [],
|
|
|
+ // 组内项目列表
|
|
|
+ projectList: [],
|
|
|
+ // 人员列表
|
|
|
+ signList: [],
|
|
|
+ form: {}
|
|
|
},
|
|
|
// 返回
|
|
|
back: function () { wx.navigateBack({ delta: 1 }) },
|
|
|
-
|
|
|
+ // 选择赛事
|
|
|
+ matchChange: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.data.matchList[e.detail.value];
|
|
|
+ if (data) {
|
|
|
+ that.setData({
|
|
|
+ 'form.match_id': data._id, 'form.zhMatch': data.name,
|
|
|
+ 'form.group_id': '', 'form.group_name': '', 'form.project_id': '', 'form.project_name': ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ that.watchLogin();
|
|
|
+ },
|
|
|
+ // 选择组别
|
|
|
+ groupChange: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.data.groupList[e.detail.value];
|
|
|
+ if (data) {
|
|
|
+ that.setData({ 'form.group_id': data._id, 'form.group_name': data.name, 'form.project_id': '', 'form.project_name': '' })
|
|
|
+ }
|
|
|
+ that.watchLogin();
|
|
|
+ },
|
|
|
+ // 选择组内项目
|
|
|
+ projectChange: function (e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.data.projectList[e.detail.value];
|
|
|
+ if (data) {
|
|
|
+ that.setData({ 'form.project_id': data._id, 'form.project_name': data.name, 'form.person_type': data.type })
|
|
|
+ }
|
|
|
+ that.searchUser();
|
|
|
+ },
|
|
|
+ searchUser: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ const form = that.data.form;
|
|
|
+ const arr = await app.$get(`/matchSign`, { match_id: form.match_id, group_id: form.group_id, project_id: form.project_id, pay_status: '1' }, 'race');
|
|
|
+ if (arr.errcode == '0') that.setData({ signList: arr.data });
|
|
|
+ },
|
|
|
+ signChange:function (e) {
|
|
|
+
|
|
|
+ },
|
|
|
+ onSubmit: function (e) {
|
|
|
+ let params = e.detail.value
|
|
|
+ console.log(params);
|
|
|
+ },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
@@ -17,17 +68,41 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
- onShow: function () {
|
|
|
+ onShow: async function () {
|
|
|
const that = this;
|
|
|
+ // 查询其他信息
|
|
|
+ // await that.searchOther();
|
|
|
// 监听用户是否登录
|
|
|
- that.watchLogin();
|
|
|
+ await that.watchLogin();
|
|
|
},
|
|
|
+ // searchOther: async function () {
|
|
|
+ // const that = this;
|
|
|
+ // let arr;
|
|
|
+ // arr = await app.$get(`/match`, {}, 'race');
|
|
|
+ // if (arr.errcode == '0') that.setData({ matchList: arr.data })
|
|
|
+ // },
|
|
|
// 监听用户是否登录
|
|
|
watchLogin: async function () {
|
|
|
const that = this;
|
|
|
wx.getStorage({
|
|
|
key: 'raceuser',
|
|
|
- success: async res => { },
|
|
|
+ success: async res => {
|
|
|
+ let arr;
|
|
|
+ // 赛事
|
|
|
+ const match = await app.$get(`/match`, { belong_id: res.data._id }, 'race');
|
|
|
+ if (match.errcode == '0') that.setData({ matchList: match.data });
|
|
|
+ // 已选赛事下的赛事组别
|
|
|
+ if (that.data.form.match_id) {
|
|
|
+ const group = await app.$get(`/matchGroup`, { match_id: that.data.form.match_id }, 'race');
|
|
|
+ if (group.errcode == '0') that.setData({ groupList: group.data });
|
|
|
+ }
|
|
|
+ // 已选赛事组别下的组别项目
|
|
|
+ if (that.data.form.group_id) {
|
|
|
+ const project = await app.$get(`/matchProject`, { group_id: that.data.form.group_id }, 'race');
|
|
|
+ if (project.errcode == '0') that.setData({ projectList: project.data });
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
fail: async res => {
|
|
|
wx.redirectTo({ url: '/pages/index/index' })
|
|
|
}
|