Преглед на файлове

Merge branch 'master' of http://git.cc-lotus.info/ball-court/court-mobile1

zs преди 2 години
родител
ревизия
6b683f0232
променени са 3 файла, в които са добавени 90 реда и са изтрити 1 реда
  1. 26 0
      pages/matchteam/layout.js
  2. 15 1
      pages/matchteam/layout.wxml
  3. 49 0
      pages/matchteam/layout.wxss

+ 26 - 0
pages/matchteam/layout.js

@@ -10,16 +10,42 @@ Page({
         frameStyle: { useTop: true, name: '编排信息', leftArrow: true, useBar: false },
         // 主体高度
         infoHeight: '',
+        id: '',
+        list: [],
     },
     back: function () {
         wx.navigateBack({ url: '/pages/matchteam/index' })
     },
+    // 详情
+    toView: async function (e) {
+        console.log('耶嘿!✿');
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        const that = this;
+        if (options && options.id) that.setData({ id: options.id })
         // 计算高度
         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`, { _id: that.data.id });
+                if (arr.errcode == '0') that.setData({ list: arr.data });
+            },
+            fail: res => {
+                return wx.redirectTo({ url: '/pages/login/index', })
+            }
+        })
     },
     // 计算高度
     searchHeight: function () {

+ 15 - 1
pages/matchteam/layout.wxml

@@ -1,5 +1,19 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
   <view slot="info" class="main" style="height:{{infoHeight}}px;">
-    模板
+    <view class="one">
+      <view class="list" wx:for="{{list}}" wx:key="item">
+        <view class="name textOver">{{item.match_name}}</view>
+        <view class="other">
+          <view class="otherInfo"><text>红方队伍: </text><text>{{item.red_name||'暂无'}}</text></view>
+          <view class="otherInfo"><text>红方比分:</text><text>{{item.red_branch||'0'}}</text></view>
+          <view class="otherInfo"><text>蓝方队伍: </text><text>{{item.blue_name||'暂无'}}</text></view>
+          <view class="otherInfo"><text>蓝方比分: </text><text>{{item.blue_branch||'0'}}</text></view>
+          <view class="otherInfo"><text>状态:</text><text>{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</text></view>
+        </view>
+        <view class="btn">
+          <button type="default" size="mini" bindtap="toView" data-id="{{item._id}}">详情</button>
+        </view>
+      </view>
+    </view>
   </view>
 </mobile-main>

+ 49 - 0
pages/matchteam/layout.wxss

@@ -1,4 +1,53 @@
 .main {
     position: relative;
     width: 100%;
+}
+.main .one {
+    float: left;
+    width: 95%;
+    padding: 10px;
+    overflow-x: hidden;
+}
+
+.main .one .list {
+    float: left;
+    width: 95%;
+    padding: 10px;
+    background-color: #fff;
+    margin: 0 0 10px 0;
+    border-radius: 5px;
+}
+
+.main .one .list .name {
+    float: left;
+    width: 100%;
+    font-size: 14px;
+    font-weight: bold;
+    margin: 0 0 5px 0;
+}
+
+.main .one .list .other {
+    float: left;
+    width: 100%;
+    margin: 0 0 5px 0;
+}
+
+.main .one .list .other .otherInfo {
+    font-size: 12px;
+    color: #666;
+    margin: 0 0 5px 0;
+}
+
+.main .one .list .other .otherInfo text:nth-child(2) {
+    color: #000;
+}
+
+.main .one .list .btn {
+    text-align: center;
+}
+
+.main .one .list .btn button {
+    margin: 0 10px;
+    padding: 0 10px;
+    font-size: 12px;
 }