Browse Source

Merge branch 'master' of http://git.cc-lotus.info/ball-court/ball-applet

YY 2 years ago
parent
commit
6b26361856

+ 186 - 1
commpents/pagesMatchs/achieve/achieve-2.js

@@ -1,23 +1,208 @@
 // commpents/pagesMatchs/achieve/achieve-2.js
 // commpents/pagesMatchs/achieve/achieve-2.js
+const app = getApp();
+const nodeSetting = function (node) {
+    node.label = node.name
+    return node;
+};
+const edgeSetting = function (edge) {
+    return edge;
+}
 Component({
 Component({
+    options: { multipleSlots: true },
     /**
     /**
      * 组件的属性列表
      * 组件的属性列表
      */
      */
     properties: {
     properties: {
+        options: { type: Object }
+    },
+
+    lifetimes: {
+        attached: async function () {
+            // 在组件实例进入页面节点树时执行
+            await this.search()
+            await this.searchUser();
+            this.setData({ loadChart: true })
+        },
+        detached: function () {
+            // 在组件实例被从页面节点树移除时执行
+        },
+    },
 
 
+    pageLifetimes: {
+        // 组件所在页面的生命周期函数
+        show: function () {
+            console.log(this.data.loadChart);
+            this.search()
+            this.searchUser();
+            this.setData({ loadChart: true })
+        },
+        hide: function () { },
+        resize: function () { },
     },
     },
 
 
     /**
     /**
      * 组件的初始数据
      * 组件的初始数据
      */
      */
     data: {
     data: {
-
+        loadChart: false,
+        winData: {},
+        loseData: {},
+        schList: [],
+        canvasWidth: 375,
+        canvasHeight: 600,
+        pixelRatio: 2,
+        edgeSetting,
+        nodeSetting,
+        tabs: {
+            active: 'a',
+            menu: [
+                { title: '比赛流程', active: 'a' },
+                { title: '败者组流程', active: 'b' },
+            ],
+        },
     },
     },
 
 
     /**
     /**
      * 组件的方法列表
      * 组件的方法列表
      */
      */
     methods: {
     methods: {
+        /**
+    * 查询函数
+    */
+        search: async function () {
+            const query = this.properties.options;
+            let arr;
+            arr = await app.$get(`/eliminate/graphData`, query, 'race');
+            if (arr.errcode == '0') {
+                const { winData, loseData } = this.groupData(arr.data);
+                // const schList = this.schData(arr.data)
+                this.setData({ winData, loseData })
+            }
+            arr = await app.$get(`/eliminate/playerList`, query, 'race');
+            if (arr.errcode == '0' && arr.data.length > 0) {
+                this.setData({ playerList: arr.data })
+            }
+        },
+        // 查询赛事赛程
+        searchUser: async function () {
+            const query = this.properties.options;
+            let arr;
+            arr = await app.$get(`/eliminate`, query, 'race');
+            if (arr.errcode == '0' && arr.total > 0) {
+                for (const val of arr.data) {
+                    this.setNodeInfo(val)
+                    // 状态
+                }
+                this.setData({ schList: arr.data });
+                this.setTopPlayerName();
+            }
+        },
+        /**
+         * 给所有顶点去找到选手
+         */
+        setTopPlayerName() {
+            const func = type => {
+                const { nodes, edges } = this.data[`${type}Data`];
+                // 顶点:是其他的target且不是任何节点的source
+                const tops = nodes.filter(f => {
+                    const { id } = f;
+                    const r = edges.find(f => f.source === id)
+                    if (!r) return true
+                })
+                if (tops.length <= 0) return;
+                for (const t of tops) {
+                    const { id } = t;
+                    const es = edges.filter(f => f.target === id)
+                    const ns = nodes.filter(f => es.find(ef => ef.source === f.id))
+                    const headNodeId = ns[0]?.id;
+                    const lastNodeId = ns[ns.length - 1]?.id
+                    const r = this.data.schList.find(f => (f.player_one_node === headNodeId && f.player_two_node === lastNodeId) || (f.player_one_node === lastNodeId && f.player_two_node === headNodeId))
+                    if (!r) continue;
+                    const { player_one_score, player_one_name, player_two_score, player_two_name, status } = r
+                    // 未结束不查
+                    if (status !== '2') continue;
+                    if (player_one_score > player_two_score) t.name = player_one_name
+                    else t.name = player_two_name
+                    const ri = nodes.findIndex(f => f.id === t.id)
+                    nodes[ri] = t;
+                }
+                this.setData({ [`${type}Data.nodes`]: nodes })
+            }
+            func('win')
+            func('lose')
+        },
+
+        /**
+         * 给流程图数据分组
+         * @param {Array} data 流程图数据
+         */
+        groupData(data) {
+            const { nodes, edges } = data;
+            // 按胜/败进行分组,显示在2个选项卡中
+            const winNodes = nodes.filter(f => !f.mark || f.mark.includes('w'))
+            const winEdges = this.getNodesEdges(winNodes, edges);
+            const loseNodes = nodes.filter(f => f.mark && !f.mark.includes('w'))
+            const loseEdges = this.getNodesEdges(loseNodes, edges);
+            return { winData: { nodes: winNodes, edges: winEdges }, loseData: { nodes: loseNodes, edges: loseEdges } }
+        },
+
+        /**
+         * 同步图与赛程的人名
+         * @param {Object} data 赛程数据
+         */
+        setNodeInfo(data) {
+            const { player_one, player_one_node, player_one_name, player_two, player_two_node, player_two_name } = data
+            const setNode = (node_id, name) => {
+                let data = this.data.winData;
+                let r = data.nodes.find(f => f.id === node_id)
+                if (r) {
+                    const ri = data.nodes.findIndex(f => f.id === node_id)
+                    r.name = name;
+                    data.nodes[ri] = r;
+                    this.setData({ winData: data })
+                    return;
+                }
+                data = this.data.loseData;
+                r = data.nodes.find(f => f.id === node_id)
+                if (r) {
+                    const ri = data.nodes.findIndex(f => f.id === node_id)
+                    r.name = name;
+                    data.nodes[ri] = r;
+                    this.setData({ loseData: data })
+                    return;
+                }
+
+            }
+            if (player_one && player_one_node) setNode(player_one_node, player_one_name)
+            if (player_two && player_two_node) setNode(player_two_node, player_two_name)
+        },
+
+        /**
+         * 找到这些节点的边关系
+         * @param {Array} list 节点数据
+         * @param {Array} edges 所有的辺数据
+         */
+        getNodesEdges(list, edges) {
+            const fedges = [];
+            for (let i = 0; i < list.length; i += 2) {
+                const n1 = list[i];
+                const n2 = list[i + 1]
+                const n1id = n1.id;
+                const n2id = n2.id
+                if (!n1id || !n2id) continue;
+                const n1e = edges.find(f => f.source === n1id)
+                const n2e = edges.find(f => f.source === n2id)
+                if (!n1e || !n2e) continue;
+                const n1et = n1e.target;
+                const n2et = n2e.target;
+                if (n1et === n2et) fedges.push(n1e, n2e)
+            }
+            return fedges;
+        },
 
 
+        tabsChange: function (e) {
+            let { active } = e.detail;
+            this.setData({ 'tabs.active': active });
+        },
     }
     }
 })
 })

