Browse Source

比赛管理

YY 3 years ago
parent
commit
347b7e7a83
7 changed files with 472 additions and 7 deletions
  1. 42 1
      pages/me/index.js
  2. 42 3
      pages/me/index.wxml
  3. 14 3
      pages/me/index.wxss
  4. 113 0
      pages/meMatch/index.js
  5. 6 0
      pages/meMatch/index.json
  6. 47 0
      pages/meMatch/index.wxml
  7. 208 0
      pages/meMatch/index.wxss

+ 42 - 1
pages/me/index.js

@@ -22,6 +22,7 @@ Page({
     },
     item1: {},
     list3: [],
+    list2: [],
     //头像
     icon: '',
     //团队logo
@@ -55,7 +56,7 @@ Page({
       url: `/pages/createTeam/index`,
     })
   },
-  //团队详情
+  //团队创建人-团队详情
   ToDetails: function (e) {
     let id = e.currentTarget.dataset.id;
     console.log(e.currentTarget.dataset.id);
@@ -63,6 +64,21 @@ Page({
       url: `/pages/teamDetails/detail?id=` + id,
     })
   },
+  //个人用户-团队详情
+  ToDetailsMember: function (e) {
+    let id = e.currentTarget.dataset.id;
+    console.log(e.currentTarget.dataset.id);
+    wx.navigateTo({
+      url: `/pages/teamDetails/index?id=` + id,
+    })
+  },
+  //比赛管理
+  Administration: function (e) {
+    wx.navigateTo({
+      url: `/pages/meMatch/index`,
+    })
+  },
+
   //已上传图片
   Uploaded: function () {
     wx.navigateTo({
@@ -163,6 +179,31 @@ Page({
         wx.redirectTo({ url: '/pages/login/index', })
       }
     })
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        console.log(res.data.id);
+        //数据请求
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/team/userteams`//接口地址
+          method: "get",//请求方法
+          data: { user_id: res.data.id },//请求参数
+          header: {},
+          success: res => {
+            console.log(res);
+            that.setData({ list2: res.data.data })
+            console.log(res.data.data);
+          },
+          error: err => {
+            console.log(err);
+          }
+        })
+      },
+      fail: res => {
+        wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
+
   },
   //退出登录
   tui() {

+ 42 - 3
pages/me/index.wxml

@@ -83,12 +83,13 @@
       </view>
     </view>
     <view class="five">
-      <view class="listtuan" wx:if="{{item1.type=='1'||item1.type=='2'}}">
+      <view class="listtuan" wx:if="{{item1.type=='1'}}">
         <view class="otherInfo">
           <view class="otherInfo_1">
             <text class="tuan">我的团队</text>
             <text class="total">共参加{{list3.length||0}}个队伍</text>
-            <text class="chuang" bindtap="create" wx:if="{{list3.length<1&&item1.type=='1'}}">创建团队</text>
+            <!-- <text class="chuang" bindtap="create" wx:if="{{list3.length<1&&item1.type=='1'}}">创建团队</text> -->
+            <text class="chuang" bindtap="create">创建团队</text>
           </view>
         </view>
         <view class="weui-cells mgt-0 {{!showMore? 'hiddenmore' : 'showmore'}}">
@@ -132,6 +133,44 @@
         </view>
       </view>
     </view>
+    <view class="five_1">
+      <view class="listtuan" wx:if="{{item1.type=='2'}}">
+        <view class="otherInfo">
+          <view class="otherInfo1_1">
+            <text class="tuan">我的团队</text>
+            <text class="total">共参加{{list2.length||0}}个队伍</text>
+          </view>
+        </view>
+        <view class="weui-cells mgt-0 {{!showMore? 'hiddenmore' : 'showmore'}}">
+          <view wx:key="item" wx:for="{{list2}}" wx:for-index="idx" wx:key="key" class="list3 {{idx>1 ? 'more-item' : ''}}">
+            <view class="dui-left">
+              <view class="dui-left1">
+                <image src="{{item.logo[0].url}}" class="dui-image"></image>
+              </view>
+              <view class="dui-right1 textOver">
+                <text class="group" bindtap="ToDetailsMember" data-id="{{item._id}}">{{item.name}}</text>
+              </view>
+              <button class="ball" size="mini" wx:if="{{item.type=='0'}}" style="background-color:rgb(63, 127, 245);">乒乓球</button>
+              <button class="ball" size="mini" wx:if="{{item.type=='1'}}" style="background-color:rgb(245, 172, 63);">足球</button>
+              <button class="ball" size="mini" wx:if="{{item.type=='2'}}" style="background-color:rgb(241, 95, 127);">篮球</button>
+            </view>
+            <view class="dui-right"><text class="person">
+                共{{item.members.length||0}}人
+              </text>
+            </view>
+            <text class="date">{{item.create_time}}创建</text>
+          </view>
+          <block wx:if="{{list2.length>2}}">
+            <view wx:if="{{showMore}}" class="van" bindtap='listToggle'>
+              <van-icon name="arrow-up" />
+            </view>
+            <view wx:else class="van" bindtap='listToggle'>
+              <van-icon name="arrow-down" />
+            </view>
+          </block>
+        </view>
+      </view>
+    </view>
     <view class="six">
       <view class="six-11"><text class="fui">我的服务</text></view>
       <view class="six-0" bindtap="Uploaded">
@@ -174,7 +213,7 @@
           <text class="six-text">退出登录</text>
         </view>
       </view>
-      <view class="six-5">
+      <view class="six-5" bindtap="Administration" wx:if="{{item1.type=='1'}}">
         <view class="six-left">
           <text class=" icon iconfont icon-bisaiguanli"></text>
         </view>

+ 14 - 3
pages/me/index.wxss

@@ -97,6 +97,10 @@
   position: relative;
   top: -35px;
 }
+.otherInfo1_1 {
+  position: relative;
+  top: 10px;
+}
 
 .buttons {
   margin-top: 8px;
@@ -298,6 +302,12 @@
   border-radius: 5px;
   background-color: #fff;
 }
+.five_1 {
+  margin: -50px 0 0 20px;
+  width: 90%;
+  border-radius: 5px;
+  background-color: #fff;
+}
 
 
 .tuan {
@@ -444,7 +454,7 @@
 .six {
   width: 91%;
   height: 132px;
-  margin-top: 15px;
+  margin-top: 65px;
   margin-left: 5%;
   border-radius: 5px;
   background-color: #fff;
@@ -484,12 +494,13 @@
 }
 
 .six-4 {
-  margin-bottom: 5px;
+
   float: left;
   width: 24%;
 }
+
 .six-5 {
-  margin-top: 2%;
+  margin-bottom: 5px;
   float: left;
   width: 24%;
 }

+ 113 - 0
pages/meMatch/index.js

@@ -0,0 +1,113 @@
+// pages/login/login.js
+import WxValidate from '../../utils/wxValidate'
+const app = getApp()
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    src: '/image/home.png',
+    frameStyle: { useTop: true, name: '比赛管理', leftArrow: true, useBar: false },
+    // 主体高度
+    infoHeight: '',
+    list: [],
+    listend: [],
+  },
+  back: function () {
+    wx.navigateBack({ url: '/pages/me/index' })
+  },
+  signUp: function (e) {
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    // 计算高度
+    this.searchHeight();
+    // 监听用户是否登录
+    this.watchLogin();
+  },
+  // 监听用户是否登录
+  watchLogin: function () {
+    var that = this;
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/match`, //接口地址
+          method: 'get',
+          data: { status: '1' },
+          success(res) {
+            console.log(res.data.data);
+            that.setData({ list: 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;
+    // 减去状态栏
+    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 () {
+
+  }
+})

+ 6 - 0
pages/meMatch/index.json

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

+ 47 - 0
pages/meMatch/index.wxml

@@ -0,0 +1,47 @@
+<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
+  <view slot="info" class="main" style="height:{{infoHeight}}px;">
+    <view class="one">
+      <view class="one-2">
+        <van-tabs v-model:active="activeName">
+          <van-tab title="待申请" name="a" style="font-weight: 500;">
+            <view class="beijing1" wx:key="item" wx:for="{{list}}">
+              <view class="list1">
+                <view class="list_l">
+                  <view>
+                    <view class="names">{{item.name}}</view>
+                    <button class="button" size="mini">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</button>
+                  </view>
+                  <view class="leftmueen">
+                    <view class="otherInfos">
+                      <text class="text9">{{item.single_time}}</text>
+                    </view>
+                    <view class="otherInfo textOver"><text class="text3">{{item.address}}</text></view>
+                  </view>
+                </view>
+                <view class="list_r">
+                  <button class="button1" bindtap="signUp" data-id="{{item._id}}" size="mini">报名</button>
+                </view>
+              </view>
+            </view>
+          </van-tab>
+          <van-tab title="已申请" name="b" style="font-weight: 500;">
+            <view class="beijing1" wx:key="item" wx:for="{{listend}}">
+              <view class="list1">
+                <view class="names">{{item.name}}</view>
+                <button class="buttonend" size="mini">{{item.status}}</button>
+                <view class="leftmueen">
+                  <view class="otherInfos">
+                    <text class="text9">{{item.single_time}}</text>
+                  </view>
+                  <view class="otherInfo"><text class="text3">{{item.address}}</text></view>
+                </view>
+              </view>
+            </view>
+          </van-tab>
+        </van-tabs>
+      </view>
+      <view>
+      </view>
+    </view>
+  </view>
+</mobile-main>

+ 208 - 0
pages/meMatch/index.wxss

@@ -0,0 +1,208 @@
+.main {
+  position: relative;
+  width: 100%;
+  background-color: #f1f1f1;
+}
+
+.one {
+  margin-top: 32px;
+}
+
+.one-2 {
+  margin-top: -33px;
+}
+
+.van-tabs__line {
+  margin-left: 27px !important;
+  width: 38.800003px !important;
+  background-color: blue !important;
+}
+
+.list1 {
+  background-color: white;
+  padding-top: 5px;
+  margin: 5px 0 0 0;
+  width: 100%;
+  height: 90px;
+}
+
+.list_l {
+  width: 80%;
+  float: left;
+}
+
+.list_r {
+  width: 20%;
+  float: left;
+  margin: 20px 0 0 0;
+}
+
+.button1 {
+  margin-top: 5px;
+  background-color: rgb(218, 132, 252);
+  border-radius: 15px;
+  font-size: 13px !important;
+  color: #fff;
+}
+
+
+.beijing1 {
+  margin-bottom: 1.5%;
+}
+
+.two {
+  float: left;
+  width: 100%;
+}
+
+.right1 {
+  float: left;
+  width: 100%;
+  background-color: #fff;
+}
+
+.text1 {
+  margin-top: 3%;
+  margin-right: 5px;
+  font-size: 13px;
+  color: rgb(185, 185, 185);
+}
+
+.text4 {
+  margin-right: 5px;
+  font-size: 13px;
+  color: rgb(185, 185, 185);
+}
+
+.text6 {
+  font-size: 23px;
+  color: rgb(46, 46, 245);
+  font-weight: 500;
+}
+
+.text7 {
+  font-size: 23px;
+  color: rgb(243, 19, 19);
+  font-weight: 500;
+}
+
+.text8 {
+  font-size: 23px;
+  font-weight: 500;
+  margin-right: 5px;
+  margin-left: 5px;
+}
+
+.text9 {
+  font-weight: 500;
+  margin-right: 3px;
+  font-size: 14px;
+  color: #5e5e5e;
+}
+
+.leftmueen {
+  margin: 5px;
+  border-radius: 25px;
+}
+
+.text10 {
+  font-size: 14px;
+  margin-left: 2px;
+  margin-right: 3px;
+  color: #5e5e5e;
+}
+
+.right1_1 {
+  float: left;
+  width: 40%;
+  margin-left: 15px;
+  text-align: left;
+  margin-top: 5px;
+  margin-bottom: 5px;
+  margin-right: 5px;
+}
+
+.left1 {
+  margin-left: 15px;
+  text-align: left;
+  font-size: 13px;
+  color: rgb(185, 185, 185);
+}
+
+.img {
+  margin-top: 5px;
+  margin-left: 5px;
+  width: 44px;
+  height: 36px;
+}
+
+.name {
+  font-size: 15px;
+}
+
+.names {
+  float: left;
+  /* width: 35%; */
+  margin: 6px;
+  margin-left: 10px;
+  font-size: 16px;
+  color: #0034cf;
+  font-weight: bold;
+}
+
+.button {
+  margin-top: 5px;
+  background-color: rgb(238, 147, 28);
+  border-radius: 15px;
+  font-size: 13px !important;
+  color: #fff;
+}
+
+.buttonend {
+  margin-top: 5px;
+  background-color: rgb(136, 136, 136);
+  border-radius: 15px;
+  font-size: 13px !important;
+  color: rgb(63, 63, 63);
+}
+
+.right1_2 {
+  float: left;
+  width: 50%;
+}
+
+.otherInfo {
+  text-align: left;
+  padding: 0 0 15px 5px;
+}
+
+.otherInfos {
+  padding: 0 0 0px 5px;
+}
+
+.text3 {
+  font-weight: 500;
+  font-size: 13px;
+  color: #adadad;
+}
+
+.right1_2t {
+  font-size: 14px;
+  color: rgb(122, 122, 122);
+}
+
+.right1_2o {
+  float: left;
+  width: 30%;
+}
+
+.right1_2os {
+  float: left;
+  width: 30%;
+}
+
+.right1_2i {
+  float: left;
+  padding: 15px;
+  width: 20%;
+}