YY 3 years ago
parent
commit
b7a43249cf
5 changed files with 221 additions and 69 deletions
  1. 116 64
      pages/lays/index.js
  2. 4 1
      pages/lays/index.json
  3. 22 2
      pages/lays/index.wxml
  4. 79 1
      pages/lays/index.wxss
  5. 0 1
      pages/teamDetails/detail.js

+ 116 - 64
pages/lays/index.js

@@ -1,66 +1,118 @@
-// pages/lays/index.js
+// pages/login/login.js
+import WxValidate from '../../utils/wxValidate'
+const app = getApp()
 Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        // 主体高度
+        infoHeight: '',
+        frameStyle: { useTop: true, name: '赛程编排', leftArrow: true, useBar: false },
+        alreadyList: [],
+        id: ''
+    },
+    back: function () {
+        wx.navigateBack({ url: '/pages/meMatch/index' })
+    },
+    //新增赛程编排
+    addTo: function () {
+        let id = this.data.id;
+        wx.navigateTo({
+            url: `/pages/layNew/index?id=${id}`,
+        })
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        console.log(options.id);
+        this.setData({ id: options.id })
+        // let id = options.id
+        // 计算高度
+        this.searchHeight();
+        // 监听用户是否登录
+        this.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: function () {
+        const that = this;
+        console.log(that.data.id);
+        wx.getStorage({
+            key: 'token',
+            success: res => {
+                wx.request({
+                    url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
+                    method: 'get',
+                    data: { match_id: that.data.id },
+                    success(res) {
+                        console.log(res.data.data);
+                        that.setData({ alreadyList: res.data.data })
+                    }
+                })
+            },
+            fail: res => {
+                return wx.redirectTo({ url: '/pages/login/index', })
+            }
+        })
+    },
+    // 计算高度
+    searchHeight: function () {
+        let frameStyle = this.data.frameStyle;
+        let client = app.globalData.client;
+        // 减去状态栏
+        let infoHeight = client.windowHeight - (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 () {
+
+    }
 })

+ 4 - 1
pages/lays/index.json

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

+ 22 - 2
pages/lays/index.wxml

@@ -1,2 +1,22 @@
-<!--pages/lays/index.wxml-->
-<text>pages/lays/index.wxml</text>
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+    <view slot="info" class="main" style="height:{{infoHeight}}px;">
+        <view class="tianjia">
+            <button class="button" bindtap="addTo">添加</button>
+        </view>
+        <view class="one">
+            <view class="list">
+                <view class="two" wx:key="item" wx:for="{{alreadyList}}">
+                    <view class="left">
+                        <image class="head" src="{{item.logo[0].url}}"></image>
+                        <text class="group">{{item.team_name}}</text>
+                        <text class="person">共{{item.match_num}}人</text>
+                        <view class="fou"><text>创建人:{{item.create_user}}</text></view>
+                        <view class="time"><text class="date">{{item.create_time}}创建</text></view>
+                    </view>
+                    <view class="right">
+                    </view>
+                </view>
+            </view>
+        </view>
+    </view>
+</mobile-main>

+ 79 - 1
pages/lays/index.wxss

@@ -1 +1,79 @@
-/* pages/lays/index.wxss */
+.main {
+    position: relative;
+    width: 100%;
+    background-color: #f1f1f1;
+    padding: 20px 0 0 0;
+  }
+  
+
+  .button {
+    margin: 0 0 20px 0;
+    background-image: linear-gradient(to right, #fd3c1e, #c74df0);
+    border-radius: 30px;
+    color: #ffffff;
+    text-align: center;
+    font-size: small;
+  }
+
+
+  .list{
+    margin-top: 5%;
+  }
+  .two{
+    width: 93%;
+    float: left;
+    margin-left: 3%;
+  }
+  .left{
+    float: left;
+    width: 70%;
+    padding-top: 10px;
+    padding-left: 10px;
+    padding-bottom: 10px;
+  }
+  .two{
+    background-color: white;
+    margin-bottom: 3%;
+    border-radius: 8px;
+  }
+  .right{
+    float: left;
+    width: 20%;
+    margin-top: 9%;
+  }
+  .head {
+    float: left;
+    margin-left: 7px;
+    width: 15%;
+    height: 31px;
+    overflow: hidden;
+  }
+  .group{
+    font-size: 16px;
+    line-height: 30px;
+    font-weight: 500;
+    margin-left: 4%;
+    margin-right: 8%;
+  }
+  .fou{
+    font-size: 13px;
+    color: #9e9e9e;
+    margin: 2%;
+    margin-left: 10px;
+    float: left;
+    width: 100%;
+  }
+  .person{
+    font-size: 13px;
+    color: #9e9e9e;
+  }
+  .time{
+    margin-left: 10px;
+    margin-bottom: 1.5%;
+    font-size: 13px;
+    color: #9e9e9e;
+  }
+  .date{
+    margin-right: 5px;
+  }
+  

+ 0 - 1
pages/teamDetails/detail.js

@@ -91,7 +91,6 @@ Page({
     console.log(options.id);
     // 监听用户是否登录
     this.watchLogin();
-
   },
   // 监听用户是否登录
   watchLogin: function () {