Browse Source

修改比赛管理

zs 2 năm trước cách đây
mục cha
commit
cd06ffe757

+ 16 - 19
pages/administration/index.js

@@ -14,12 +14,25 @@ Page({
         bg_3: '/image/match_3.png',
         pm_1: '/image/paiming.png',
         sp_1: '/image/shenpi.png',
-        currentTab: 0,
-        list: []
+        list: [],
+        // 选项卡
+        tabs: {
+            active: '3',
+            list: [
+                { title: '进行中', name: '3' },
+                { title: '未开始', name: '0' },
+                { title: '已结束', name: '4' },
+            ],
+        },
     },
     back: function () {
         wx.navigateBack({ url: '/pages/home/index' })
     },
+    // 选项卡
+    tabsChange: function (e) {
+        const that = this;
+        that.setData({ 'tabs.active': e.detail.name })
+    },
     tabPath: function (e) {
         let { route } = e.detail.detail;
         if (route) wx.redirectTo({ url: `/${route}` })
@@ -29,21 +42,6 @@ Page({
         const { route } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/${route}/index` })
     },
-    //点击切换
-    clickTab: function (e) {
-        const that = this;
-        if (that.data.currentTab === e.target.dataset.current) return false;
-        else that.setData({ currentTab: e.target.dataset.current });
-        that.watchLogin();
-    },
-    // 开启左右滑动
-    bindchange: function (e) {
-        var that = this
-        const { current, source } = e.detail;
-        if (source) that.setData({ currentTab: current });
-        else return false;
-        that.watchLogin();
-    },
     // 查看详情
     toView: function (e) {
         console.log(e);
@@ -60,8 +58,7 @@ Page({
     // 监听用户是否登录
     watchLogin: function () {
         const that = this;
-        let type = that.data.currentTab;
-        let status = type == '0' ? 3 : type == '1' ? 2 : 4;
+        let status = that.data.tabs.active;
         wx.getStorage({
             key: 'token',
             success: res => {

+ 2 - 1
pages/administration/index.json

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

+ 27 - 45
pages/administration/index.wxml

@@ -25,55 +25,37 @@
         </view>
       </view>
       <view class="two_3">
-        <view class="swiper-tab">
-          <view class="swiper-tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="clickTab">进行中
-            <view class="border" wx:if="{{currentTab=='0'}}">—</view>
+        <e-tabs tabs="{{tabs}}" bind:tabsChange="tabsChange"></e-tabs>
+        <view wx:if="{{tabs.active=='3'}}" class="a">
+          <view class="list" wx:for="{{list}}" wx:key="item">
+            <view class="list_1 textOver" bindtap="toView" data-id="{{item._id}}">
+              <text>{{item.name}}</text>
+              <text class="color{{item.status}}">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text>
+            </view>
+            <view class="list_2 textOver">{{item.match_time}}</view>
+            <view class="list_3 textOver">{{item.address}}</view>
           </view>
-          <view class="swiper-tab-item {{currentTab==1?'active':''}}" data-current="1" bindtap="clickTab">未开始
-            <view class="border" wx:if="{{currentTab=='1'}}">—</view>
+        </view>
+        <view wx:if="{{tabs.active=='0'}}" class="a">
+          <view class="list" wx:for="{{list}}" wx:key="item">
+            <view class="list_1 textOver" bindtap="toView" data-id="{{item._id}}">
+              <text>{{item.name}}</text>
+              <text class="color{{item.status}}">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text>
+            </view>
+            <view class="list_2 textOver">{{item.match_time}}</view>
+            <view class="list_3 textOver">{{item.address}}</view>
           </view>
-          <view class="swiper-tab-item {{currentTab==2?'active':''}}" data-current="2" bindtap="clickTab">已结束
-            <view class="border" wx:if="{{currentTab=='2'}}">—</view>
+        </view>
+        <view wx:if="{{tabs.active=='4'}}" class="a">
+          <view class="list" wx:for="{{list}}" wx:key="item">
+            <view class="list_1 textOver" bindtap="toView" data-id="{{item._id}}">
+              <text>{{item.name}}</text>
+              <text class="color{{item.status}}">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text>
+            </view>
+            <view class="list_2 textOver">{{item.match_time}}</view>
+            <view class="list_3 textOver">{{item.address}}</view>
           </view>
         </view>
-        <swiper current="{{currentTab}}" class="swiper" style="height:{{infoHeight-312}}px;" bindchange="bindchange">
-          <swiper-item class="swiper-items">
-            <scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
-              <view class="list" wx:for="{{list}}" wx:key="item">
-                <view class="list_1 textOver" bindtap="toView" data-id="{{item._id}}">
-                  <text>{{item.name}}</text>
-                  <text class="color{{item.status}}">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text>
-                </view>
-                <view class="list_2 textOver">{{item.match_time}}</view>
-                <view class="list_3 textOver">{{item.address}}</view>
-              </view>
-            </scroll-view>
-          </swiper-item>
-          <swiper-item class="swiper-items">
-            <scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
-              <view class="list" wx:for="{{list}}" wx:key="item">
-                <view class="list_1 textOver" bindtap="toView" data-id="{{item._id}}">
-                  <text>{{item.name}}</text>
-                  <text class="color{{item.status}}">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text>
-                </view>
-                <view class="list_2 textOver">{{item.match_time}}</view>
-                <view class="list_3 textOver">{{item.address}}</view>
-              </view>
-            </scroll-view>
-          </swiper-item>
-          <swiper-item class="swiper-items">
-            <scroll-view scroll-x="false" scroll-y="true" class='scroll-views'>
-              <view class="list" wx:for="{{list}}" wx:key="item">
-                <view class="list_1 textOver" bindtap="toView" data-id="{{item._id}}">
-                  <text>{{item.name}}</text>
-                  <text class="color{{item.status}}">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text>
-                </view>
-                <view class="list_2 textOver">{{item.match_time}}</view>
-                <view class="list_3 textOver">{{item.address}}</view>
-              </view>
-            </scroll-view>
-          </swiper-item>
-        </swiper>
       </view>
     </view>
   </view>

+ 9 - 37
pages/administration/index.wxss

@@ -100,35 +100,7 @@
   width: 100%;
 }
 
-.main .two .two_3 .swiper-tab {
-  float: left;
-  width: 100%;
-}
-
-.main .two .two_3 .swiper-tab-item {
-  float: left;
-  width: 33%;
-  height: 40px;
-  line-height: 25px;
-  text-align: center;
-  color: #666666;
-}
-
-.main .two .two_3 .active {
-  color: #000000;
-  font-weight: bold;
-}
-
-.main .two .two_3 .active .border {
-  color: #0057a3;
-  font-weight: bolder;
-}
-
-.main .two .two_3 .swiper {
-  float: left;
-  width: 100%;
-}
-.main .two .two_3 .swiper .list {
+.main .two .two_3 .a .list {
   float: left;
   width: 95%;
   border-radius: 5px;
@@ -137,19 +109,19 @@
   padding: 10px;
 }
 
-.main .two .two_3 .swiper .list .list_1 {
+.main .two .two_3 .a .list .list_1 {
   float: left;
   width: 100%;
   margin: 0 0 5px 0;
 }
 
-.main .two .two_3 .swiper .list .list_1 text:nth-child(1) {
+.main .two .two_3 .a .list .list_1 text:nth-child(1) {
   font-size: 16px;
   font-weight: bold;
   color: #263fa3;
 }
 
-.main .two .two_3 .swiper .list .list_1 text:nth-child(2) {
+.main .two .two_3 .a .list .list_1 text:nth-child(2) {
   display: inline-block;
   background-color: #7b7b7b;
   color: #fff;
@@ -159,19 +131,19 @@
   margin: 0 0 0 10px;
 }
 
-.main .two .two_3 .swiper .list .list_1 .color1 {
+.main .two .two_3 .a .list .list_1 .color1 {
   background-color: #57cd00 !important;
 }
 
-.main .two .two_3 .swiper .list .list_1 .color2 {
+.main .two .two_3 .a .list .list_1 .color2 {
   background-color: #ff5a00 !important;
 }
 
-.main .two .two_3 .swiper .list .list_1 .color3 {
+.main .two .two_3 .a .list .list_1 .color3 {
   background-color: #ffa200 !important;
 }
 
-.main .two .two_3 .swiper .list .list_2 {
+.main .two .two_3 .a .list .list_2 {
   float: left;
   width: 100%;
   font-size: 14px;
@@ -180,7 +152,7 @@
 
 }
 
-.main .two .two_3 .swiper .list .list_3 {
+.main .two .two_3 .a .list .list_3 {
   float: left;
   width: 100%;
   font-size: 14px;