Explorar el Código

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

zs hace 2 años
padre
commit
51e2822d24

+ 2 - 0
app.json

@@ -126,6 +126,8 @@
                 "matchAdmin/mtschedule/list",
                 "matchAdmin/mtschedule/add",
                 "matchAdmin/elimmatch/list",
+                "matchAdmin/elimmatch/add",
+                "matchAdmin/elimmatch/edit",
                 "userAdmin/sign/list",
                 "userAdmin/sign/info",
                 "userAdmin/team/list",

+ 66 - 0
pagesMatch/matchAdmin/elimmatch/add.js

@@ -0,0 +1,66 @@
+const app = getApp();
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '淘汰赛赛程设置', leftArrow: true, useBar: false },
+    },
+    // 返回
+    back: function () { wx.navigateBack({ delta: 1 }) },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) { },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        const that = this;
+        // 监听用户是否登录
+        that.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'raceuser',
+            success: async res => { },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 6 - 0
pagesMatch/matchAdmin/elimmatch/add.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+      "mobile-main": "/commpents/mobile-frame/index"
+    }
+  }

+ 23 - 0
pagesMatch/matchAdmin/elimmatch/add.less

@@ -0,0 +1,23 @@
+@import (css) "/app.wxss";
+
+.main {
+    height: var(--twoHeight);
+    background-color: var(--mainColor);
+
+    .one {
+        width: 100vw;
+    }
+}
+
+.scroll-view {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+
+    .list-scroll-view {
+        display: flex;
+        flex-direction: column;
+    }
+}

+ 7 - 0
pagesMatch/matchAdmin/elimmatch/add.wxml

@@ -0,0 +1,7 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            淘汰赛赛程设置
+        </view>
+    </view>
+</mobile-main>

+ 19 - 0
pagesMatch/matchAdmin/elimmatch/add.wxss

@@ -0,0 +1,19 @@
+@import "/app.wxss";
+.main {
+  height: var(--twoHeight);
+  background-color: var(--mainColor);
+}
+.main .one {
+  width: 100vw;
+}
+.scroll-view {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+}
+.scroll-view .list-scroll-view {
+  display: flex;
+  flex-direction: column;
+}

+ 241 - 0
pagesMatch/matchAdmin/elimmatch/edit.js