+ 4 - 1
commpents/pagesMatchs/achieve/achieve-2.json

@@ -1,4 +1,7 @@
 {
 {
     "component": true,
     "component": true,
-    "usingComponents": {}
+    "usingComponents": {
+        "s-tab": "/commpents/tabs/index",
+        "f6-darge": "/commpents/f6darge/index"
+    }
 }
 }

+ 11 - 1
commpents/pagesMatchs/achieve/achieve-2.wxml

@@ -2,7 +2,17 @@
     <scroll-view scroll-y="true" class="scroll-view">
     <scroll-view scroll-y="true" class="scroll-view">
         <view class="list-scroll-view">
         <view class="list-scroll-view">
             <view class="one">
             <view class="one">
-                淘汰赛
+                <view class="one">
+                    <s-tab tabs="{{tabs}}" bind:tabsChange="tabsChange"></s-tab>
+                </view>
+                <view class="two">
+                    <view wx:if="{{tabs.active=='a'}}">
+                        <f6-darge wx:if="{{loadChart}}" width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" data="{{winData}}" nodeSetting="{{nodeSetting}}" edgeSetting="{{edgeSetting}}" />
+                    </view>
+                    <view wx:elif="{{tabs.active=='b'}}">
+                        <f6-darge wx:if="{{loadChart}}" width="{{canvasWidth}}" height="{{canvasHeight}}" pixelRatio="{{pixelRatio}}" data="{{loseData}}" nodeSetting="{{nodeSetting}}" edgeSetting="{{edgeSetting}}" />
+                    </view>
+                </view>
             </view>
             </view>
         </view>
         </view>
     </scroll-view>
     </scroll-view>

