zs пре 1 година
родитељ
комит
c8c40130e8

+ 2 - 1
app.json

@@ -24,7 +24,8 @@
             "pages": [
                 "home/index",
                 "apply/index",
-                "enroll/index"
+                "enroll/index",
+                "team/index"
             ]
         },
         {

+ 10 - 2
pagesMatch/apply/index.js

@@ -17,6 +17,16 @@ Page({
         const that = this;
         wx.navigateTo({ url: '/pagesMy/ranking/index?id=' + that.data.info._id })
     },
+    // 赛程信息
+    toCourse(e) {
+        const that = this;
+        wx.navigateTo({ url: '/pagesMy/course/index?id=' + that.data.info._id })
+    },
+    // 参赛团队
+    toTeam(e) {
+        const that = this;
+        wx.navigateTo({ url: '/pagesMatch/team/index?id=' + that.data.info._id })
+    },
     // 字典
     getDict(value, model) {
         const that = this;
@@ -74,8 +84,6 @@ Page({
             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 }) }
         }
     },
     /**

+ 4 - 21
pagesMatch/apply/index.wxml

@@ -9,26 +9,6 @@
     <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||'0'}}</view>
-                        <view>:</view>
-                        <view class="blue">{{item.blue_score||'0'}}</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="color btn_1" type="primary" size="mini" bindtap="toAdd">
             报名
@@ -36,7 +16,10 @@
         <button class="color btn_2" type="primary" size="mini" bindtap="toTeam">
             参赛团队
         </button>
-        <button wx:if="{{info.status=='-1'}}" class="color btn_3" type="primary" size="mini" bindtap="toRank">
+        <button wx:if="{{info.status!='0'}}" class="color btn_3" type="primary" size="mini" bindtap="toCourse">
+            赛程信息
+        </button>
+        <button wx:if="{{info.status=='-1'}}" class="color btn_4" type="primary" size="mini" bindtap="toRank">
             排名
         </button>
     </view>

+ 167 - 0
pagesMatch/team/index.js

@@ -0,0 +1,167 @@
+const app = getApp()
+Page({
+    data: {
+        id: "",
+        // 用户信息
+        user: {},
+        searchInfo: {},
+        list: [],
+        total: 0,
+        page: 0,
+        skip: 0,
+        limit: 5,
+        statusList: []
+    },
+    // 查询
+    async toSearch(e) {
+        const that = this;
+        if (e.detail.value) that.setData({ 'searchInfo.name': e.detail.value })
+        else that.setData({ searchInfo: {} })
+        that.clearPage();
+        that.search()
+    },
+    // 查看
+    toView(e) {
+        const that = this;
+        if (that.data.user.name) {
+            let item = e.currentTarget.dataset.item
+            wx.navigateTo({ url: '/pagesTeam/apply/index?id=' + item._id })
+        } else {
+            wx.showToast({ title: `请维护基础信息`, icon: 'none' });
+        }
+    },
+    // 分页-触底
+    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 '暂无'
+            }
+        }
+    },
+    // 清空列表
+    clearPage() {
+        const that = this;
+        that.setData({ list: [] })
+        that.setData({ skip: 0 })
+        that.setData({ limit: 5 })
+        that.setData({ total: 0 })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    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: 'user',
+            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: 'status', is_use: '0' })
+        if (res.errcode == '0') that.setData({ statusList: res.data })
+    },
+    // 查询通知
+    async search() {
+        const that = this;
+        let info = { skip: that.data.skip, limit: that.data.limit, match_id: that.data.id };
+        let res = await app.$api('application/team', '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 })
+        }
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 3 - 0
pagesMatch/team/index.json

@@ -0,0 +1,3 @@
+{
+    "navigationBarTitleText": "参赛团队"
+}

+ 34 - 0
pagesMatch/team/index.wxml

@@ -0,0 +1,34 @@
+<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.name||"暂无比赛名称"}} </view>
+                    <view class="color{{item.status}}"> {{item.status_name||'暂无状态'}} </view>
+                </view>
+                <view class="other">
+                    <view class="other_1">
+                        手机号:{{item.phone||'暂无手机号'}}
+                    </view>
+                    <view class="other_1">
+                        成立时间:{{item.create_time||'暂无成立时间'}}
+                    </view>
+                    <view class="other_1">
+                        团队人数:{{item.number||'暂无团队人数'}}人
+                    </view>
+                    <view class="other_1 textOver">
+                        单位地址:{{item.address||'暂无单位地址'}}
+                    </view>
+                </view>
+                <view class="button">
+                    <button class="color btn_1" type="primary" size="mini" data-item="{{item}}" bindtap="toView">
+                        查看详情
+                    </button>
+                </view>
+            </view>
+        </scroll-view>
+    </view>
+</view>

+ 80 - 0
pagesMatch/team/index.wxss

@@ -0,0 +1,80 @@
+@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: var(--rgbfff);
+}
+.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: var(--rgb868);
+}
+
+.main .two .list .button {
+    padding: 1vw 0;
+    text-align: center;
+}
+.main .two .list .button .color{
+    margin: 0 2vw;
+    border-radius: 30rpx;
+    font-size: 15px;
+}
+
+.main .two .list .button .btn_1 {
+    background-color: var(--rgb40E);
+}
+.main .two .list .button .btn_2 {
+    background-color: var(--rgbff0);
+}
+.main .two .list .button .btn_3 {
+    background-color: var(--rgb46a);
+}
+
+.type {
+    width: 100% !important;
+}

+ 1 - 1
pagesMy/course/index.js

@@ -103,7 +103,7 @@ Page({
         const that = this;
         let info = { skip: that.data.skip, limit: that.data.limit };
         info.match_id = that.data.id
-        info.team_id = that.data.team_id
+        if (that.data.team_id) info.team_id = that.data.team_id
         let res = await app.$api('course/only', 'GET', { ...info })
         if (res.errcode == '0') {
             let list = [...that.data.list, ...res.data]

+ 2 - 2
pagesMy/course/index.wxml

@@ -15,8 +15,8 @@
                     {{item.match_time}}
                     <text class="color{{item.status}}">({{item.status_name}})</text>
                 </view>
-                <view class="button"> 
-                    <button wx:if="{{item.status=='1'&&user.type=='1'}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toUpload">
+                <view class="button">
+                    <button wx:if="{{item.status=='1'&&user.type=='1'&&team_id}}" class="btn" type="primary" size="mini" data-item="{{item}}" bindtap="toUpload">
                         上传比分
                     </button>
                 </view>