YY 2 年 前
コミット
930d2340ac

+ 18 - 1
pages/matchadmin/layoutInfo.js

@@ -10,6 +10,15 @@ Page({
         frameStyle: { useTop: true, name: '赛程信息', leftArrow: true, useBar: false },
         // 主体高度
         infoHeight: '',
+        // 选项卡
+        tabs: {
+            active: 'a',
+            list: [
+                { title: '未开始', name: 'a' },
+                { title: '进行中', name: 'b' },
+                { title: '已结束', name: 'c' },
+            ],
+        },
         // 比赛信息
         match_id: '',
         matchInfo: {},
@@ -29,6 +38,12 @@ Page({
         const that = this;
         wx.navigateTo({ url: `/pages/matchadmin/layout?id=${that.data.match_id}` })
     },
+    // 选项卡
+    tabsChange: function (e) {
+        const that = this;
+        that.setData({ 'tabs.active': e.detail.name })
+        that.watchLogin()
+    },
     // 查看
     toView: async function (e) {
         const that = this;
@@ -112,6 +127,8 @@ Page({
     // 监听用户是否登录
     watchLogin: function () {
         const that = this;
+        let active = that.data.tabs.active;
+        let status = active == 'a' ? '0' : active == 'b' ? '1' : '2';
         wx.getStorage({
             key: 'token',
             success: async res => {
@@ -120,7 +137,7 @@ Page({
                 arr = await app.$get(`/courtAdmin/api/match/${that.data.match_id}`,);
                 if (arr.errcode == '0') that.setData({ matchInfo: arr.data });
                 // 查询赛制信息
-                arr = await app.$get(`/courtAdmin/api/schedule`, { match_id: that.data.match_id });
+                arr = await app.$get(`/courtAdmin/api/schedule`, { match_id: that.data.match_id, status: status });
                 if (arr.errcode == '0') that.setData({ list: arr.data });
             },
             fail: res => {

+ 2 - 1
pages/matchadmin/layoutInfo.json

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

+ 50 - 13
pages/matchadmin/layoutInfo.wxml

@@ -3,20 +3,57 @@
         <view class="one">
             <button type="default" size="mini" bindtap="toAdd">添加</button>
         </view>
-        <view class="two">
-            <view class="list" wx:for="{{list}}" wx:key="item">
-                <view class="name textOver">比赛场次轮数--{{item.position||'暂无'}}</view>
-                <view class="other">
-                    <view class="otherInfo"><text>比赛名称:</text><text>{{item.match_name}}</text></view>
-                    <view class="otherInfo"><text>红方队伍: </text><text>{{item.red_name||'暂无'}}</text>---<text>比分:{{item.red_branch||'0'}}</text></view>
-                    <view class="otherInfo"><text>蓝方队伍: </text><text>{{item.blue_name||'暂无'}}</text>---<text>比分:{{item.blue_branch||'0'}}</text></view>
-                    <view class="otherInfo"><text>状态:</text><text>{{item.status=='0'?'未开始':item.status=='1'?'进行中':'已结束'}}</text></view>
+        <view class="two" style="height:{{infoHeight-45}}px;">
+            <e-tabs tabs="{{tabs}}" bind:tabsChange="tabsChange"></e-tabs>
+            <view wx:if="{{tabs.active=='a'}}" class="a">
+                <view class="list" wx:for="{{list}}" wx:key="item">
+                    <view class="name textOver">比赛场次轮数--{{item.position||'暂无'}}</view>
+                    <view class="other">
+                        <view class="otherInfo"><text>比赛名称:</text><text>{{item.match_name}}</text></view>
+                        <view class="otherInfo"><text>红方队伍: </text><text>{{item.red_name||'暂无'}}</text>---<text>比分:{{item.red_branch||'0'}}</text></view>
+                        <view class="otherInfo"><text>蓝方队伍: </text><text>{{item.blue_name||'暂无'}}</text>---<text>比分:{{item.blue_branch||'0'}}</text></view>
+                        <view class="otherInfo"><text>状态:</text><text>{{item.status=='0'?'未开始':item.status=='1'?'进行中':'已结束'}}</text></view>
+                    </view>
+                    <view class="btn">
+                        <button type="default" size="mini" bindtap="toView" data-id="{{item._id}}">详情</button>
+                        <button type="warn" size="mini" bindtap="toEdit" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">比赛进度</button>
+                        <button type="primary" size="mini" bindtap="toRace" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">维护赛程信息</button>
+                        <button type="warn" size="mini" bindtap="toDel" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">删除</button>
+                    </view>
                 </view>
-                <view class="btn">
-                    <button type="default" size="mini" bindtap="toView" data-id="{{item._id}}">详情</button>
-                    <button type="warn" size="mini" bindtap="toEdit" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">比赛进度</button>
-                    <button type="primary" size="mini" bindtap="toRace" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">维护赛程信息</button>
-                    <button type="warn" size="mini" bindtap="toDel" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">删除</button>
+            </view>
+            <view wx:elif="{{tabs.active=='b'}}" class="b">
+                <view class="list" wx:for="{{list}}" wx:key="item">
+                    <view class="name textOver">比赛场次轮数--{{item.position||'暂无'}}</view>
+                    <view class="other">
+                        <view class="otherInfo"><text>比赛名称:</text><text>{{item.match_name}}</text></view>
+                        <view class="otherInfo"><text>红方队伍: </text><text>{{item.red_name||'暂无'}}</text>---<text>比分:{{item.red_branch||'0'}}</text></view>
+                        <view class="otherInfo"><text>蓝方队伍: </text><text>{{item.blue_name||'暂无'}}</text>---<text>比分:{{item.blue_branch||'0'}}</text></view>
+                        <view class="otherInfo"><text>状态:</text><text>{{item.status=='0'?'未开始':item.status=='1'?'进行中':'已结束'}}</text></view>
+                    </view>
+                    <view class="btn">
+                        <button type="default" size="mini" bindtap="toView" data-id="{{item._id}}">详情</button>
+                        <button type="warn" size="mini" bindtap="toEdit" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">比赛进度</button>
+                        <button type="primary" size="mini" bindtap="toRace" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">维护赛程信息</button>
+                        <button type="warn" size="mini" bindtap="toDel" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">删除</button>
+                    </view>
+                </view>
+            </view>
+            <view wx:elif="{{tabs.active=='c'}}" class="c">
+                <view class="list" wx:for="{{list}}" wx:key="item">
+                    <view class="name textOver">比赛场次轮数--{{item.position||'暂无'}}</view>
+                    <view class="other">
+                        <view class="otherInfo"><text>比赛名称:</text><text>{{item.match_name}}</text></view>
+                        <view class="otherInfo"><text>红方队伍: </text><text>{{item.red_name||'暂无'}}</text>---<text>比分:{{item.red_branch||'0'}}</text></view>
+                        <view class="otherInfo"><text>蓝方队伍: </text><text>{{item.blue_name||'暂无'}}</text>---<text>比分:{{item.blue_branch||'0'}}</text></view>
+                        <view class="otherInfo"><text>状态:</text><text>{{item.status=='0'?'未开始':item.status=='1'?'进行中':'已结束'}}</text></view>
+                    </view>
+                    <view class="btn">
+                        <button type="default" size="mini" bindtap="toView" data-id="{{item._id}}">详情</button>
+                        <button type="warn" size="mini" bindtap="toEdit" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">比赛进度</button>
+                        <button type="primary" size="mini" bindtap="toRace" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">维护赛程信息</button>
+                        <button type="warn" size="mini" bindtap="toDel" data-id="{{item._id}}" wx:if="{{item.status!='2'}}">删除</button>
+                    </view>
                 </view>
             </view>
         </view>