+ 4 - 1
pagesMatch/match/achieve.js

@@ -20,7 +20,8 @@ Page({
             { num: 2, name: '顾红伟' },
             { num: 2, name: '顾红伟' },
             { num: 3, name: '顾红伟' },
             { num: 3, name: '顾红伟' },
             { num: 4, name: '顾红伟' },
             { num: 4, name: '顾红伟' },
-        ]
+        ],
+        
     },
     },
     // 返回
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
     back: function () { wx.navigateBack({ delta: 1 }) },
@@ -56,6 +57,8 @@ Page({
             }
             }
         })
         })
     },
     },
+
+    
     /**
     /**
      * 生命周期函数--监听页面初次渲染完成
      * 生命周期函数--监听页面初次渲染完成
      */
      */

+ 1 - 1
pagesMatch/match/achieve.wxml

@@ -8,7 +8,7 @@
                 <achieve-1></achieve-1>
                 <achieve-1></achieve-1>
             </view>
             </view>
             <view wx:elif="{{tabs.active=='b'}}" class="a b">
             <view wx:elif="{{tabs.active=='b'}}" class="a b">
-                <achieve-2></achieve-2>
+                <achieve-2 options="{{options}}"></achieve-2>
             </view>
             </view>
             <view wx:elif="{{tabs.active=='c'}}" class="a c">
             <view wx:elif="{{tabs.active=='c'}}" class="a c">
                 <achieve-3 cList="{{cList}}"></achieve-3>
                 <achieve-3 cList="{{cList}}"></achieve-3>

+ 19 - 6
pagesMatch/match/info.js

@@ -36,6 +36,10 @@ Page({
         dList: [],
         dList: [],
         // 成绩册
         // 成绩册
         achieveList: [],
         achieveList: [],
+        // 赛事组别
+        groupList: [],
+        // 赛事项目
+        projectList: [],
         //赛事状态
         //赛事状态
         statusList: [],
         statusList: [],
         //赛事类别
         //赛事类别
@@ -157,6 +161,12 @@ Page({
     searchOther: async function () {
     searchOther: async function () {
         const that = this;
         const that = this;
         let arr;
         let arr;
+        // 赛事组别
+        arr = await app.$get(`/matchGroup`, { match_id: that.data.id }, 'race');
+        if (arr.errcode == '0') { that.setData({ groupList: arr.data }) };
+        // 赛事项目
+        arr = await app.$get(`/matchProject`, { match_id: that.data.id }, 'race');
+        if (arr.errcode == '0') { that.setData({ projectList: arr.data }) };
         // 赛事状态
         // 赛事状态
         arr = await app.$get(`/dict`, { code: "match_status" });
         arr = await app.$get(`/dict`, { code: "match_status" });
         if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list });
         if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list });
@@ -208,6 +218,7 @@ Page({
                 } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'fail', duration: 2000 }); }
                 } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'fail', duration: 2000 }); }
                 // 赛事选手
                 // 赛事选手
                 arr = await app.$get(`/match/getAll/${arr.data._id}`, {}, 'race');
                 arr = await app.$get(`/match/getAll/${arr.data._id}`, {}, 'race');
