guhongwei il y a 2 ans
Parent
commit
a4181f2687

+ 3 - 4
app.json

@@ -2,6 +2,8 @@
     "pages": [
         "pages/me/index",
         "pages/matchadmin/index",
+        "pages/addmatch/index",
+        "pages/matchadmin/layoutInfo",
         "pages/matchadmin/layout",
         "pages/index/index",
         "pages/login/index",
@@ -10,8 +12,6 @@
         "pages/search/index",
         "pages/match/info",
         "pages/teamrank/index",
-        "pages/addmatch/index",
-        "pages/matchadmin/edit",
         "pages/teamexam/index",
         "pages/team/index",
         "pages/teamInfo/index",
@@ -29,8 +29,7 @@
         "pages/user/index",
         "pages/user/detail",
         "pages/test/index",
-        "pages/logs/logs",
-        "pages/matchadmin/layoutInfo"
+        "pages/logs/logs"
     ],
     "usingComponents": {
         "van-button": "/miniprogram_npm/@vant/weapp/button/index",

+ 0 - 84
pages/matchadmin/edit.js

@@ -1,84 +0,0 @@
-// pages/login/login.js
-import WxValidate from '../../utils/wxValidate'
-const app = getApp()
-Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        frameStyle: { useTop: true, name: '修改比赛信息', leftArrow: true, useBar: false },
-        // 主体高度
-        infoHeight: '',
-    },
-    back: function () {
-        wx.navigateBack({ url: '/pages/matchadmin/index' })
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) {
-        // 计算高度
-        this.searchHeight()
-    },
-    // 计算高度
-    searchHeight: function () {
-        let frameStyle = this.data.frameStyle;
-        let client = app.globalData.client;
-        let infoHeight = client.windowHeight;
-        // 是否去掉状态栏
-        if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
-        // 是否减去底部菜单
-        if (frameStyle.useBar) infoHeight = infoHeight - 50;
-        if (infoHeight) this.setData({ infoHeight: infoHeight })
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
-
-    }
-})

+ 0 - 6
pages/matchadmin/edit.json

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

+ 0 - 5
pages/matchadmin/edit.wxml

@@ -1,5 +0,0 @@
-<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
-  <view slot="info" class="main" style="height:{{infoHeight}}px;">
-    模板
-  </view>
-</mobile-main>

+ 0 - 4
pages/matchadmin/edit.wxss

@@ -1,4 +0,0 @@
-.main {
-    position: relative;
-    width: 100%;
-}

+ 1 - 2
pages/matchadmin/index.wxml

@@ -10,8 +10,7 @@
                 </view>
                 <view class="btn" wx:if="{{item.status=='0'||item.status=='1'||item.status=='2'}}">
                     <button type="default" size="mini" bindtap="toEdit" data-id="{{item._id}}" data-route="addmatch">修改</button>
-                    <button type="warn" size="mini" bindtap="toCommon" data-id="{{item._id}}" data-route="layout">编排</button>
-                    <button type="primary" size="mini" bindtap="toCommon" data-id="{{item._id}}" data-route="layoutInfo">编排信息</button>
+                    <button type="warn" size="mini" bindtap="toCommon" data-id="{{item._id}}" data-route="layoutInfo">编排</button>
                 </view>
             </view>
         </view>

+ 2 - 2
pages/matchadmin/layout.js

@@ -7,7 +7,7 @@ Page({
      * 页面的初始数据
      */
     data: {
-        frameStyle: { useTop: true, name: '编排比赛赛制', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '编辑赛制信息', leftArrow: true, useBar: false },
         // 主体高度
         infoHeight: '',
         // 用户信息
@@ -31,7 +31,7 @@ Page({
         this.WxValidate = new WxValidate(rules, messages)
     },
     back: function () {
-        wx.navigateBack({ url: '/pages/matchadmin/index' })
+        wx.navigateBack({ url: '/pages/matchadmin/layoutInfo' })
     },
     // 选择比赛时间
     dateChange: function (e) {

+ 30 - 2
pages/matchadmin/layoutInfo.js

@@ -7,19 +7,47 @@ Page({
      * 页面的初始数据
      */
     data: {
-        frameStyle: { useTop: true, name: '赛制编排信息', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '赛制信息', leftArrow: true, useBar: false },
         // 主体高度
         infoHeight: '',
+        // 比赛信息
+        match_id: '629eb5de78fa03648c0535d9',
+        list: [],
     },
     back: function () {
         wx.navigateBack({ url: '/pages/matchadmin/index' })
     },
+    // 添加
+    toAdd: function () {
+        const that = this;
+        wx.navigateTo({ url: `/pages/matchadmin/layout?id=${that.data.match_id}` })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        const that = this;
+        if (options && options.id) that.setData({ match_id: options.id })
         // 计算高度
-        this.searchHeight()
+        this.searchHeight();
+        // 监听用户是否登录
+        this.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: function () {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            success: async res => {
+                let arr;
+                // 查询赛制信息
+                arr = await app.$get(`/courtAdmin/api/schedule`, { match_id: that.data.match_id });
+                if (arr.errcode == '0') that.setData({ list: arr.data });
+            },
+            fail: res => {
+                return wx.redirectTo({ url: '/pages/login/index', })
+            }
+        })
     },
     // 计算高度
     searchHeight: function () {

+ 10 - 3
pages/matchadmin/layoutInfo.wxml

@@ -1,5 +1,12 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
-  <view slot="info" class="main" style="height:{{infoHeight}}px;">
-    模板
-  </view>
+    <view slot="info" class="main" style="height:{{infoHeight}}px;">
+        <view class="one">
+            <button type="default" size="mini" bindtap="toAdd">添加</button>
+        </view>
+        <view class="two">
+            <view class="list" wx:for="{{list}}" wx:key="item">
+                {{item.match_id}}
+            </view>
+        </view>
+    </view>
 </mobile-main>

+ 27 - 0
pages/matchadmin/layoutInfo.wxss

@@ -1,4 +1,31 @@
 .main {
     position: relative;
     width: 100%;
+}
+
+.main .one {
+    float: left;
+    width: 100%;
+    text-align: center;
+    padding: 5px 0;
+    background-color: #fff;
+}
+
+.main .one button {
+    width: 50%;
+    font-size: 14px;
+}
+
+.main .two {
+    float: left;
+    width: 95%;
+    overflow-x: hidden;
+}
+
+.main .two .list {
+    float: left;
+    width: 95%;
+    padding: 10px;
+    margin: 0 0 10px 0;
+
 }