zs %!s(int64=2) %!d(string=hai) anos
pai
achega
7e9d983924

+ 18 - 5
pagesMatch/matchAdmin/group/add.js

@@ -4,17 +4,28 @@ Page({
     data: {
     data: {
         frameStyle: { useTop: true, name: '信息维护', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '信息维护', leftArrow: true, useBar: false },
         form: {},
         form: {},
+        //比赛列表
+        matchList: []
     },
     },
     initValidate() {
     initValidate() {
-        const rules = { name: { required: true }, age: { required: false }, explain: { required: false } }
+        const rules = { name: { required: true }, age: { required: false }, explain: { required: false }, match_name: { required: true } }
         // 验证字段的提示信息,若不传则调用默认的信息
         // 验证字段的提示信息,若不传则调用默认的信息
-        const messages = { name: { required: '未输入名称' }, age: { required: '未输入年龄限制' }, explain: { required: '未输入说明' } };
+        const messages = { name: { required: '未输入名称' }, age: { required: '未输入年龄限制' }, explain: { required: '未输入说明' }, match_name: { required: '未选择比赛名称' } };
         this.WxValidate = new WxValidate(rules, messages)
         this.WxValidate = new WxValidate(rules, messages)
     },
     },
     // 返回
     // 返回
     back: function () {
     back: function () {
         wx.navigateBack({ delta: 1 })
         wx.navigateBack({ delta: 1 })
     },
     },
+    // 比赛名称
+    matchChange: function (e) {
+        const that = this;
+        let data = that.data.matchList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.match_id': data._id })
+            that.setData({ 'form.match_name': data.name })
+        }
+    },
     //提交
     //提交
     onSubmit: async function (e) {
     onSubmit: async function (e) {
         const that = this;
         const that = this;
@@ -25,8 +36,8 @@ Page({
             return false
             return false
         } else {
         } else {
             let arr;
             let arr;
-            if (params._id) { arr = await app.$post(`/matchGroup/${params._id}`, params) }
-            else { arr = await app.$post(`/matchGroup`, params) }
+            if (params._id) { arr = await app.$post(`/matchGroup/${params._id}`, params, 'race') }
+            else { arr = await app.$post(`/matchGroup`, params, 'race') }
             if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
             if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
         }
         }
@@ -48,8 +59,10 @@ Page({
         wx.getStorage({
         wx.getStorage({
             key: 'user',
             key: 'user',
             success: async res => {
             success: async res => {
+                let match = await app.$get(`/match`, {}, 'race');
+                if (match.arrcode == '0') that.setData({ matchList: match.data })
                 if (that.data.id) {
                 if (that.data.id) {
-                    let arr = await app.$get(`/matchGroup/${that.data.id}`);
+                    let arr = await app.$get(`/matchGroup/${that.data.id}`, {}, 'race');
                     if (arr.errcode == '0') {
                     if (arr.errcode == '0') {
                         that.setData({ form: arr.data })
                         that.setData({ form: arr.data })
                     }
                     }

+ 8 - 0
pagesMatch/matchAdmin/group/add.wxml

@@ -14,6 +14,14 @@
                         <input type="text" name="match_id" value="{{form.match_id}}" placeholder="请输入赛事id" />
                         <input type="text" name="match_id" value="{{form.match_id}}" placeholder="请输入赛事id" />
                     </view>
                     </view>
                 </view>
                 </view>
+                <view class="content">
+                    <view class="label">比赛名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="matchChange" name="match_name" value="{{form.match_name}}" range="{{matchList}}" range-key="name">
+                            <view class="picker">{{form.match_name||'请选择比赛名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
                 <view class="content">
                 <view class="content">
                     <view class="label">名称:</view>
                     <view class="label">名称:</view>
                     <view class="value">
                     <view class="value">

+ 2 - 2
pagesMatch/matchAdmin/group/list.js

@@ -26,7 +26,7 @@ Page({
             content: '是否确认删除该条数据?',
             content: '是否确认删除该条数据?',
             async success(res) {
             async success(res) {
                 if (res.confirm) {
                 if (res.confirm) {
-                    const arr = await app.$delete(`/matchGroup/${item._id}`);
+                    const arr = await app.$delete(`/matchGroup/${item._id}`, {}, 'race');
                     if (arr.errcode == '0') {
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
                         that.watchLogin()
                         that.watchLogin()
@@ -75,7 +75,7 @@ Page({
             key: 'user',
             key: 'user',
             success: async res => {
             success: async res => {
                 let info = { skip: that.data.skip, limit: that.data.limit };
                 let info = { skip: that.data.skip, limit: that.data.limit };
-                let arr = await app.$get(`/matchGroup`, { ...info });
+                let arr = await app.$get(`/matchGroup`, { ...info }, 'race');
                 if (arr.errcode == '0') {
                 if (arr.errcode == '0') {
                     that.setData({ list: [...that.data.list, ...arr.data] })
                     that.setData({ list: [...that.data.list, ...arr.data] })
                     that.setData({ total: arr.total })
                     that.setData({ total: arr.total })

+ 34 - 6
pagesMatch/matchAdmin/project/add.js

@@ -4,13 +4,19 @@ Page({
     data: {
     data: {
         frameStyle: { useTop: true, name: '信息维护', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '信息维护', leftArrow: true, useBar: false },
         form: {},
         form: {},
+        //项目类别
         typeList: [],
         typeList: [],
-        genderList: []
+        //性别
+        genderList: [],
+        // 比赛
+        matchList: [],
+        // 赛事分组
+        groupList: []
     },
     },
     initValidate() {
     initValidate() {
-        const rules = { name: { required: true }, type: { required: true }, age: { required: false }, gender: { required: false }, num: { required: false }, explain: { required: false } }
+        const rules = { name: { required: true }, type: { required: true }, match_name: { required: true }, group_name: { required: true }, age: { required: false }, gender: { required: false }, num: { required: false }, explain: { required: false } }
         // 验证字段的提示信息,若不传则调用默认的信息
         // 验证字段的提示信息,若不传则调用默认的信息
-        const messages = { name: { required: '未输入名称' }, type: { required: '未选择项目类别' }, age: { required: '未输入人数限制' }, gender: { required: '未选择性别限制' }, num: { required: '未输入人数限制' }, explain: { required: '未输入说明' } };
+        const messages = { name: { required: '未输入名称' }, match_name: { required: '未选择比赛赛事' }, group_name: { required: '未选择赛事分组' }, type: { required: '未选择项目类别' }, age: { required: '未输入人数限制' }, gender: { required: '未选择性别限制' }, num: { required: '未输入人数限制' }, explain: { required: '未输入说明' } };
         this.WxValidate = new WxValidate(rules, messages)
         this.WxValidate = new WxValidate(rules, messages)
     },
     },
     // 返回
     // 返回
@@ -35,6 +41,24 @@ Page({
             that.setData({ 'form.zhType': data.label })
             that.setData({ 'form.zhType': data.label })
         }
         }
     },
     },
+    // 比赛名称
+    matchChange: function (e) {
+        const that = this;
+        let data = that.data.matchList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.match_id': data._id })
+            that.setData({ 'form.match_name': data.name })
+        }
+    },
+    // 赛事分组
+    groupChange: function (e) {
+        const that = this;
+        let data = that.data.groupList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.group_id': data._id })
+            that.setData({ 'form.group_name': data.name })
+        }
+    },
     //提交
     //提交
     onSubmit: async function (e) {
     onSubmit: async function (e) {
         const that = this;
         const that = this;
@@ -45,8 +69,8 @@ Page({
             return false
             return false
         } else {
         } else {
             let arr;
             let arr;
-            if (params._id) { arr = await app.$post(`/matchProject/${params._id}`, params) }
-            else { arr = await app.$post(`/matchProject`, params) }
+            if (params._id) { arr = await app.$post(`/matchProject/${params._id}`, params, 'race') }
+            else { arr = await app.$post(`/matchProject`, params, 'race') }
             if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
             if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
         }
         }
@@ -70,8 +94,12 @@ Page({
         wx.getStorage({
         wx.getStorage({
             key: 'user',
             key: 'user',
             success: async res => {
             success: async res => {
+                let match = await app.$get(`/match`, {}, 'race');
+                if (match.errcode == '0') that.setData({ matchList: match.data })
+                let group = await app.$get(`/matchGroup`, {}, 'race');
+                if (group.errcode == '0') that.setData({ groupList: group.data })
                 if (that.data.id) {
                 if (that.data.id) {
-                    let arr = await app.$get(`/matchProject/${that.data.id}`);
+                    let arr = await app.$get(`/matchProject/${that.data.id}`, 'race');
                     if (arr.errcode == '0') {
                     if (arr.errcode == '0') {
                         // 项目类别
                         // 项目类别
                         let type = typeList.find(i => i.value == arr.data.type);
                         let type = typeList.find(i => i.value == arr.data.type);

+ 16 - 0
pagesMatch/matchAdmin/project/add.wxml

@@ -20,6 +20,22 @@
                         <input type="text" name="group_id" value="{{form.group_id}}" placeholder="请输入赛事分组id" />
                         <input type="text" name="group_id" value="{{form.group_id}}" placeholder="请输入赛事分组id" />
                     </view>
                     </view>
                 </view>
                 </view>
+                <view class="content">
+                    <view class="label">比赛名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="matchChange" name="match_name" value="{{form.match_name}}" range="{{matchList}}" range-key="name">
+                            <view class="picker">{{form.match_name||'请选择比赛名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">赛事分组:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="groupChange" name="group_name" value="{{form.group_name}}" range="{{groupList}}" range-key="name">
+                            <view class="picker">{{form.group_name||'请选择赛事分组'}}</view>
+                        </picker>
+                    </view>
+                </view>
                 <view class="content">
                 <view class="content">
                     <view class="label">名称:</view>
                     <view class="label">名称:</view>
                     <view class="value">
                     <view class="value">

+ 2 - 2
pagesMatch/matchAdmin/project/list.js

@@ -30,7 +30,7 @@ Page({
             content: '是否确认删除该条数据?',
             content: '是否确认删除该条数据?',
             async success(res) {
             async success(res) {
                 if (res.confirm) {
                 if (res.confirm) {
-                    const arr = await app.$delete(`/matchProject/${item._id}`);
+                    const arr = await app.$delete(`/matchProject/${item._id}`, 'race');
                     if (arr.errcode == '0') {
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
                         that.watchLogin()
                         that.watchLogin()
@@ -93,7 +93,7 @@ Page({
             key: 'user',
             key: 'user',
             success: async res => {
             success: async res => {
                 let info = { skip: that.data.skip, limit: that.data.limit };
                 let info = { skip: that.data.skip, limit: that.data.limit };
-                let arr = await app.$get(`/matchProject`, { ...info });
+                let arr = await app.$get(`/matchProject`, { ...info }, 'race');
                 if (arr.errcode == '0') {
                 if (arr.errcode == '0') {
                     for (const val of arr.data) {
                     for (const val of arr.data) {
                         let type = typeList.find(i => i.value == val.type); if (type) val.zhType = type.label;
                         let type = typeList.find(i => i.value == val.type); if (type) val.zhType = type.label;

+ 4 - 5
utils/httpUtil.js

@@ -2,7 +2,6 @@ let serverUrl = "https://broadcast.waityou24.cn";//http://120.48.146.1    https:
 let wechatUrl = 'https://broadcast.waityou24.cn';
 let wechatUrl = 'https://broadcast.waityou24.cn';
 
 
 const getDomain = (uri, type) => {
 const getDomain = (uri, type) => {
-
     if (uri.startsWith('/wechat/api')) return wechatUrl;
     if (uri.startsWith('/wechat/api')) return wechatUrl;
     else if (type) return serverUrl + `/newCourt/${type}/v2/api`;
     else if (type) return serverUrl + `/newCourt/${type}/v2/api`;
     return serverUrl + '/newCourt/v2/api';
     return serverUrl + '/newCourt/v2/api';
@@ -22,9 +21,9 @@ const $get = (uri, data, type) => {
         });
         });
     });
     });
 };
 };
-const $post = (uri, data) => {
+const $post = (uri, data, type) => {
     let app = getApp();
     let app = getApp();
-    let baseUrl = getDomain(uri);
+    let baseUrl = getDomain(uri, type);
     return new Promise((resolve, reject) => {
     return new Promise((resolve, reject) => {
         wx.request({
         wx.request({
             url: `${baseUrl}${uri}`,
             url: `${baseUrl}${uri}`,
@@ -36,9 +35,9 @@ const $post = (uri, data) => {
         });
         });
     });
     });
 };
 };
-const $delete = (uri, data) => {
+const $delete = (uri, data, type) => {
     let app = getApp();
     let app = getApp();
-    let baseUrl = getDomain(uri);
+    let baseUrl = getDomain(uri, type);
     return new Promise((resolve, reject) => {
     return new Promise((resolve, reject) => {
         wx.request({
         wx.request({
             url: `${baseUrl}${uri}`,
             url: `${baseUrl}${uri}`,