+                console.log(arr);
                 if (arr.errcode == '0') that.setData({ playerList: arr.data })
                 if (arr.errcode == '0') that.setData({ playerList: arr.data })
                 // 秩序册
                 // 秩序册
                 that.searchOrderBook();
                 that.searchOrderBook();
@@ -237,6 +248,8 @@ Page({
         let genderList = that.data.genderList;
         let genderList = that.data.genderList;
         let type = that.data.cType;
         let type = that.data.cType;
         let match = that.data.info;
         let match = that.data.info;
+        let groupList = that.data.groupList;
+        let projectList = that.data.projectList;
         let cSearch = that.data.cSearchname;
         let cSearch = that.data.cSearchname;
         let info = { match_id: match._id };
         let info = { match_id: match._id };
         if (type == '0') { if (cSearch) info.user_name = cSearch; }
         if (type == '0') { if (cSearch) info.user_name = cSearch; }
@@ -248,13 +261,13 @@ Page({
             let list = arr.data;
             let list = arr.data;
             for (const val of list) {
             for (const val of list) {
                 // 查询组
                 // 查询组
-                const group = await app.$get(`/matchGroup/${val.group_id}`, {}, 'race');
-                if (group.errcode == '0') { val.age = group.data.age; }
+                let group = groupList.find(i => i.id == val.group_id);
+                if (group) val.age = group.age;
                 // 查询项目
                 // 查询项目
-                const project = await app.$get(`/matchProject/${val.project_id}`, {}, 'race');
-                if (project.errcode == '0') {
-                    val.projectAge = project.data.age;
-                    let gender = genderList.find(i => i.value == project.data.gender)
+                let project = projectList.find(i => i.id == val.project_id);
+                if (project) {
+                    val.projectAge = project.age;
+                    let gender = genderList.find(i => i.value == project.gender);
                     if (gender) val.pojectGender = gender.label;
                     if (gender) val.pojectGender = gender.label;
                 }
                 }
                 // 名字分割
                 // 名字分割

+ 3 - 1
pagesMatch/matchAdmin/elimmatch/add.js

@@ -6,7 +6,9 @@ const nodeSetting = function (node) {
 const edgeSetting = function (edge) {
 const edgeSetting = function (edge) {
     return edge;
     return edge;
 }
 }
-const prefix = 'http://192.168.1.197:15001/newCourt/race/v2/api'
+//调试用
+// const prefix = 'http://192.168.1.197:15001/newCourt/race/v2/api'
+const prefix = ''
 Page({
 Page({
     data: {
     data: {
         frameStyle: { useTop: true, name: '添加赛程', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '添加赛程', leftArrow: true, useBar: false },

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

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

+ 44 - 26
pagesMatch/refereeAdmin/outschedule/list.js

@@ -3,22 +3,24 @@ import WxValidate from '../../../utils/wxValidate';
 Page({
 Page({
     data: {
     data: {
         frameStyle: { useTop: true, name: '淘汰赛管理', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '淘汰赛管理', leftArrow: true, useBar: false },
-        dialog: { title: '赛程上分', show: false, type: '1' },
-        form: {},
-        //查询
-        searchInfo: {},
+        // 用户信息
+        raceuser: {},
         // 赛事列表
         // 赛事列表
         matchList: [],
         matchList: [],
         // 组别列表
         // 组别列表
         groupList: [],
         groupList: [],
         // 组内项目列表
         // 组内项目列表
         projectList: [],
         projectList: [],
+        statusList: [],
         list: [],
         list: [],
         total: 0,
         total: 0,
         page: 0,
         page: 0,
         skip: 0,
         skip: 0,
         limit: 5,
         limit: 5,
-        statusList: []
+        dialog: { title: '赛程上分', show: false, type: '1' },
+        //查询
+        searchInfo: {},
+        form: {},
     },
     },
     initValidate() {
     initValidate() {
         const rules = { player_one_score: { required: true }, player_two_score: { required: true } }
         const rules = { player_one_score: { required: true }, player_two_score: { required: true } }
@@ -27,7 +29,7 @@ Page({
         this.WxValidate = new WxValidate(rules, messages)
         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) {
     toCommon: function (e) {
         const that = this;
         const that = this;
@@ -77,10 +79,38 @@ Page({
     },
     },
     toSubmit: function (e) {
     toSubmit: function (e) {
         const that = this
         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 }) }
         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) {
     onSubmit: async function (e) {
         const that = this;
         const that = this;
@@ -95,7 +125,7 @@ Page({
             if (arr.errcode == '0') {
             if (arr.errcode == '0') {
                 wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
                 wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
                 that.setData({ skip: 0, page: 0, list: [], form: {} })
                 that.setData({ skip: 0, page: 0, list: [], form: {} })
-                that.watchLogin()
+                that.search()
                 that.toClose();
                 that.toClose();
             }
             }
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
@@ -114,7 +144,7 @@ Page({
                     if (arr.errcode == '0') {
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `交换场地成功`, icon: 'success', duration: 2000 });
                         wx.showToast({ title: `交换场地成功`, icon: 'success', duration: 2000 });
                         that.setData({ skip: 0, page: 0, list: [] })
                         that.setData({ skip: 0, page: 0, list: [] })
-                        that.watchLogin();
+                        that.search();
                     }
                     }
                     else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
                     else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
                 }
                 }
@@ -132,7 +162,7 @@ Page({
             that.setData({ page: page })
             that.setData({ page: page })
             let skip = page * limit;
             let skip = page * limit;
             that.setData({ skip: skip })
             that.setData({ skip: skip })
-            that.watchLogin();
+            that.search();
             wx.hideLoading()
             wx.hideLoading()
         } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
         } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
     },
     },
@@ -170,25 +200,13 @@ Page({
     // 监听用户是否登录
     // 监听用户是否登录
     watchLogin: async function () {
     watchLogin: async function () {
         const that = this;
         const that = this;
-        let searchInfo = that.data.searchInfo;
         wx.getStorage({
         wx.getStorage({
             key: 'raceuser',
             key: 'raceuser',
             success: async res => {
             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 (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 => {
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
                 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" wx:for="{{list}}" wx:key="item">
                         <view class="list_0">
                         <view class="list_0">
                             <view class="name">
                             <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>
                             <view class="pk">
                             <view class="pk">
                                 <view class="pk_1">
                                 <view class="pk_1">

+ 1 - 1
pagesMatch/system/index.js

@@ -49,7 +49,7 @@ Page({
                     const aee = await app.$get(`/user/${arr.data.user_id}`);
                     const aee = await app.$get(`/user/${arr.data.user_id}`);
                     if (aee.errcode == '0') { arr.data.user_id = aee.data; }
                     if (aee.errcode == '0') { arr.data.user_id = aee.data; }
                     that.setData({ user: arr.data })
                     that.setData({ user: arr.data })
-                    let btnData = match_menu.find((i) => i.type == arr.data.type);
+                    let btnData = match_menu.find((i) => i.type == '2');
                     that.setData({ list: [...btnData.menu, ...school_sysmenu] })
                     that.setData({ list: [...btnData.menu, ...school_sysmenu] })
                 }
                 }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }
                 else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); }