@@ -0,0 +1,241 @@
+const app = getApp();
+import WxValidate from '../../../utils/wxValidate';
+Page({
+    data: {
+        frameStyle: { useTop: true, name: '赛程信息', leftArrow: true, useBar: false },
+        raceuser: {},
+        id: '',
+        form: {},
+        // 赛事列表
+        matchList: [],
+        // 组别列表
+        groupList: [],
+        // 组内项目列表
+        projectList: [],
+        // 小组设置列表
+        teamList: [],
+        // 裁判
+        refereeList: [],
+        // 场地
+        addressList: [],
+        // 选手
+        memberList: [],
+        // 赛程状态
+        statusList: []
+    },
+    initValidate() {
+        const rules = { match_id: { required: true }, group_id: { required: true }, project_id: { required: true }, team_id: { required: true }, address_id: { required: false }, referee_id: { required: false }, match_time: { required: true }, player_type: { required: true }, player_one: { required: true }, player_two: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { match_id: { required: '比赛赛事' }, group_id: { required: '赛事分组' }, project_id: { required: '组内项目' }, team_id: { required: '小组名称' }, address_id: { required: '场地名称' }, referee_id: { required: '裁判名称' }, match_time: { required: '比赛时间' }, player_type: { required: '选手类型' }, player_one: { required: '选手一' }, player_two: { required: '选手二' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    // 返回
+    back: function () { wx.navigateBack({ delta: 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_id_name': data.name });
+            const arr = await app.$get(`/matchGroup`, { match_id: data._id }, 'race');
+            if (arr.errcode == '0') { that.setData({ groupList: arr.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_id_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_id_name': data.name });
+            const arr = await app.$get(`/matchTeamGroup`, { match_id: data.match_id, group_id: data.group_id, project_id: data._id }, 'race');
+            if (arr.errcode == '0') { that.setData({ teamList: arr.data }) }
+        }
+    },
+    // 小组
+    teamChange: async function (e) {
+        const that = this;
+        let data = that.data.teamList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.team_id': data._id, 'form.team_id_name': data.name });
+            const arr = await app.$get(`/matchTeamGroup/${data._id}`, {}, 'race');
+            console.log(arr);
+            if (arr.errcode == '0') {
+                if (arr.data.person_type == 'Race.User') { that.setData({ 'form.player_type': 'Race.User', 'form.type_name': '单打' }) }
+                if (arr.data.person_type == 'Race.TeamApply') { that.setData({ 'form.player_type': 'Race.TeamApply', 'form.type_name': '双打' }) }
+                that.setData({ memberList: arr.data.person });
+            }
+
+        }
+    },
+    // 场地
+    addressChange: async function (e) {
+        const that = this;
+        let data = that.data.addressList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.address_id': data._id, 'form.address_id_name': data.name });
+        }
+    },
+    // 裁判
+    refereeChange: async function (e) {
+        const that = this;
+        let data = that.data.refereeList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.referee_id': data._id, 'form.referee_id_name': data.name });
+        }
+    },
+    // 确认选择
+    datetimeChange: function (e) {
+        const that = this;
+        that.setData({ [`form.${e.detail.name}`]: e.detail.datetime });
+    },
+    // 选手一
+    oneMemberChange: async function (e) {
+        const that = this;
+        let data = that.data.memberList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.player_one': data.id, 'form.player_one_name': data.name });
+        }
+    },
+    // 选手二
+    twoMemberChange: async function (e) {
+        const that = this;
+        let data = that.data.memberList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.player_two': data.id, 'form.player_two_name': data.name });
+        }
+    },
+    // 选择状态
+    statusChange: function (e) {
+        const that = this;
+        let data = that.data.statusList[e.detail.value];
+        if (data) {
+            that.setData({ 'form.status': data.value, 'form.zhStatus': data.label });
+        }
+    },
+    // 提交保存
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const form = that.data.form;
+        params.match_time = form.match_time;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let arr;
+            if (that.data.id) { arr = await app.$post(`/msgs/${that.data.id}`, params, 'race'); }
+            else { arr = await app.$post(`/msgs`, params, 'race'); }
+            if (arr.errcode == '0') { wx.showToast({ title: `维护信息完成`, icon: 'success', duration: 2000 }); that.back(); }
+            else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        const that = this;
+        that.setData({ id: options && options.id || '' })
+        //验证规则函数
+        that.initValidate();
+        // 监听用户是否登录
+        await that.watchLogin();
+    },
+    // 查询其他信息
+    searchOther: async function () {
+        const that = this;
+        const raceuser = that.data.raceuser;
+        let arr;
+        // 状态
+        arr = await app.$get(`/dict`, { code: 'schedule_status' });
+        if (arr.errcode == '0' && arr.total > 0) that.setData({ statusList: arr.data[0].list });
+        // 比赛
+        arr = await app.$get(`/match`, { belong_id: raceuser._id, status: '2' }, 'race');
+        if (arr.errcode == '0') that.setData({ matchList: arr.data });
+        // 场地
+        arr = await app.$get(`/matchAddress`, { belong_id: raceuser._id, is_use: '0' }, 'race');
+        if (arr.errcode == '0') that.setData({ addressList: arr.data });
+        // 裁判
+        arr = await app.$get(`/user`, { type: '2' }, 'race');
+        if (arr.errcode == '0') {
+            for (const val of arr.data) { val.name = val.user_id.name }
+            that.setData({ refereeList: arr.data });
+        }
+    },
+    // 监听用户是否登录
+    watchLogin: async function () {
+        const that = this;
+        wx.getStorage({
+            key: 'raceuser',
+            success: async res => {
+                that.setData({ raceuser: res.data });
+                // 查询其他信息
+                await that.searchOther();
+                if (that.data.id) {
+                    const arr = await app.$get(`/msgs/${that.data.id}`, {}, 'race');
+                    if (arr.errcode == '0') {
+                        // 状态
+                        let status = that.data.statusList.find(i => i.value == arr.data.status)
+                        if (status) arr.data.zhStatus = status.label;
+                        if (arr.data.player_type == 'Race.User') { arr.data.type_name = '单打' }
+                        if (arr.data.player_type == 'Race.TeamApply') { arr.data.type_name = '双打' }
+                        that.setData({ form: arr.data })
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            },
+            fail: async res => {
+                wx.redirectTo({ url: '/pages/index/index' })
+            }
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () { },
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () { },
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 7 - 0
pagesMatch/matchAdmin/elimmatch/edit.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+      "mobile-main": "/commpents/mobile-frame/index",
+      "datatime-picker": "/commpents/datetime-picker/index"
+    }
+  }

+ 34 - 0
pagesMatch/matchAdmin/elimmatch/edit.less

@@ -0,0 +1,34 @@
+@import (css) "/app.wxss";
+
+.main {
+    background-color: var(--mainColor);
+
+    .one {
+        .content {
+            display: flex;
+            flex-direction: row;
+            border-bottom: 1px dashed var(--f1Color);
+            padding: 2vw 0;
+            margin: 0 2vw 2vw 2vw;
+
+            .value {
+                flex-grow: 1;
+                color: var(--blackColor);
+
+                textarea {
+                    position: static;
+                    width: 72vw;
+                }
+            }
+        }
+
+        .btn {
+            text-align: center;
+            margin: 3vw 0;
+
+            button {
+                margin: 0 2vw;
+            }
+        }
+    }
+}

+ 109 - 0
pagesMatch/matchAdmin/elimmatch/edit.wxml

@@ -0,0 +1,109 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="container main">
+        <view class="one">
+            <form catchsubmit="onSubmit">
+                <view class="content" style="display: none;">
+                    <view class="label">数据id:</view>
+                    <view class="value">
+                        <input type="text" name="_id" value="{{form._id}}" placeholder="请输入数据id" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="matchChange" name="match_id" value="{{form.match_id}}" range="{{matchList}}" range-key="name">
+                            <view class="picker">{{form.match_id_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_id_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_id_name||'请选择组内项目'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">小组名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="teamChange" name="team_id" value="{{form.team_id}}" range="{{teamList}}" range-key="name">
+                            <view class="picker">{{form.team_id_name||'请选择小组名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">场地名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="addressChange" name="address_id" value="{{form.address_id}}" range="{{addressList}}" range-key="name">
+                            <view class="picker">{{form.address_id_name||'请选择场地名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">裁判名称:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="refereeChange" name="referee_id" value="{{form.referee_id}}" range="{{refereeList}}" range-key="name">
+                            <view class="picker">{{form.referee_id_name||'请选择裁判名称'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">比赛时间:</view>
+                    <view class="value">
+                        <datatime-picker datetime="{{form.match_time}}" name="match_time" bind:datetimeChange="datetimeChange"></datatime-picker>
+                    </view>
+                </view>
+                <view class="content" style="display: none;">
+                    <view class="label">选手类型:</view>
+                    <view class="value">
+                        <input type="text" name="player_type" value="{{form.player_type}}" placeholder="请输入选手类型" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">选手类型:</view>
+                    <view class="value">
+                        <input type="text" name="type_name" value="{{form.type_name}}" disabled placeholder="请输入选手类型" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">选手一:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="oneMemberChange" name="player_one" value="{{form.player_one}}" range="{{memberList}}" range-key="name">
+                            <view class="picker">{{form.player_one_name||'请选择选手一'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">选手二:</view>
+                    <view class="value">
+                        <picker mode="selector" bindchange="twoMemberChange" name="player_two" value="{{form.player_two}}" range="{{memberList}}" range-key="name">
+                            <view class="picker">{{form.player_two_name||'请选择选手二'}}</view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">赛程状态:</view>
+                    <view class="value">
+                        <view class="value">
+                            <picker mode="selector" bindchange="statusChange" name="status" value="{{form.status}}" range="{{statusList}}" range-key="label">
+                                <view class="picker">{{form.zhStatus||'请选择赛程状态'}}</view>
+                            </picker>
+                        </view>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
+        </view>
+    </view>
+</mobile-main>

+ 26 - 0
pagesMatch/matchAdmin/elimmatch/edit.wxss

@@ -0,0 +1,26 @@
+@import "/app.wxss";
+.main {
+  background-color: var(--mainColor);
+}
+.main .one .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.main .one .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.main .one .content .value textarea {
+  position: static;
+  width: 72vw;
+}
+.main .one .btn {
+  text-align: center;
+  margin: 3vw 0;
+}
+.main .one .btn button {
+  margin: 0 2vw;
+}

+ 140 - 6
pagesMatch/matchAdmin/elimmatch/list.js

@@ -1,11 +1,129 @@
 const app = getApp();
+import WxValidate from '../../../utils/wxValidate';
 Page({
     data: {
-        frameStyle: { useTop: true, name: '淘汰赛赛程设置', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '赛程设置', leftArrow: true, useBar: false },
+        // 赛事列表
+        matchList: [],
+        match: {},
+        dialog: { title: '赛程上分', show: false, type: '1' },
+        form: {},
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        statusList: []
+    },
+    initValidate() {
+        const rules = { player_one_score: { required: true }, player_two_score: { required: true } }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { player_one_score: { required: '选手一比分' }, player_two_score: { required: '选手二比分' } };
+        this.WxValidate = new WxValidate(rules, messages)
     },
     // 返回
     back: function () { wx.navigateBack({ delta: 1 }) },
-
+    // 添加
+    toCommon: function (e) {
+        const that = this;
+        const { item, route } = e.currentTarget.dataset;
+        that.setData({ skip: 0, page: 0, list: [] });
+        wx.navigateTo({ url: `/pagesMatch/${route}?id=${item && item._id ? item._id : ''}` })
+    },
+    // 赛程上分
+    toScore: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        that.setData({ form: item })
+        that.setData({ dialog: { title: '赛程上分', show: true, type: '1' } })
+    },
+    // 提交保存
+    onSubmit: async function (e) {
+        const that = this;
+        const params = e.detail.value;
+        const form = that.data.form;
+        if (!this.WxValidate.checkForm(params)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            let arr = await app.$post(`/msgs/${form.id}`, params, 'race');
+            if (arr.errcode == '0') {
+                wx.showToast({ title: `上分成功`, icon: 'success', duration: 2000 });
+                that.toClose();
+                that.setData({ skip: 0, page: 0, list: [] })
+                that.watchLogin()
+            }
+            else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+        }
+    },
+    // 删除
+    toDel: function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        wx.showModal({
+            title: '提示',
+            content: '是否确认删除该条数据?',
+            async success(res) {
+                if (res.confirm) {
+                    const arr = await app.$delete(`/msgs/${item._id}`, {}, 'race');
+                    if (arr.errcode == '0') {
+                        wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
+                        that.setData({ skip: 0, page: 0, list: [] })
+                        that.watchLogin()
+                    } else {
+                        wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
+                    }
+                }
+            }
+        })
+    },
+    // 选择赛事
+    matchChange: function (e) {
+        const that = this;
+        let data = that.data.matchList[e.detail.value];
+        if (data) {
+            that.setData({ 'match.id': data._id, 'match.name': data.name });
+            that.setData({ skip: 0, page: 0, list: [] })
+            that.search(data);
+        }
+    },
+    search: async function (e) {
+        const that = this;
+        let match = that.data.match;
+        let info = { skip: that.data.skip, limit: that.data.limit, match_id: match.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 }) }
+    },
+    // 分页
+    toPage: function () {
+        const that = this;
+        let list = that.data.list;
+        let limit = that.data.limit;
+        if (that.data.total > list.length) {
+            wx.showLoading({ title: '加载中', mask: true })
+            let page = that.data.page + 1;
+            that.setData({ page: page })
+            let skip = page * limit;
+            that.setData({ skip: skip })
+            that.search();
+            wx.hideLoading()
+        } else { wx.showToast({ title: '没有更多数据了', icon: 'none', duration: 2000 }) }
+    },
+    // 关闭弹框
+    toClose: function () {
+        const that = this;
+        that.setData({ form: {} })
+        that.setData({ dialog: { title: '赛程上分', show: false, type: '1' } })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -17,17 +135,32 @@ Page({
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow: function () {
+    onShow: async function () {
         const that = this;
+        //验证规则函数
+        that.initValidate();
+        // 查询其他信息
+        await that.searchOther();
         // 监听用户是否登录
-        that.watchLogin();
+        await that.watchLogin();
+    },
+    searchOther: async function () {
+        const that = this;
+        let arr;
+        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 () {
         const that = this;
         wx.getStorage({
             key: 'raceuser',
-            success: async res => { },
+            success: async res => {
+                let arr;
+                arr = await app.$get(`/match`, { belong_id: res.data._id }, 'race');  
+                if (arr.errcode == '0') { that.setData({ matchList: arr.data }) }
+                if(that.data.match&&that.data.match.id)that.search();
+            },
             fail: async res => {
                 wx.redirectTo({ url: '/pages/index/index' })
             }
@@ -40,7 +173,8 @@ Page({
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {
-
+        const that = this;
+        that.setData({ skip: 0, page: 0, list: [] })
     },
 
     /**

+ 2 - 1
pagesMatch/matchAdmin/elimmatch/list.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/index"
+      "mobile-main": "/commpents/mobile-frame/index",
+      "dialog": "/commpents/dialog/index"
     }
   }

+ 132 - 1
pagesMatch/matchAdmin/elimmatch/list.less

@@ -5,7 +5,114 @@
     background-color: var(--mainColor);
 
     .one {
-        width: 100vw;
+        display: flex;
+        flex-direction: column;
+        width: 96vw;
+        padding: 2vw;
+        border-bottom: 1px solid var(--f1Color);
+
+        .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: 60vw;
+                margin: 0 3vw;
+            }
+
+            button {
+                width: 100%;
+                padding: 2vw;
+                font-size: var(--font14Size);
+            }
+        }
+    }
+
+    .two {
+        position: relative;
+        flex-grow: 1;
+        padding: 0 2vw;
+
+        .list {
+            background-color: #328d26;
+            margin: 0 0 2vw 0;
+            padding: 2vw;
+
+            .list_0 {
+                .name {
+                    padding: 1vw 0;
+                    color: var(--whiteColor);
+                    margin: 0 0 1vw 0;
+
+                    text {
+                        padding: 0 2vw 0 0;
+                    }
+                }
+
+                .pk {
+                    display: flex;
+                    flex-direction: row;
+                    justify-content: space-around;
+                    background-color: var(--whiteColor);
+
+                    .pk_1 {
+                        width: 30vw;
+                        text-align: center;
+                        padding: 2vw;
+                    }
+
+                    .pk_2 {
+                        text-align: center;
+                        box-shadow: 0 0 5px var(--fcColor);
+
+                        .time {
+                            background-color: #328d26;
+                            color: var(--whiteColor);
+                            padding: 1vw 0;
+                            font-size: var(--font14Size);
+                        }
+
+                        .status {
+                            background-color: #328d26;
+                            color: var(--whiteColor);
+                            font-size: var(--font14Size);
+                            padding: 0 0 1vw 0;
+                        }
+
+                        .score {
+                            font-size: var(--font20Szie);
+                            padding: 1vw 0;
+                            font-weight: bold;
+                        }
+                    }
+                }
+            }
+
+            .btn {
+                text-align: center;
+                margin: 2vw 0 0 0;
+
+                button {
+                    margin: 0 2vw;
+                    font-size: var(--font14Size);
+                }
+            }
+        }
+
+        .list:last-child {
+            margin: 0;
+        }
     }
 }
 
@@ -20,4 +127,28 @@
         display: flex;
         flex-direction: column;
     }
+}
+
+.dialog_1 {
+    .content {
+        display: flex;
+        flex-direction: row;
+        border-bottom: 1px dashed var(--f1Color);
+        padding: 2vw 0;
+        margin: 0 2vw 2vw 2vw;
+
+        .value {
+            flex-grow: 1;
+            color: var(--blackColor);
+        }
+    }
+
+    .btn {
+        text-align: center;
+        margin: 3vw 0;
+
+        button {
+            margin: 0 2vw;
+        }
+    }
 }

+ 84 - 2
pagesMatch/matchAdmin/elimmatch/list.wxml

@@ -1,7 +1,89 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
         <view class="one">
-            淘汰赛赛程设置
+            <view class="one_1">
+                <input type="text" placeholder="请输入关键词" />
+            </view>
+            <view class="one_2">
+                <view class="one_2_1">
+                    <picker mode="selector" bindchange="matchChange" name="id" value="{{match.id}}" range="{{matchList}}" range-key="name">
+                        <button type="primary" class="textOver">{{match.name||'选择赛事'}}</button>
+                    </picker>
+                </view>
+                <view class="one_2_1">
+                    <button type="primary" bindtap="toCommon" data-route="matchAdmin/elimmatch/add">添加赛程</button>
+                </view>
+            </view>
+        </view>
+        <view class="two">
+            <scroll-view scroll-y="true" class="scroll-view" bindscrolltolower="toPage">
+                <view class="list-scroll-view">
+                    <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.team_id_name}}</text>
+                                <text>{{item.address_id_name}}</text>
+                            </view>
+                            <view class="pk">
+                                <view class="pk_1">
+                                    <text>{{item.player_one_name}}</text>
+                                </view>
+                                <view class="pk_2">
+                                    <view class="time">{{item.match_time}}</view>
+                                    <view class="status">{{item.zhStatus}}</view>
+                                    <view class="score"><text>{{item.player_one_score||0}}</text>-{{item.player_two_score||0}}</view>
+                                </view>
+                                <view class="pk_1">
+                                    <text>{{item.player_two_name}}</text>
+                                </view>
+                            </view>
+                        </view>
+                        <view class="btn">
+                            <button type="primary" size="mini" bindtap="toCommon" data-route="matchAdmin/elimmatch/edit" data-item="{{item}}">信息维护</button>
+                            <button type="primary" size="mini" bindtap="toScore" wx:if="{{item.status=='1'}}" data-item="{{item}}">赛程上分</button>
+                            <button type="warn" size="mini" bindtap="toDel" wx:if="{{item.status=='0'}}" data-item="{{item}}">赛事删除</button>
+                        </view>
+                    </view>
+                </view>
+            </scroll-view>
+        </view>
+    </view>
+</mobile-main>
+<dialog dialog="{{dialog}}" bind:toClose="toClose">
+    <view slot="info" class="dialog">
+        <view class="dialog_1" wx:if="{{dialog.type=='1'}}">
+            <form catchsubmit="onSubmit">
+                <view class="content">
+                    <view class="label">选手一:</view>
+                    <view class="value">
+                        <input type="text" name="player_one_name" value="{{form.player_one_name}}" disabled placeholder="请输入选手一" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">选手一比分:</view>
+                    <view class="value">
+                        <input type="text" name="player_one_score" value="{{form.player_one_score}}" placeholder="请输入选手一比分" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">选手二:</view>
+                    <view class="value">
+                        <input type="text" name="player_two_name" value="{{form.player_two_name}}" disabled placeholder="请输入选手二" />
+                    </view>
+                </view>
+                <view class="content">
+                    <view class="label">选手二比分:</view>
+                    <view class="value">
+                        <input type="text" name="player_two_score" value="{{form.player_two_score}}" placeholder="请输入选手二比分" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" size="mini" formType="submit">提交保存</button>
+                </view>
+            </form>
         </view>
     </view>
-</mobile-main>
+</dialog>

+ 106 - 1
pagesMatch/matchAdmin/elimmatch/list.wxss

@@ -4,7 +4,94 @@
   background-color: var(--mainColor);
 }
 .main .one {
-  width: 100vw;
+  display: flex;
+  flex-direction: column;
+  width: 96vw;
+  padding: 2vw;
+  border-bottom: 1px solid var(--f1Color);
+}
+.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: 60vw;
+  margin: 0 3vw;
+}
+.main .one .one_2 button {
+  width: 100%;
+  padding: 2vw;
+  font-size: var(--font14Size);
+}
+.main .two {
+  position: relative;
+  flex-grow: 1;
+  padding: 0 2vw;
+}
+.main .two .list {
+  background-color: #328d26;
+  margin: 0 0 2vw 0;
+  padding: 2vw;
+}
+.main .two .list .list_0 .name {
+  padding: 1vw 0;
+  color: var(--whiteColor);
+  margin: 0 0 1vw 0;
+}
+.main .two .list .list_0 .name text {
+  padding: 0 2vw 0 0;
+}
+.main .two .list .list_0 .pk {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-around;
+  background-color: var(--whiteColor);
+}
+.main .two .list .list_0 .pk .pk_1 {
+  width: 30vw;
+  text-align: center;
+  padding: 2vw;
+}
+.main .two .list .list_0 .pk .pk_2 {
+  text-align: center;
+  box-shadow: 0 0 5px var(--fcColor);
+}
+.main .two .list .list_0 .pk .pk_2 .time {
+  background-color: #328d26;
+  color: var(--whiteColor);
+  padding: 1vw 0;
+  font-size: var(--font14Size);
+}
+.main .two .list .list_0 .pk .pk_2 .status {
+  background-color: #328d26;
+  color: var(--whiteColor);
+  font-size: var(--font14Size);
+  padding: 0 0 1vw 0;
+}
+.main .two .list .list_0 .pk .pk_2 .score {
+  font-size: var(--font20Szie);
+  padding: 1vw 0;
+  font-weight: bold;
+}
+.main .two .list .btn {
+  text-align: center;
+  margin: 2vw 0 0 0;
+}
+.main .two .list .btn button {
+  margin: 0 2vw;
+  font-size: var(--font14Size);
+}
+.main .two .list:last-child {
+  margin: 0;
 }
 .scroll-view {
   position: absolute;
@@ -17,3 +104,21 @@
   display: flex;
   flex-direction: column;
 }
+.dialog_1 .content {
+  display: flex;
+  flex-direction: row;
+  border-bottom: 1px dashed var(--f1Color);
+  padding: 2vw 0;
+  margin: 0 2vw 2vw 2vw;
+}
+.dialog_1 .content .value {
+  flex-grow: 1;
+  color: var(--blackColor);
+}
+.dialog_1 .btn {
+  text-align: center;
+  margin: 3vw 0;
+}
+.dialog_1 .btn button {
+  margin: 0 2vw;
+}