|
@@ -14,7 +14,7 @@ Page({
|
|
|
groupList: []
|
|
|
},
|
|
|
initValidate() {
|
|
|
- const rules = { name: { required: true }, type: { required: true }, match_id: { required: true }, group_id: { required: true }, age: { required: false }, gender: { required: false }, num: { required: false }, explain: { required: false } }
|
|
|
+ const rules = { name: { required: true }, type: { required: true }, match_id: { required: false }, group_id: { required: true }, age: { required: false }, gender: { required: false }, num: { required: false }, explain: { required: false } }
|
|
|
// 验证字段的提示信息,若不传则调用默认的信息
|
|
|
const messages = { name: { required: '项目名称' }, match_id: { required: '比赛赛事' }, group_id: { required: '赛事分组' }, type: { required: '项目类别' }, age: { required: '人数限制' }, gender: { required: '性别限制' }, num: { required: '人数限制' }, explain: { required: '说明' } };
|
|
|
this.WxValidate = new WxValidate(rules, messages)
|
|
@@ -91,6 +91,10 @@ Page({
|
|
|
// 监听用户是否登录
|
|
|
watchLogin: async function () {
|
|
|
const that = this;
|
|
|
+ let genderList = that.data.genderList;
|
|
|
+ let typeList = that.data.typeList;
|
|
|
+ let matchList = that.data.matchList;
|
|
|
+ let groupList = that.data.groupList;
|
|
|
wx.getStorage({
|
|
|
key: 'user',
|
|
|
success: async res => {
|
|
@@ -101,6 +105,12 @@ Page({
|
|
|
if (that.data.id) {
|
|
|
let arr = await app.$get(`/matchProject/${that.data.id}`, 'race');
|
|
|
if (arr.errcode == '0') {
|
|
|
+ // 比赛名称
|
|
|
+ let match = matchList.find(i => i._id == arr.data.match_id);
|
|
|
+ if (match) arr.data.match_name = match.name;
|
|
|
+ // 赛事组别
|
|
|
+ let group = groupList.find(i => i._id == arr.data.group_id);
|
|
|
+ if (group) arr.data.group_name = group.name;
|
|
|
// 项目类别
|
|
|
let type = typeList.find(i => i.value == arr.data.type);
|
|
|
if (type) arr.data.zhType = type.label;
|