zs 1 年間 前
コミット
2b251cc03b

+ 6 - 1
app.json

@@ -22,7 +22,9 @@
             "root": "pagesMatch",
             "independent": true,
             "pages": [
-                "home/index"
+                "home/index",
+                "apply/index",
+                "enroll/index"
             ]
         },
         {
@@ -32,9 +34,12 @@
                 "home/index",
                 "basic/index",
                 "match/index",
+                "course/index",
+                "score/index",
                 "team/index",
                 "teamCreate/index",
                 "apply/index",
+                "ranking/index",
                 "update/index"
             ]
         },

+ 24 - 0
pagesHome/home/index.js

@@ -1,6 +1,7 @@
 const app = getApp()
 Page({
     data: {
+        user: {},
         searchInfo: {},
         list: [],
         total: 0,
@@ -17,6 +18,16 @@ Page({
         else if (data.type == '2') wx.relaunch({ url })
         else if (data.type == '3') wx.switchTab({ url })
     },
+    // 查看
+    async toView(e) {
+        const that = this;
+        if (that.data.user._id) {
+            const item = e.currentTarget.dataset.item
+            wx.navigateTo({ url: '/pagesMatch/apply/index?id=' + item._id })
+        } else {
+            wx.navigateTo({ url: '/pagesCommon/login/index' })
+        }
+    },
     // 查询
     async toSearch(e) {
         const that = this;
@@ -30,10 +41,23 @@ Page({
     async onLoad(options) {
         const that = this;
         wx.showLoading({ title: '加载中', mask: true })
+        await that.searchUser()
         await that.searchOther()
         await that.search()
         wx.hideLoading()
     },
+    async searchUser() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
     // 查询通知
     async search() {
         const that = this;

+ 1 - 1
pagesHome/home/index.wxml

@@ -5,7 +5,7 @@
         </view>
         <view class="two">
             <scroll-view class="scroll-view" scroll-y="true" bindscrolltolower="toLower" bindscroll="toScroll">
-                <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item">
+                <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item" data-item="{{item}}" bindtap="toView">
                     <view class="list_1">
                         <view class="name textOver"> {{item.name||"暂无比赛名称"}} </view>
                         <view class="color{{item.status}}"> {{item.status_name||'暂无状态'}} </view>

+ 128 - 0
pagesMatch/apply/index.js

@@ -0,0 +1,128 @@
+const app = getApp()
+const moment = require("../../utils/moment.min");
+Page({
+    data: {
+        id: "",
+        info: {},
+        user: {},
+        statusList: [],
+        list: []
+    },
+    // 报名
+    async toAdd() {
+        const that = this;
+        if (that.data.user._id) {
+            wx.navigateTo({ url: '/pagesMatch/enroll/index?match=' + that.data.info._id })
+        } else {
+            wx.navigateTo({ url: '/pagesCommon/login/index' })
+        }
+    },
+    // 排名
+    toRank() {
+        const that = this;
+        wx.navigateTo({ url: '/pagesMy/ranking/index?id=' + that.data.info._id })
+    },
+    // 字典
+    getDict(value, model) {
+        const that = this;
+        if (model == 'status') {
+            if (value) {
+                let data = that.data.statusList.find(i => i.value == value)
+                if (data) return data.label
+                else return '暂无'
+            }
+        }
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        that.setData({ id: options.id });
+        wx.showLoading({ title: '加载中', mask: true })
+        await that.searchUser()
+        await that.searchOther()
+        await that.search()
+        wx.hideLoading()
+    },
+    async searchUser() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        res = await app.$api('dictData', 'GET', { type: 'match_status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+    },
+    // 查询通知
+    async search() {
+        const that = this;
+        let res = await app.$api(`match/${that.data.id}`, 'GET', {})
+        if (res.errcode == '0') {
+            res.data.status_name = that.getDict(res.data.status, 'status')
+            if (res.data.information) res.data.information = res.data.information.replace(/\<img/gi,
+                '<img class="rich-img"');
+            that.setData({ info: res.data })
+            const arr = await app.$api(`course`, 'GET', { match_id: res.data._id })
+            if (arr.errcode == '0') { that.setData({ list: arr.data }) }
+        }
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 3 - 0
pagesMatch/apply/index.json

@@ -0,0 +1,3 @@
+{
+    "navigationBarTitleText": "比赛详情"
+}

+ 40 - 0
pagesMatch/apply/index.wxml

@@ -0,0 +1,40 @@
+<view class="main">
+    <view class="one">
+        <view class="name textOver">{{info.name||"暂无比赛名称"}}<text class="color{{info.status}}">({{info.status_name}})</text></view>
+        <view class="other">开始时间:{{info.start_time||"暂无开始时间"}}</view>
+        <view class="other">结束时间:{{info.end_time||"暂无结束时间"}}</view>
+        <view class="other">比赛地点:{{info.address||"暂无比赛地点"}}</view>
+        <view class="other">报名截止时间:{{info.sign_deadline||"暂无报名截止时间"}}</view>
+    </view>
+    <view class="two">
+        <rich-text nodes="{{info.information}}"></rich-text>
+    </view>
+    <view class="two" wx:if="{{list.length>0}}">
+        <scroll-view class="scroll-view" scroll-y="true" bindscroll="toScroll">
+            <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item">
+                <view class="list_1">
+                    <view class="left textOver">{{item.red_team_name}} </view>
+                    <view class="center">
+                        <view class="red">{{item.red_score}}</view>
+                        <view>:</view>
+                        <view class="blue">{{item.blue_score}}</view>
+                    </view>
+                    <view class="right textOver">{{item.blue_team_name}}</view>
+                </view>
+                <view class="list_2">
+                    <view class="other">
+                        {{item.match_time}}
+                    </view>
+                </view>
+            </view>
+        </scroll-view>
+    </view>
+    <view class="thr">
+        <button wx:if="{{info.status=='0'&&user.type=='1'}}" class="btn" type="primary" size="mini" bindtap="toAdd">
+            报名
+        </button>
+        <button class="btn" type="primary" size="mini" bindtap="toRank">
+            排名
+        </button>
+    </view>
+</view>

+ 123 - 0
pagesMatch/apply/index.wxss

@@ -0,0 +1,123 @@
+@import "../../app.wxss";
+
+.main {
+    padding: 2vw;
+}
+
+.main .one {
+    border: 1px solid var(--rgb40E);
+    margin: 4vw 0 0 0;
+    padding: 1vw 2vw;
+    border-radius: 20rpx;
+    box-shadow: 0 0 10px 2px var(--rgb40E);
+}
+
+.main .one .two_1 {
+    width: 96%;
+    display: flex;
+    justify-content: space-around;
+    flex-wrap: wrap;
+    padding: 2vw;
+}
+
+.main .one .name {
+    text-align: center;
+    font-size: 18px;
+    font-weight: bold;
+    margin: 0 0 1vw 0;
+}
+
+.main .one .name text {
+    font-size: 14px;
+}
+
+.main .one .name .color0 {
+    color: var(--rgb67c)
+}
+
+.main .one .name .color1 {
+    color: var(--rgbff0)
+}
+
+.main .one .name .color2 {
+    color: var(--rgb46a)
+}
+
+.main .one .name .color-1 {
+    color: var(--rgb8b8)
+}
+
+.main .one .other {
+    margin: 0 0 1vw 0;
+    font-size: 14px;
+    color: #868686;
+}
+
+.main .two {
+    border: 1px solid var(--rgb40E);
+    margin: 4vw 0 0 0;
+    padding: 1vw 2vw;
+    border-radius: 20rpx;
+    box-shadow: 0 0 10px 2px var(--rgb40E);
+}
+
+.main .two .list {
+    padding: 2vw;
+    margin: 0 0 2vw 0;
+    border-radius: 25rpx;
+    border: 1px solid var(--rgb40E);
+}
+
+.main .two .list .list_1 {
+    display: flex;
+    justify-content: space-around;
+    padding: 2vw 0;
+    font-weight: bold;
+}
+
+.main .two .list .list_1 .left {
+    width: 40%;
+    text-align: center;
+    font-size: 18px;
+}
+
+.main .two .list .list_1 .right {
+    width: 40%;
+    text-align: center;
+    font-size: 18px;
+}
+
+.main .two .list .list_1 .center {
+    width: 20%;
+    display: flex;
+    justify-content: center;
+    font-size: 18px;
+}
+
+.main .two .list .list_1 .center .red {
+    color: var(--rgbff0);
+    padding: 0 2vw;
+}
+
+.main .two .list .list_1 .center .blue {
+    color: var(--rgb46a);
+    padding: 0 2vw;
+}
+
+.main .two .list .list_2 {
+    text-align: center;
+    font-size: 14px;
+}
+
+.main .thr {
+    margin: 2vw 0;
+    text-align: center;
+}
+
+.main .thr .btn {
+    margin: 0 2vw;
+    background-color: var(--rgb40E);
+    background-image: linear-gradient(to right, var(--rgb3AB), var(--rgb40E));
+    border-radius: 20rpx;
+    font-size: 15px;
+}

+ 196 - 0
pagesMatch/enroll/index.js

@@ -0,0 +1,196 @@
+const app = getApp()
+import WxValidate from '../../utils/wxValidate'
+const moment = require("../../utils/moment.min");
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        disabled: false,
+        match_id: '',
+        id: '',
+        user: {},
+        form: {},
+        info: {},
+        // 团队
+        teamList: [],
+        // 成员
+        member: '',
+        memberList: []
+    },
+    initValidate() {
+        const rules = { match_name: { required: true }, team_name: { required: true } }
+        const messages = { match_name: { required: '请输入比赛名称' }, team_name: { required: '请输入团队名称' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        if (options.id) that.setData({ disabled: true });
+        that.setData({ match_id: options.match, id: options.id });
+        wx.showLoading({ title: '加载中', mask: true })
+        //验证规则函数
+        that.initValidate();
+        await that.searchOther()
+        await that.search()
+        wx.hideLoading()
+    },
+    search() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+                if (that.data.id) {
+                    let arr = await app.$api(`application/${that.data.id}`, 'GET', {})
+                    if (arr.errcode == '0') {
+                        let data = that.data.teamList.find(i => i._id == arr.data.team_id);
+                        if (data) that.setData({ userList: data.member })
+                        that.setData({ form: arr.data, memberList: arr.data.user_id })
+                    }
+                } else {
+                    let aee = await app.$api(`match/${that.data.match_id}`, 'GET', {})
+                    if (aee.errcode == '0') {
+                        that.setData({ 'form.match_id': aee.data._id, 'form.match_name': aee.data.name })
+                    }
+                }
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
+    // 过滤字典表
+    getDict(value, model) {
+        const that = this;
+        if (value) {
+            let list = that.data[model + 'List']
+            let data = list.find(i => i.value == value);
+            if (data) return data.label
+            else return '暂无'
+        }
+    },
+    // 选择团队
+    async teamChange(e) {
+        const that = this;
+        const index = e.detail.value;
+        let data = that.data.teamList[index];
+        if (data) {
+            that.setData({ 'form.team_id': data._id })
+            that.setData({ 'form.team_name': data.name })
+            that.setData({ member: '', memberList: [] })
+            that.setData({ userList: data.member })
+        }
+    },
+    // 选择成员
+    userChange(e) {
+        const that = this;
+        const memberList = that.data.memberList
+        const index = e.detail.value;
+        let data = that.data.userList[index];
+        if (data) {
+            const res = memberList.find(i => i._id == data._id)
+            if (!res) {
+                memberList.push(data)
+                that.setData({ memberList, 'form.num': memberList.length.toString() })
+                that.setData({ member: data.name })
+            }
+        }
+    },
+    // 删除成员
+    async toDel(e) {
+        const that = this;
+        let res = e.currentTarget.dataset.item
+        if (res) {
+            let memberList = that.data.memberList.filter(i => i._id != res._id);
+            that.setData({ memberList, 'form.num': memberList.length.toString() })
+        }
+    },
+    // 提交保存
+    async toSave(e) {
+        const that = this;
+        const parmas = e.detail.value;
+        if (!this.WxValidate.checkForm(parmas)) {
+            const error = that.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            if (that.data.memberList.length > 0) {
+                parmas.apply_time = moment().format('YYYY-MM-DD HH:mm:ss')
+                parmas.user_id = that.data.memberList
+                parmas.num = that.data.memberList.length.toString()
+                let res
+                if (that.data.id) res = await app.$api(`application/${that.data.id}`, 'POST', parmas);
+                else res = await app.$api('application', 'POST', parmas);
+                if (res.errcode == '0') {
+                    wx.showToast({ title: `信息提交成功`, icon: 'success' });
+                    wx.navigateBack({ delta: 1 });
+                } else {
+                    wx.showToast({ title: `${res.errmsg}`, icon: 'none' });
+                }
+            } else {
+                wx.showToast({ title: `请选择参加比赛成员`, icon: 'none' });
+            }
+        }
+    },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        // 团队
+        res = await app.$api('team', 'GET', { administrator: that.data.user._id, status: '1' })
+        if (res.errcode == '0') that.setData({ teamList: res.data })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 3 - 0
pagesMatch/enroll/index.json

@@ -0,0 +1,3 @@
+{
+    "navigationBarTitleText": "报名"
+}

+ 96 - 0
pagesMatch/enroll/index.wxml

@@ -0,0 +1,96 @@
+<view class=" content main">
+    <view class="one">
+        <form catchsubmit="toSave">
+            <view class="info">
+                <view class="info_1" style="display: none;">
+                    <view class="label">
+                        match_id:
+                    </view>
+                    <view class="value">
+                        <input disabled value="{{form.match_id}}" name="match_id" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1">
+                    <view class="label">
+                        比赛名称:
+                    </view>
+                    <view class="value">
+                        <input disabled value="{{form.match_name}}" name="match_name" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1" style="display: none;">
+                    <view class="label">
+                        team_id:
+                    </view>
+                    <view class="value">
+                        <input disabled value="{{form.team_id}}" name="team_id" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1">
+                    <view class="label">
+                        团队:
+                    </view>
+                    <view class="value">
+                        <picker disabled="{{disabled}}" bindchange="teamChange" value="{{form.team_name}}" name="team_name" range="{{teamList}}" range-key='name'>
+                            <view class="picker">
+                                {{form.team_name||''}}
+                            </view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="info_1">
+                    <view class="label">
+                        团队成员选择:
+                    </view>
+                    <view class="value">
+                        <picker bindchange="userChange" value="{{member}}" range="{{userList}}" range-key='name'>
+                            <view class="picker">
+                                {{member||''}}
+                            </view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="info_1">
+                    <view class="label">
+                        团队成员:
+                    </view>
+                    <view class="value">
+                        <view class="list">
+                            <view wx:for="{{memberList}}" wx:key="index" wx:for-item="item" class="name">
+                                <view>{{item.name}}</view>
+                                <icon class="icon-small icon" type="cancel" size="18" data-item="{{item}}" bindtap="toDel"></icon>
+                            </view>
+                        </view>
+                    </view>
+                </view>
+                <view class="info_1" wx:if="{{id}}">
+                    <view class="label">
+                        参赛人数:
+                    </view>
+                    <view class="value">
+                        <input disabled value="{{form.num}}" name="num" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1" wx:if="{{id}}">
+                    <view class="label">
+                        申请时间:
+                    </view>
+                    <view class="value">
+                        <input disabled value="{{form.apply_time}}" name="apply_time" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1" wx:if="{{id}}">
+                    <view class="label">
+                        分数:
+                    </view>
+                    <view class="value">
+                        <input disabled value="{{form.score}}" name="score" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" formType="submit">申请报名</button>
+                </view>
+            </view>
+        </form>
+    </view>
+</view>

+ 61 - 0
pagesMatch/enroll/index.wxss

@@ -0,0 +1,61 @@
+@import "../../app.wxss";
+
+.main {
+    padding: 2vw;
+}
+
+.main .one .info {
+    margin: 0 0 2vw 0;
+}
+
+.main .one .info .info_1 {
+    display: flex;
+    align-items: center;
+    border: 1px solid var(--rgb40E);
+    padding: 2vw;
+    border-radius: 5px;
+    margin: 0 0 3vw 0;
+}
+
+.main .one .info .info_1 .label {
+    font-size: 14px;
+    color: var(--rgb8b8);
+}
+
+.main .one .info .info_1 .value {
+    width: 68%;
+    flex-grow: 1;
+    font-size: 14px;
+}
+
+.main .one .info .info_1 .value .picker {
+    height: 20px;
+    overflow: hidden;
+}
+
+.main .one .info .info_1 .value .list {
+    display: flex;
+    flex-wrap: wrap;
+}
+
+.main .one .info .info_1 .value .list .name {
+    display: flex;
+    align-items: center;
+    border: 1px solid var(--rgb8b8);
+    margin: 0 10rpx 0 0;
+    padding: 5rpx 8rpx;
+    border-radius: 15rpx;
+}
+
+.main .one .btn {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.main .one .btn button {
+    margin: 0 2vw;
+    background-color: var(--rgb40E);
+    background-image: linear-gradient(to right, var(--rgb3AB), var(--rgb40E));
+    border-radius: 30rpx;
+}

+ 24 - 0
pagesMatch/home/index.js

@@ -1,6 +1,7 @@
 const app = getApp()
 Page({
     data: {
+        user: {},
         searchInfo: {},
         list: [],
         total: 0,
@@ -37,6 +38,16 @@ Page({
         else if (data.type == '2') wx.relaunch({ url })
         else if (data.type == '3') wx.switchTab({ url })
     },
+    // 查看
+    async toView(e) {
+        const that = this;
+        if (that.data.user._id) {
+            const item = e.currentTarget.dataset.item
+            wx.navigateTo({ url: '/pagesMatch/apply/index?id=' + item._id })
+        } else {
+            wx.navigateTo({ url: '/pagesCommon/login/index' })
+        }
+    },
     // 查询
     async toSearch(e) {
         const that = this;
@@ -50,10 +61,23 @@ Page({
     async onLoad(options) {
         const that = this;
         wx.showLoading({ title: '加载中', mask: true })
+        await that.searchUser()
         await that.searchOther()
         await that.search()
         wx.hideLoading()
     },
+    async searchUser() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
     // 查询通知
     async search() {
         const that = this;

+ 1 - 1
pagesMatch/home/index.wxml

@@ -8,7 +8,7 @@
         <swiper class='swiper' current="{{active}}" duration="300" bindchange="swiperTab">
             <swiper-item wx:for="{{tabList}}" wx:key="index" wx:for-item="item">
                 <scroll-view class="scroll-view" scroll-y="true" bindscrolltolower="toLower" bindscroll="toScroll">
-                    <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item">
+                    <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item" data-item="{{item}}" bindtap="toView">
                         <view class="list_1">
                             <view class="name textOver"> {{item.name||"暂无比赛名称"}} </view>
                             <view class="color{{item.status}}"> {{item.status_name||'暂无状态'}} </view>

+ 154 - 0
pagesMy/course/index.js

@@ -0,0 +1,154 @@
+const app = getApp()
+Page({
+    data: {
+        id: '',
+        // 用户信息
+        user: {},
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        statusList: []
+    },
+    // 上传比分
+    async toUpload(e) { 
+        let item = e.currentTarget.dataset.item
+        wx.navigateTo({ url: '/pagesMy/score/index?id=' + item._id })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        that.setData({ id: options.id });
+    },
+    /**
+    * 生命周期函数--监听页面显示
+    */
+    async onShow() {
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        await that.searchUser()
+        await that.searchOther()
+        await that.clearPage()
+        await that.search()
+        wx.hideLoading()
+    },
+    async searchUser() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
+    // 查询通知
+    async search() {
+        const that = this;
+        let info = { skip: that.data.skip, limit: that.data.limit };
+        info.match_id = that.data.id
+        let res = await app.$api('course', 'GET', { ...info})
+        if (res.errcode == '0') {
+            let list = [...that.data.list, ...res.data]
+            for (const val of list) {
+                val.status_name = that.getDict(val.status, 'status')
+            }
+            that.setData({ list })
+            that.setData({ total: res.total })
+        }
+    },
+    // 分页-触底
+    toLower() {
+        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 })
+            let skip = page * limit
+            that.setData({ skip })
+            that.search()
+            wx.hideLoading()
+        } else {
+            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
+        }
+    },
+    // 分页-滚动
+    toScroll() {
+        // console.log('滚动');
+    },
+    // 字典
+    getDict(value, model) {
+        const that = this;
+        if (model == 'status') {
+            if (value) {
+                let data = that.data.statusList.find(i => i.value == value)
+                if (data) return data.label
+                else return '暂无'
+            }
+        }
+    },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        res = await app.$api('dictData', 'GET', { type: 'course_status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 3 - 0
pagesMy/course/index.json

@@ -0,0 +1,3 @@
+{
+    "navigationBarTitleText": "赛程安排"
+}

+ 26 - 0
pagesMy/course/index.wxml

@@ -0,0 +1,26 @@
+<view class=" content main">
+    <view class="one">
+        <scroll-view class="scroll-view" scroll-y="true" bindscrolltolower="toLower" bindscroll="toScroll">
+            <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item">
+                <view class="list_1">
+                    <view class="left textOver">{{item.red_team_name}} </view>
+                    <view class="center">
+                        <view class="red">{{item.red_score}}</view>
+                        <view>:</view>
+                        <view class="blue">{{item.blue_score}}</view>
+                    </view>
+                    <view class="right textOver">{{item.blue_team_name}}</view>
+                </view>
+                <view class="list_2">
+                    {{item.match_time}}
+                    <text class="color{{item.status}}">({{item.status_name}})</text>
+                </view>
+                <view class="button">
+                    <button wx:if="{{item.status=='1'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toUpload">
+                        上传比分
+                    </button>
+                </view>
+            </view>
+        </scroll-view>
+    </view>
+</view>

+ 90 - 0
pagesMy/course/index.wxss

@@ -0,0 +1,90 @@
+@import "../../app.wxss";
+
+.main {
+    padding: 2vw;
+}
+
+.main .one {
+    padding: 2vw 0 0 0;
+}
+
+.main .one .scroll-view {
+    height: 96vh;
+}
+
+.main .one .list {
+    padding: 2vw;
+    margin: 0 0 2vw 0;
+    border-radius: 25rpx;
+    border: 1px solid var(--rgb40E);
+}
+
+.main .one .list .list_1 {
+    display: flex;
+    justify-content: space-around;
+    padding: 2vw 0;
+    font-weight: bold;
+}
+
+.main .one .list .list_1 .left {
+    width: 40%;
+    text-align: center;
+    font-size: 18px;
+}
+
+.main .one .list .list_1 .right {
+    width: 40%;
+    text-align: center;
+    font-size: 18px;
+}
+
+.main .one .list .list_1 .center {
+    width: 20%;
+    display: flex;
+    justify-content: center;
+    font-size: 18px;
+}
+
+.main .one .list .list_1 .center .red {
+    color: var(--rgbff0);
+    padding: 0 2vw;
+}
+
+.main .one .list .list_1 .center .blue {
+    color: var(--rgb46a);
+    padding: 0 2vw;
+}
+
+.main .one .list .list_2 {
+    text-align: center;
+    font-size: 14px;
+}
+
+.main .one .list .list_2 .color0 {
+    color: var(--rgb67c)
+}
+
+.main .one .list .list_2 .color1 {
+    color: var(--rgbff0)
+}
+
+.main .one .list .list_2 .color-1 {
+    color: var(--rgb8b8)
+}
+
+.main .one .list .button {
+    padding: 1vw 0;
+    text-align: center;
+}
+
+.main .one .list .button .btn {
+    margin: 0 2vw;
+    background-color: var(--rgb40E);
+    background-image: linear-gradient(to right, var(--rgb3AB), var(--rgb40E));
+    border-radius: 30rpx;
+    font-size: 15px;
+}
+
+.type {
+    width: 100% !important;
+}

+ 117 - 10
pagesMy/match/index.js

@@ -1,22 +1,135 @@
 const app = getApp()
 Page({
     data: {
-        info: {}
+        // 用户信息
+        user: {},
+        searchInfo: {},
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        statusList: []
+    },
+    // 查询
+    async toSearch(e) {
+        const that = this;
+        that.setData({ 'searchInfo.name': e.detail.value })
+        that.clearPage();
+        that.search()
+    },
+    // 查看
+    toView(e) {
+        let item = e.currentTarget.dataset.item
+        wx.navigateTo({ url: '/pagesTeam/apply/index?id=' + item._id })
+    },
+    // 赛程安排
+    toCourse(e) {
+        let item = e.currentTarget.dataset.item
+        wx.navigateTo({ url: '/pagesMy/course/index?id=' + item.match_id })
+    },
+    // 排名
+    toRank(e) {
+        let item = e.currentTarget.dataset.item
+        wx.navigateTo({ url: '/pagesMy/ranking/index?id=' + item.match_id })
+    },
+    // 修改
+    toEdit(e) {
+        let item = e.currentTarget.dataset.item
+        wx.navigateTo({ url: '/pagesMatch/enroll/index?id=' + item._id })
     },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad(options) {
+    async onLoad(options) {
+
+    },
+    /**
+    * 生命周期函数--监听页面显示
+    */
+    async onShow() {
         const that = this;
         wx.showLoading({ title: '加载中', mask: true })
-        that.search()
+        await that.searchUser()
+        await that.searchOther()
+        await that.clearPage()
+        await that.search()
         wx.hideLoading()
     },
+    async searchUser() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
     // 查询通知
     async search() {
         const that = this;
+        let info = { skip: that.data.skip, limit: that.data.limit };
+        info.user = that.data.user._id
+        let res = await app.$api('application', 'GET', { ...info, ...that.data.searchInfo })
+        if (res.errcode == '0') {
+            let list = [...that.data.list, ...res.data]
+            for (const val of list) {
+                val.status_name = that.getDict(val.status, 'status')
+            }
+            that.setData({ list })
+            that.setData({ total: res.total })
+        }
+    },
+    // 分页-触底
+    toLower() {
+        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 })
+            let skip = page * limit
+            that.setData({ skip })
+            that.search()
+            wx.hideLoading()
+        } else {
+            wx.showToast({ title: `到底了没数据了`, icon: 'none' });
+        }
+    },
+    // 分页-滚动
+    toScroll() {
+        // console.log('滚动');
+    },
+    // 字典
+    getDict(value, model) {
+        const that = this;
+        if (model == 'status') {
+            if (value) {
+                let data = that.data.statusList.find(i => i.value == value)
+                if (data) return data.label
+                else return '暂无'
+            }
+        }
+    },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        res = await app.$api('dictData', 'GET', { type: 'status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
@@ -24,12 +137,6 @@ Page({
 
     },
 
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
 
     /**
      * 生命周期函数--监听页面隐藏

+ 38 - 1
pagesMy/match/index.wxml

@@ -1,3 +1,40 @@
 <view class=" content main">
-    我的比赛
+    <view class="one">
+        <input class="input" type="text" bindconfirm="toSearch" confirm-type="search" placeholder-style=' text-align: center;' placeholder="搜索" />
+    </view>
+    <view class="two">
+        <scroll-view class="scroll-view" scroll-y="true" bindscrolltolower="toLower" bindscroll="toScroll">
+            <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item">
+                <view class="list_1">
+                    <view class="name textOver"> {{item.match_name||"暂无比赛名称"}} </view>
+                    <view class="color{{item.status}}"> {{item.status_name||'暂无状态'}} </view>
+                </view>
+                <view class="other">
+                    <view class="other_1">
+                        团队名称:{{item.team_name||'暂无团队名称'}}
+                    </view>
+                    <view class="other_1">
+                        报名时间:{{item.apply_time||'暂无报名时间'}}
+                    </view>
+                    <view class="other_1">
+                        参赛人数:{{item.num||'暂无参赛人数'}}人
+                    </view>
+                    <view class="other_1 textOver">
+                        分数:{{item.score||'暂无分数'}}
+                    </view>
+                </view>
+                <view class="button">
+                    <button wx:if="{{item.status=='1'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toCourse">
+                        赛程安排
+                    </button>
+                    <button class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toRank">
+                        排名
+                    </button>
+                    <button wx:if="{{user.type=='1'&&item.status=='0'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toEdit">
+                        修改
+                    </button>
+                </view>
+            </view>
+        </scroll-view>
+    </view>
 </view>

+ 74 - 1
pagesMy/match/index.wxss

@@ -1 +1,74 @@
-@import "../../app.wxss";
+@import "../../app.wxss";
+
+.main {
+    padding: 2vw;
+}
+
+.main .one {
+    padding: 0 0 2vw 0;
+}
+
+.main .one .input {
+    border: 1px solid var(--rgb8b8);
+    padding: 8rpx;
+    border-radius: 15rpx;
+    background-color: #ffffff;
+}
+
+.main .two {
+    padding: 2vw 0 0 0;
+}
+
+.main .two .scroll-view {
+    height: 90vh;
+}
+
+.main .two .list {
+    margin: 0 0 2vw 0;
+    padding: 2vw;
+    border-radius: 5px;
+    border: 1px solid var(--rgb40E);
+}
+
+.main .two .list .list_1 {
+    display: flex;
+    justify-content: space-between;
+    margin: 0 0 1vw 0;
+
+}
+
+.main .two .list .list_1 .name {
+    font-size: 18px;
+    font-weight: bold;
+}
+
+.main .two .list .list_1 .color0 {
+    color: var(--rgb67c)
+}
+
+.main .two .list .list_1 .color1 {
+    color: var(--rgbff0)
+}
+
+.main .two .list .other .other_1 {
+    margin: 0 0 1vw 0;
+    font-size: 14px;
+    color: #868686;
+}
+
+.main .two .list .button {
+    padding: 1vw 0;
+    text-align: center;
+}
+
+.main .two .list .button .btn {
+    margin: 0 2vw;
+    background-color: var(--rgb40E);
+    background-image: linear-gradient(to right, var(--rgb3AB), var(--rgb40E));
+    border-radius: 30rpx;
+    font-size: 15px;
+}
+
+.type {
+    width: 100% !important;
+}

+ 86 - 0
pagesMy/ranking/index.js

@@ -0,0 +1,86 @@
+const app = getApp()
+Page({
+    data: {
+        id: '',
+        // 用户信息
+        user: {},
+        list: [],
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        that.setData({ id: options.id });
+    },
+    /**
+    * 生命周期函数--监听页面显示
+    */
+    async onShow() {
+        const that = this;
+        wx.showLoading({ title: '加载中', mask: true })
+        await that.searchUser()
+        await that.search()
+        wx.hideLoading()
+    },
+    async searchUser() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                that.setData({ user: res.data })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
+    // 查询通知
+    async search() {
+        const that = this;
+        let res = await app.$api('course/ranking', 'GET', { match_id: that.data.id })
+        if (res.errcode == '0') that.setData({ list: res.data.scoreList })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 3 - 0
pagesMy/ranking/index.json

@@ -0,0 +1,3 @@
+{
+    "navigationBarTitleText": "排名"
+}

+ 12 - 0
pagesMy/ranking/index.wxml

@@ -0,0 +1,12 @@
+<view class=" content main">
+    <view class="one">
+        <scroll-view class="scroll-view" scroll-y="true">
+            <view class="list" wx:for="{{list}}" wx:key="index" wx:for-item="item">
+                <view class="list_1">
+                    <view class="left textOver">{{item.name||'暂无团队名称'}} </view>
+                    <view class="right textOver">{{item.score||'暂无分数'}}分</view>
+                </view>
+            </view>
+        </scroll-view>
+    </view>
+</view>

+ 38 - 0
pagesMy/ranking/index.wxss

@@ -0,0 +1,38 @@
+@import "../../app.wxss";
+
+.main {
+    padding: 2vw;
+}
+
+.main .one {
+    padding: 2vw 0 0 0;
+}
+
+.main .one .scroll-view {
+    height: 96vh;
+}
+
+.main .one .list {
+    padding: 2vw;
+    margin: 0 0 2vw 0;
+    border-radius: 25rpx;
+    border: 1px solid var(--rgb40E);
+}
+
+.main .one .list .list_1 {
+    display: flex;
+    justify-content: space-between;
+    padding: 1vw 0;
+    font-weight: bold;
+    font-size: 18px;
+    border-radius: 25rpx;
+    box-shadow: 0 0 10px 2px var(--rgb40E);
+}
+
+.main .one .list .list_1 .left {
+    padding: 0 2vw;
+}
+
+.main .one .list .list_1 .right {
+    padding: 0 2vw;
+}

+ 156 - 0
pagesMy/score/index.js

@@ -0,0 +1,156 @@
+const app = getApp()
+import WxValidate from '../../utils/wxValidate'
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        id: {},
+        form: {},
+        // 性别
+        genderList: [],
+        // 状态
+        statusList: [],
+    },
+    initValidate() {
+        const rules = { red_score: { required: true }, blue_score: { required: true }, status: { required: true } }
+        const messages = { red_score: { required: '请输入红方比分' }, blue_score: { required: '请输入蓝方比分' }, status: { required: '请选择状态' } };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    async onLoad(options) {
+        const that = this;
+        that.setData({ id: options.id });
+        wx.showLoading({ title: '加载中', mask: true })
+        //验证规则函数
+        that.initValidate();
+        await that.searchOther()
+        await that.search()
+        wx.hideLoading()
+    },
+    search() {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            async success(res) {
+                let form = {}
+                let aee = await app.$api(`course/${that.data.id}`, 'GET', {})
+                if (aee.errcode == '0') {
+                    form = aee.data;
+                    if (form && form._id) {
+                        // 状态
+                        if (form.status) form.status_name = that.getDict(form.status, 'status')
+                    }
+                } else {
+                    wx.showToast({ title: `${aee.errmsg}`, icon: 'error' });
+                }
+                that.setData({ form })
+            },
+            fail(err) {
+                console.log(err);
+            }
+        })
+    },
+    // 过滤字典表
+    getDict(value, model) {
+        const that = this;
+        if (value) {
+            let list = that.data[model + 'List']
+            let data = list.find(i => i.value == value);
+            if (data) return data.label
+            else return '暂无'
+        }
+    },
+    // 选择状态
+    statusChange(e) {
+        const that = this;
+        const index = e.detail.value;
+        let data = that.data.statusList[index];
+        if (data) {
+            that.setData({ 'form.status': data.value })
+            that.setData({ 'form.status_name': data.label })
+        }
+    },
+    // 提交保存
+    async toSave(e) {
+        const that = this;
+        const parmas = e.detail.value;
+        if (!this.WxValidate.checkForm(parmas)) {
+            const error = that.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            // 判断id使用
+            let form = that.data.form;
+            let res;
+            if (form._id) res = await app.$api(`course/${form._id}`, 'POST', parmas);
+            else res = await app.$api('course', 'POST', parmas);
+            if (res.errcode == '0') {
+                wx.showToast({ title: `信息提交成功`, icon: 'success' });
+                wx.navigateBack({ delta: 1 });
+            } else {
+                wx.showToast({ title: `${res.errmsg}`, icon: 'none' });
+            }
+        }
+    },
+    // 查询其他信息
+    async searchOther() {
+        const that = this;
+        let res;
+        // 性别
+        res = await app.$api('dictData', 'GET', { type: 'course_status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 3 - 0
pagesMy/score/index.json

@@ -0,0 +1,3 @@
+{
+    "navigationBarTitleText": "上传比分"
+}

+ 55 - 0
pagesMy/score/index.wxml

@@ -0,0 +1,55 @@
+<view class=" content main">
+    <view class="one">
+        <form catchsubmit="toSave">
+            <view class="info">
+                <view class="info_1">
+                    <view class="label">
+                        红方团队:
+                    </view>
+                    <view class="value">
+                        <input disabled value="{{form.red_team_name}}" name="red_team_name" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1">
+                    <view class="label">
+                        红方分数:
+                    </view>
+                    <view class="value">
+                        <input value="{{form.red_score}}" name="red_score" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1">
+                    <view class="label">
+                        蓝方团队:
+                    </view>
+                    <view class="value">
+                        <input disabled value="{{form.blue_team_name}}" name="blue_team_name" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1">
+                    <view class="label">
+                        蓝方分数:
+                    </view>
+                    <view class="value">
+                        <input value="{{form.blue_score}}" name="blue_score" type="text" placeholder="" />
+                    </view>
+                </view>
+                <view class="info_1">
+                    <view class="label">
+                        状态:
+                    </view>
+                    <view class="value">
+                        <picker bindchange="statusChange" value="{{form.status}}" name="status" range="{{statusList}}" range-key='label'>
+                            <view class="picker">
+                                {{form.status_name||''}}
+                            </view>
+                        </picker>
+                    </view>
+                </view>
+                <view class="btn">
+                    <button type="primary" formType="submit">上传比分</button>
+                </view>
+            </view>
+        </form>
+    </view>
+</view>

+ 47 - 0
pagesMy/score/index.wxss

@@ -0,0 +1,47 @@
+@import "../../app.wxss";
+
+.main {
+    padding: 2vw;
+}
+
+.main .one .info {
+    margin: 0 0 2vw 0;
+}
+
+.main .one .info .info_1 {
+    display: flex;
+    align-items: center;
+    border: 1px solid var(--rgb40E);
+    padding: 2vw;
+    border-radius: 5px;
+    margin: 0 0 3vw 0;
+}
+
+.main .one .info .info_1 .label {
+    font-size: 14px;
+    color: var(--rgb8b8);
+}
+
+.main .one .info .info_1 .value {
+    width: 68%;
+    flex-grow: 1;
+    font-size: 14px;
+}
+
+.main .one .info .info_1 .value .picker {
+    height: 20px;
+    overflow: hidden;
+}
+
+.main .one .btn {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.main .one .btn button {
+    margin: 0 2vw;
+    background-color: var(--rgb40E);
+    background-image: linear-gradient(to right, var(--rgb3AB), var(--rgb40E));
+    border-radius: 30rpx;
+}

+ 1 - 1
pagesMy/team/index.wxml

@@ -32,7 +32,7 @@
                     <button class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toView">
                         查看详情
                     </button>
-                    <button wx:if="{{user.type=='1'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toExam">
+                    <button wx:if="{{user.type=='1'&&item.status=='0'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toExam">
                         审核成员
                     </button>
                     <button wx:if="{{user.type=='1'&&item.status=='0'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toEdit">

+ 3 - 0
pagesTeam/home/index.js

@@ -79,6 +79,9 @@ Page({
         let res = await app.$api('team', 'GET', { ...info, ...that.data.searchInfo })
         if (res.errcode == '0') {
             let list = [...that.data.list, ...res.data]
+            // for (const val of list) {
+            //     val.tel = val.phone.substr(0,3) + "****" + val.phone.substr(7)
+            // }
             that.setData({ list })
             that.setData({ total: res.total })
         }