Selaa lähdekoodia

小組賽 淘汰赛

zs 2 vuotta sitten
vanhempi
commit
2279e5cfb5

+ 63 - 15
pagesMatch/refereeAdmin/mtschedule/list.js

@@ -5,6 +5,12 @@ Page({
         frameStyle: { useTop: true, name: '小组赛管理', leftArrow: true, useBar: false },
         dialog: { title: '赛程上分', show: false, type: '1' },
         form: {},
+        // 赛事列表
+        matchList: [],
+        // 组别列表
+        groupList: [],
+        // 组内项目列表
+        projectList: [],
         list: [],
         total: 0,
         page: 0,
@@ -27,6 +33,11 @@ Page({
         that.setData({ skip: 0, page: 0, list: [] });
         wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` })
     },
+    // 选择赛事
+    toAdd: function (e) {
+        const that = this;
+        that.setData({ dialog: { title: '选择赛事', show: true, type: '2' } })
+    },
     // 赛程上分
     toScore: function (e) {
         const that = this;
@@ -34,6 +45,40 @@ Page({
         that.setData({ form: item })
         that.setData({ dialog: { title: '赛程上分', show: true, type: '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.match_name': data.name, });
+            const group = await app.$get(`/matchGroup`, { match_id: data._id }, 'race');
+            if (group.errcode == '0') that.setData({ groupList: group.data });
+        }
+    },
+    // 选择组别
+    groupChange: async 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 });
+            const arr = await app.$get(`/matchProject`, { match_id: data.match_id, group_id: data._id }, 'race');
+            if (arr.errcode == '0') { that.setData({ projectList: arr.data }) }
+        }
+    },
+    // 选择项目
+    projectChange: async 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 });
+        }
+    },
+    toSubmit: function (e) {
+        const that = this
+        const params = e.detail.value;
+        if (params) { that.setData({ skip: 0, page: 0, list: [] }); that.toClose(); that.watchLogin(); }
+        else { wx.showToast({ title: '请选择数据', icon: 'error', duration: 2000 }) }
+    },
     // 提交保存
     onSubmit: async function (e) {
         const that = this;
@@ -47,9 +92,9 @@ Page({
             let arr = await app.$post(`/msgs/${form.id}`, params, 'race');
             if (arr.errcode == '0') {
                 wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
+                that.setData({ skip: 0, page: 0, list: [], form: {} })
+                that.watchLogin();
                 that.toClose();
-                that.setData({ skip: 0, page: 0, list: [] })
-                that.watchLogin()
             }
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
         }
@@ -92,8 +137,6 @@ Page({
     // 关闭弹框
     toClose: function () {
         const that = this;
-        that.setData({ skip: 0, page: 0, list: [], form: {} })
-        that.watchLogin();
         that.setData({ dialog: { title: '赛程上分', show: false, type: '1' } })
     },
     /**
@@ -125,20 +168,25 @@ Page({
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
+        let form = that.data.form;
         wx.getStorage({
             key: 'raceuser',
             success: async res => {
-                let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data._id };
-                let arr = await app.$get(`/msgs`, { ...info }, 'race');
-                if (arr.errcode == '0') {
-                    let list = [...that.data.list, ...arr.data]
-                    for (const val of list) {
-                        let status = that.data.statusList.find(i => i.value == val.status)
-                        if (status) val.zhStatus = status.label;
-                    }
-                    that.setData({ list })
-                    that.setData({ total: arr.total })
-                } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+                let match = await app.$get(`/match`, {}, 'race');
+                if (match.errcode == '0') { that.setData({ matchList: match.data }) }
+                if (form.group_id && form.match_id && form.project_id) {
+                    let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data._id, group_id: form.group_id, match_id: form.match_id, project_id: form.project_id }
+                    let arr = await app.$get(`/msgs`, { ...info }, 'race');
+                    if (arr.errcode == '0') {
+                        let list = [...that.data.list, ...arr.data]
+                        for (const val of list) {
+                            let status = that.data.statusList.find(i => i.value == val.status)
+                            if (status) val.zhStatus = status.label;
+                        }
+                        that.setData({ list })
+                        that.setData({ total: arr.total })
+                    } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+                }
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })

+ 28 - 4
pagesMatch/refereeAdmin/mtschedule/list.less

@@ -5,13 +5,37 @@
     background-color: var(--mainColor);
 
     .one {
+        display: flex;
+        flex-direction: column;
         width: 96vw;
         padding: 2vw;
+        border-bottom: 1px solid var(--f1Color);
 
-        input {
-            padding: 2vw;
-            background-color: var(--f1Color);
-            border-radius: 5px;
+        .one_1 {
+            margin: 0 0 2vw 0;
+
+            input {
+                padding: 1vw 0 2vw 2vw;
+                background-color: var(--f1Color);
+                border-radius: 5px;
+            }
+        }
+
+        .one_2 {
+            display: flex;
+            flex-direction: row;
+            justify-content: space-around;
+
+            .one_2_1 {
+                width: 30vw;
+                margin: 0 1vw;
+            }
+
+            button {
+                width: 100%;
+                padding: 2vw;
+                font-size: var(--font14Size);
+            }
         }
     }
 

+ 39 - 1
pagesMatch/refereeAdmin/mtschedule/list.wxml

@@ -1,7 +1,14 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
         <view class="one">
-            <input type="text" placeholder="请输入关键词" />
+            <view class="one_1">
+                <input type="text" placeholder="请输入关键词" />
+            </view>
+            <view class="one_2">
+                <view class="one_2_1">
+                    <button type="primary" bindtap="toAdd">选择赛事</button>
+                </view>
+            </view>
         </view>
         <view class="two">
             <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
@@ -80,5 +87,36 @@
                 </view>
             </form>
         </view>
+        <view class="dialog_1" wx:if="{{dialog.type=='2'}}">
+            <form catchsubmit="toSubmit">
+                <view class="content">
+                    <view class="label">赛事名称:</view>
+                    <view class="value">
+                        <picker bindchange="matchChange" name="match_id" value="{{form.match_id}}" range-key='name' range="{{matchList}}">
+                            <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_id" value="{{form.group_id}}" range="{{groupList}}" range-key="name">
+                            <view class="picker">{{form.group_name||'请选择赛事分组'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">项目名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="projectChange" name="project_id" value="{{form.project_id}}" range="{{projectList}}" range-key="name">
+                            <view class="picker">{{form.project_name||'请选择项目名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
     </view>
 </dialog>

+ 22 - 2
pagesMatch/refereeAdmin/mtschedule/list.wxss

@@ -4,14 +4,34 @@
   background-color: var(--mainColor);
 }
 .main .one {
+  display: flex;
+  flex-direction: column;
   width: 96vw;
   padding: 2vw;
+  border-bottom: 1px solid var(--f1Color);
 }
-.main .one input {
-  padding: 2vw;
+.main .one .one_1 {
+  margin: 0 0 2vw 0;
+}
+.main .one .one_1 input {
+  padding: 1vw 0 2vw 2vw;
   background-color: var(--f1Color);
   border-radius: 5px;
 }
+.main .one .one_2 {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+}
+.main .one .one_2 .one_2_1 {
+  width: 30vw;
+  margin: 0 1vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  padding: 2vw;
+  font-size: var(--font14Size);
+}
 .main .two {
   position: relative;
   flex-grow: 1;

+ 61 - 11
pagesMatch/refereeAdmin/outschedule/list.js

@@ -5,6 +5,12 @@ Page({
         frameStyle: { useTop: true, name: '淘汰赛管理', leftArrow: true, useBar: false },
         dialog: { title: '赛程上分', show: false, type: '1' },
         form: {},
+        // 赛事列表
+        matchList: [],
+        // 组别列表
+        groupList: [],
+        // 组内项目列表
+        projectList: [],
         list: [],
         total: 0,
         page: 0,
@@ -27,6 +33,11 @@ Page({
         that.setData({ skip: 0, page: 0, list: [] });
         wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` })
     },
+    // 选择赛事
+    toAdd: function (e) {
+        const that = this;
+        that.setData({ dialog: { title: '选择赛事', show: true, type: '2' } })
+    },
     // 赛程上分
     toScore: function (e) {
         const that = this;
@@ -34,6 +45,40 @@ Page({
         that.setData({ form: item })
         that.setData({ dialog: { title: '赛程上分', show: true, type: '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.match_name': data.name, });
+            const group = await app.$get(`/matchGroup`, { match_id: data._id }, 'race');
+            if (group.errcode == '0') that.setData({ groupList: group.data });
+        }
+    },
+    // 选择组别
+    groupChange: async 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 });
+            const arr = await app.$get(`/matchProject`, { match_id: data.match_id, group_id: data._id }, 'race');
+            if (arr.errcode == '0') { that.setData({ projectList: arr.data }) }
+        }
+    },
+    // 选择项目
+    projectChange: async 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 });
+        }
+    },
+    toSubmit: function (e) {
+        const that = this
+        const params = e.detail.value;
+        if (params) { that.setData({ skip: 0, page: 0, list: [] }); that.toClose(); that.watchLogin(); }
+        else { wx.showToast({ title: '请选择数据', icon: 'error', duration: 2000 }) }
+    },
     // 提交保存
     onSubmit: async function (e) {
         const that = this;
@@ -123,20 +168,25 @@ Page({
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
+        let form = that.data.form;
         wx.getStorage({
             key: 'raceuser',
             success: async res => {
-                let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data._id };
-                let arr = await app.$get(`/eliminate`, { ...info }, 'race');
-                if (arr.errcode == '0') {
-                    let list = [...that.data.list, ...arr.data]
-                    for (const val of list) {
-                        let status = that.data.statusList.find(i => i.value == val.status)
-                        if (status) val.zhStatus = status.label;
-                    }
-                    that.setData({ list })
-                    that.setData({ total: arr.total })
-                } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+                let match = await app.$get(`/match`, {}, 'race');
+                if (match.errcode == '0') { that.setData({ matchList: match.data }) }
+                if (form.group_id && form.match_id && form.project_id) {
+                    let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data._id, group_id: form.group_id, match_id: form.match_id, project_id: form.project_id }
+                    let arr = await app.$get(`/eliminate`, { ...info }, 'race');
+                    if (arr.errcode == '0') {
+                        let list = [...that.data.list, ...arr.data]
+                        for (const val of list) {
+                            let status = that.data.statusList.find(i => i.value == val.status)
+                            if (status) val.zhStatus = status.label;
+                        }
+                        that.setData({ list })
+                        that.setData({ total: arr.total })
+                    } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+                }
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })

+ 28 - 4
pagesMatch/refereeAdmin/outschedule/list.less

@@ -5,13 +5,37 @@
     background-color: var(--mainColor);
 
     .one {
+        display: flex;
+        flex-direction: column;
         width: 96vw;
         padding: 2vw;
+        border-bottom: 1px solid var(--f1Color);
 
-        input {
-            padding: 2vw;
-            background-color: var(--f1Color);
-            border-radius: 5px;
+        .one_1 {
+            margin: 0 0 2vw 0;
+
+            input {
+                padding: 1vw 0 2vw 2vw;
+                background-color: var(--f1Color);
+                border-radius: 5px;
+            }
+        }
+
+        .one_2 {
+            display: flex;
+            flex-direction: row;
+            justify-content: space-around;
+
+            .one_2_1 {
+                width: 30vw;
+                margin: 0 1vw;
+            }
+
+            button {
+                width: 100%;
+                padding: 2vw;
+                font-size: var(--font14Size);
+            }
         }
     }
 

+ 39 - 1
pagesMatch/refereeAdmin/outschedule/list.wxml

@@ -1,7 +1,14 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
         <view class="one">
-            <input type="text" placeholder="请输入关键词" />
+            <view class="one_1">
+                <input type="text" placeholder="请输入关键词" />
+            </view>
+            <view class="one_2">
+                <view class="one_2_1">
+                    <button type="primary" bindtap="toAdd">选择赛事</button>
+                </view>
+            </view>
         </view>
         <view class="two">
             <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
@@ -81,5 +88,36 @@
                 </view>
             </form>
         </view>
+        <view class="dialog_1" wx:if="{{dialog.type=='2'}}">
+            <form catchsubmit="toSubmit">
+                <view class="content">
+                    <view class="label">赛事名称:</view>
+                    <view class="value">
+                        <picker bindchange="matchChange" name="match_id" value="{{form.match_id}}" range-key='name' range="{{matchList}}">
+                            <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_id" value="{{form.group_id}}" range="{{groupList}}" range-key="name">
+                            <view class="picker">{{form.group_name||'请选择赛事分组'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">项目名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="projectChange" name="project_id" value="{{form.project_id}}" range="{{projectList}}" range-key="name">
+                            <view class="picker">{{form.project_name||'请选择项目名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
     </view>
 </dialog>

+ 22 - 2
pagesMatch/refereeAdmin/outschedule/list.wxss

@@ -4,14 +4,34 @@
   background-color: var(--mainColor);
 }
 .main .one {
+  display: flex;
+  flex-direction: column;
   width: 96vw;
   padding: 2vw;
+  border-bottom: 1px solid var(--f1Color);
 }
-.main .one input {
-  padding: 2vw;
+.main .one .one_1 {
+  margin: 0 0 2vw 0;
+}
+.main .one .one_1 input {
+  padding: 1vw 0 2vw 2vw;
   background-color: var(--f1Color);
   border-radius: 5px;
 }
+.main .one .one_2 {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+}
+.main .one .one_2 .one_2_1 {
+  width: 30vw;
+  margin: 0 1vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  padding: 2vw;
+  font-size: var(--font14Size);
+}
 .main .two {
   position: relative;
   flex-grow: 1;