浏览代码

小组赛 淘汰赛

zs 2 年之前
父节点
当前提交
8845136c16

+ 45 - 27
pagesMatch/refereeAdmin/mtschedule/list.js

@@ -3,22 +3,24 @@ import WxValidate from '../../../utils/wxValidate';
 Page({
     data: {
         frameStyle: { useTop: true, name: '小组赛管理', leftArrow: true, useBar: false },
-        dialog: { title: '赛程上分', show: false, type: '1' },
-        form: {},
-        //查询
-        searchInfo: {},
+        // 用户信息
+        raceuser: {},
         // 赛事列表
         matchList: [],
         // 组别列表
         groupList: [],
         // 组内项目列表
         projectList: [],
+        statusList: [],
         list: [],
         total: 0,
         page: 0,
         skip: 0,
         limit: 5,
-        statusList: []
+        dialog: { title: '赛程上分', show: false, type: '1' },
+        //查询
+        searchInfo: {},
+        form: {},
     },
     initValidate() {
         const rules = { player_one_score: { required: true }, player_two_score: { required: true } }
@@ -27,7 +29,7 @@ Page({
         this.WxValidate = new WxValidate(rules, messages)
     },
     // 返回
-    back: function () { wx.navigateBack({ delta: 1 }) },
+    back: function () { wx.navigateBack({ delta: 1 }); wx.removeStorage({ key: 'searchInfo' }) },
     // 详细信息
     toCommon: function (e) {
         const that = this;
@@ -77,10 +79,38 @@ Page({
     },
     toSubmit: function (e) {
         const that = this
-        const params = e.detail.value;
-        if (params) { that.setData({ skip: 0, page: 0, list: [] }); that.toClose(); that.watchLogin(); }
+        let searchInfo = that.data.searchInfo;
+        if (searchInfo) {
+            that.setData({ skip: 0, page: 0, list: [] });
+            wx.setStorage({ key: "searchInfo", data: searchInfo })
+            that.toClose();
+            that.search();
+        }
         else { wx.showToast({ title: '请选择数据', icon: 'error', duration: 2000 }) }
     },
+    search: async function () {
+        const that = this;
+        let raceuser = that.data.raceuser;
+        let statusList = that.data.statusList;
+        wx.getStorage({
+            key: 'searchInfo',
+            success: async res => {
+                if (res.data.group_id && res.data.match_id && res.data.project_id) {
+                    let info = { skip: that.data.skip, limit: that.data.limit, referee_id: raceuser._id, group_id: res.data.group_id, match_id: res.data.match_id, project_id: res.data.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 = 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 }) }
+                }
+            },
+        })
+    },
     // 提交保存
     onSubmit: async function (e) {
         const that = this;
@@ -95,13 +125,13 @@ Page({
             if (arr.errcode == '0') {
                 wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
                 that.setData({ skip: 0, page: 0, list: [], form: {} })
-                that.watchLogin();
+                that.search();
                 that.toClose();
             }
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
         }
     },
-    // 删除
+    // 交换场地
     toChange: function (e) {
         const that = this;
         const { item } = e.currentTarget.dataset;
@@ -114,7 +144,7 @@ Page({
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `交换场地成功`, icon: 'success', duration: 2000 });
                         that.setData({ skip: 0, page: 0, list: [] })
-                        that.watchLogin();
+                        that.search();
                     }
                     else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
                 }
@@ -132,7 +162,7 @@ Page({
             that.setData({ page: page })
             let skip = page * limit;
             that.setData({ skip: skip })
-            that.watchLogin();
+            that.search();
             wx.hideLoading()
         } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
@@ -170,25 +200,13 @@ Page({
     // 监听用户是否登录
     watchLogin: async function () {
         const that = this;
-        let searchInfo = that.data.searchInfo;
         wx.getStorage({
             key: 'raceuser',
             success: async res => {
-                let match = await app.$get(`/match`, {}, 'race');
+                that.setData({ raceuser: res.data })
+                let match = await app.$get(`/match`, { belong_id: res.data.parent_id }, 'race');
                 if (match.errcode == '0') { that.setData({ matchList: match.data }) }
-                if (searchInfo.group_id && searchInfo.match_id && searchInfo.project_id) {
-                    let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data._id, group_id: searchInfo.group_id, match_id: searchInfo.match_id, project_id: searchInfo.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 }) }
-                }
+                that.search();
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })

+ 45 - 27
pagesMatch/refereeAdmin/outschedule/list.js

@@ -3,22 +3,24 @@ import WxValidate from '../../../utils/wxValidate';
 Page({
     data: {
         frameStyle: { useTop: true, name: '淘汰赛管理', leftArrow: true, useBar: false },
-        dialog: { title: '赛程上分', show: false, type: '1' },
-        form: {},
-        //查询
-        searchInfo: {},
+        // 用户信息
+        raceuser: {},
         // 赛事列表
         matchList: [],
         // 组别列表
         groupList: [],
         // 组内项目列表
         projectList: [],
+        statusList: [],
         list: [],
         total: 0,
         page: 0,
         skip: 0,
         limit: 5,
-        statusList: []
+        dialog: { title: '赛程上分', show: false, type: '1' },
+        //查询
+        searchInfo: {},
+        form: {},
     },
     initValidate() {
         const rules = { player_one_score: { required: true }, player_two_score: { required: true } }
@@ -77,10 +79,38 @@ Page({
     },
     toSubmit: function (e) {
         const that = this
-        const params = e.detail.value;
-        if (params) { that.setData({ skip: 0, page: 0, list: [] }); that.toClose(); that.watchLogin(); }
+        let searchInfo = that.data.searchInfo;
+        if (searchInfo) {
+            that.setData({ skip: 0, page: 0, list: [] });
+            wx.setStorage({ key: "searchInfo", data: searchInfo })
+            that.toClose();
+            that.search();
+        }
         else { wx.showToast({ title: '请选择数据', icon: 'error', duration: 2000 }) }
     },
+    search: async function () {
+        const that = this;
+        let raceuser = that.data.raceuser;
+        let statusList = that.data.statusList;
+        wx.getStorage({
+            key: 'searchInfo',
+            success: async res => {
+                if (res.data.group_id && res.data.match_id && res.data.project_id) {
+                    let info = { skip: that.data.skip, limit: that.data.limit, referee_id: raceuser._id, group_id: res.data.group_id, match_id: res.data.match_id, project_id: res.data.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 = 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 }) }
+                }
+            },
+        })
+    },
     // 提交保存
     onSubmit: async function (e) {
         const that = this;
@@ -95,7 +125,7 @@ Page({
             if (arr.errcode == '0') {
                 wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
                 that.setData({ skip: 0, page: 0, list: [], form: {} })
-                that.watchLogin()
+                that.search()
                 that.toClose();
             }
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
@@ -114,7 +144,7 @@ Page({
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `交换场地成功`, icon: 'success', duration: 2000 });
                         that.setData({ skip: 0, page: 0, list: [] })
-                        that.watchLogin();
+                        that.search();
                     }
                     else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
                 }
@@ -132,7 +162,7 @@ Page({
             that.setData({ page: page })
             let skip = page * limit;
             that.setData({ skip: skip })
-            that.watchLogin();
+            that.search();
             wx.hideLoading()
         } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
@@ -167,28 +197,16 @@ Page({
         arr = await app.$get(`/dict`, { code: "schedule_status" });
         if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list });
     },
-    // 监听用户是否登录
-    watchLogin: async function () {
+     // 监听用户是否登录
+     watchLogin: async function () {
         const that = this;
-        let searchInfo = that.data.searchInfo;
         wx.getStorage({
             key: 'raceuser',
             success: async res => {
-                let match = await app.$get(`/match`, {}, 'race');
+                that.setData({ raceuser: res.data })
+                let match = await app.$get(`/match`, { belong_id: res.data.parent_id }, 'race');
                 if (match.errcode == '0') { that.setData({ matchList: match.data }) }
-                if (searchInfo.group_id && searchInfo.match_id && searchInfo.project_id) {
-                    let info = { skip: that.data.skip, limit: that.data.limit, referee_id: res.data._id, group_id: searchInfo.group_id, match_id: searchInfo.match_id, project_id: searchInfo.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 }) }
-                }
+                that.search();
             },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })

+ 4 - 4
pagesMatch/refereeAdmin/outschedule/list.wxml

@@ -16,10 +16,10 @@
                     <view class="list" wx:for="{{list}}" wx:key="item">
                         <view class="list_0">
                             <view class="name">
-                                <text>{{item.match_id.name}}</text>
-                                <text>{{item.group_id.name}}</text>
-                                <text>{{item.project_id.name}}</text>
-                                <text>{{item.address_id.name}}</text>
+                                <text>{{item.match_id_name}}</text>
+                                <text>{{item.group_id_name}}</text>
+                                <text>{{item.project_id_name}}</text>
+                                <text>{{item.address_id_name}}</text>
                             </view>
                             <view class="pk">
                                 <view class="pk_1">