Przeglądaj źródła

修改查询比赛

zs 3 lat temu
rodzic
commit
6e0d598f0b

+ 7 - 81
pages/meMatch/detail.js

@@ -10,23 +10,7 @@ Page({
     frameStyle: { useTop: true, name: '查询比赛', leftArrow: true, useBar: false },
     frameStyle: { useTop: true, name: '查询比赛', leftArrow: true, useBar: false },
     // 主体高度
     // 主体高度
     infoHeight: '',
     infoHeight: '',
-    list: [],
-    listend: [],
-  },
-
-  //维护
-  maintain: function (e) {
-    let id = e.currentTarget.dataset.id;
-    wx.navigateTo({
-      url: `/pages/maintain/index?id=` + id,
-    })
-  },
-  //编排
-  layout: function (e) {
-    let id = e.currentTarget.dataset.id;
-    wx.navigateTo({
-      url: `/pages/lays/index?id=` + id,
-    })
+    teamlist: [],
   },
   },
   back: function () {
   back: function () {
     wx.navigateBack({ url: '/pages/me/index' })
     wx.navigateBack({ url: '/pages/me/index' })
@@ -35,6 +19,11 @@ Page({
     let query = e.detail.detail;
     let query = e.detail.detail;
     if (query) wx.redirectTo({ url: `/pages/${query}/index` })
     if (query) wx.redirectTo({ url: `/pages/${query}/index` })
   },
   },
+  //维护
+  maintain: function (e) {
+    let {id , type} = e.currentTarget.dataset;
+    if (type) wx.navigateTo({ url: `/pages/${type}/index?id=${id}` })
+  },
   /**
   /**
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */
@@ -45,55 +34,6 @@ Page({
     this.watchLogin();
     this.watchLogin();
   },
   },
   // 监听用户是否登录
   // 监听用户是否登录
-  watchLogin: function () {
-    var that = this;
-    wx.getStorage({
-      key: 'token',
-      success: res => {
-        var that = this;
-        wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/match`, //接口地址
-          method: 'get',
-          data: {},
-          success(res) {
-            if (res.data.errcode == 0) {
-              let datas = res.data.data
-              let datass = []
-              let datasss = []
-              for (let i = 0; i < datas.length; i++) {
-                if (datas[i].status == 0) {
-                  datas[i].status = '未开始'
-                  datass.push(datas[i])
-                } else if (datas[i].status == 1) {
-                  datas[i].status = '报名中'
-                } else if (datas[i].status == 2) {
-                  datas[i].status = '待比赛'
-                } else if (datas[i].status == 3) {
-                  datas[i].status = '进行中'
-                  datasss.push(datas[i])
-                } else if (datas[i].status == 4) {
-                  datas[i].status = '已结束'
-                }
-              }
-              that.setData({
-                list: datass,
-                listend: datasss,
-              });
-            } else {
-              wx.showToast({
-                title: res.data.errmsg,
-                icon: 'none',
-                duration: 2000
-              })
-            }
-          }
-        })
-      },
-      fail: res => {
-        return wx.redirectTo({ url: '/pages/login/index', })
-      }
-    })
-  },// 监听用户是否登录
   watchLogin: function () {
   watchLogin: function () {
     var that = this;
     var that = this;
     wx.getStorage({
     wx.getStorage({
@@ -105,22 +45,8 @@ Page({
           data: {},
           data: {},
           success(res) {
           success(res) {
             if (res.data.errcode == 0) {
             if (res.data.errcode == 0) {
-              let datas = res.data.data
-              for (let i = 0; i < datas.length; i++) {
-                if (datas[i].status == 0) {
-                  datas[i].status = '未开始'
-                } else if (datas[i].status == 1) {
-                  datas[i].status = '报名中'
-                } else if (datas[i].status == 2) {
-                  datas[i].status = '待比赛'
-                } else if (datas[i].status == 3) {
-                  datas[i].status = '进行中'
-                } else if (datas[i].status == 4) {
-                  datas[i].status = '已结束'
-                }
-              }
               that.setData({
               that.setData({
-                list: datas,
+                teamlist: res.data.data,
               });
               });
             } else {
             } else {
               wx.showToast({
               wx.showToast({

+ 4 - 10
pages/meMatch/detail.wxml

@@ -1,15 +1,10 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
   <view slot="info" class="main" style="height:{{infoHeight}}px;">
   <view slot="info" class="main" style="height:{{infoHeight}}px;">
     <view class="beijing1">
     <view class="beijing1">
-      <view class="list1" wx:key="item" wx:for="{{list}}">
+      <view class="list1" wx:key="item" wx:for="{{teamlist}}">
       <view class="annns">
       <view class="annns">
-      <view>
           <view class="names" data-name="{{item._id}}" bindtap="tiao">{{item.name}}</view>
           <view class="names" data-name="{{item._id}}" bindtap="tiao">{{item.name}}</view>
-          <view class="listbut"> <button class="button" size="mini" style="background:rgb(238, 147, 28);" wx:if="{{item.status == '未开始'}}">{{item.status}}</button>
-            <button class="button" size="mini" style="background:rgb(238, 88, 28);" wx:if="{{item.status == '待比赛'}}">{{item.status}}</button>
-            <button class="button" size="mini" style="background:rgb(54, 233, 48)" wx:if="{{item.status == '报名中'}}">{{item.status}}</button>
-            <button class="button" size="mini" style="background:rgb(54, 233, 48)" wx:if="{{item.status == '进行中'}}">{{item.status}}</button>
-            <button class="button" size="mini" style="background:rgb(136, 136, 136);" wx:if="{{item.status == '已结束'}}">{{item.status}}</button>
+          <view class="listbut"> <button class="color{{item.status}}" size="mini">{{item.status=='0'?'未开始':item.status=='1'?'报名中':item.status=='2'?'待比赛':item.status=='3'?'进行中':'已结束'}}</button>
           </view> 
           </view> 
           <view class="leftmueen">
           <view class="leftmueen">
           <view class="otherInfos">
           <view class="otherInfos">
@@ -17,11 +12,10 @@
           </view>
           </view>
           <view class="otherInfo textOver"><text class="text3">{{item.address}}</text></view>
           <view class="otherInfo textOver"><text class="text3">{{item.address}}</text></view>
         </view>
         </view>
-        </view>
       </view> 
       </view> 
         <view class="annn">
         <view class="annn">
-          <button size="mini" bindtap="maintain" data-id="{{item._id}}" class="btn1">维护</button>
-          <button size="mini" bindtap="layout" data-id="{{item._id}}" class="btn2">编排</button>
+          <button size="mini" bindtap="maintain" data-type="maintain" data-id="{{item._id}}" class="btn1">维护</button>
+          <button size="mini" bindtap="maintain" data-type="lays" data-id="{{item._id}}" class="btn2">编排</button>
         </view>
         </view>
       </view>
       </view>
     </view>
     </view>

+ 19 - 0
pages/meMatch/detail.wxss

@@ -3,6 +3,25 @@
   width: 100%;
   width: 100%;
   background-color: #f1f1f1;
   background-color: #f1f1f1;
 }
 }
+.beijing1 .list1 .annns .listbut .color0 {
+  background: rgb(238, 147, 28);
+}
+
+.beijing1 .list1 .annns .listbut .color1 {
+  background: rgb(54, 233, 48)
+}
+
+.beijing1 .list1 .annns .listbut .color2 {
+  background: rgb(238, 88, 28);
+}
+
+.beijing1 .list1 .annns .listbut .color3 {
+  background: rgb(238, 147, 28);
+}
+
+.beijing1 .list1 .annns .listbut .color4 {
+  background: rgb(136, 136, 136);
+}
 
 
 .list1 {
 .list1 {
   width: 100%;
   width: 100%;

+ 0 - 1
pages/team/apply.js

@@ -14,7 +14,6 @@ Page({
     apply_time: '',
     apply_time: '',
     ids: '',
     ids: '',
     src: '/image/adimges.jpg',
     src: '/image/adimges.jpg',
-    src1: '/image/head1.png',
     isshow: true,
     isshow: true,
     // 主体高度
     // 主体高度
     infoHeight: '',
     infoHeight: '',

+ 1 - 1
pages/team/apply.wxml

@@ -15,7 +15,7 @@
       </view>
       </view>
     </view>
     </view>
     <view class="one-3">
     <view class="one-3">
-      <view class="group">{{teamlist.name}}</view>
+      <view class="group textOver">{{teamlist.name}}</view>
       <view class="person">共{{teamlist.members.length||0}}人</view>
       <view class="person">共{{teamlist.members.length||0}}人</view>
     </view>
     </view>
     <view class="two">
     <view class="two">

+ 11 - 56
pages/team/examine.js

@@ -10,55 +10,12 @@ Page({
     frameStyle: { useTop: false, name: '团队详情', leftArrow: true, useBar: false },
     frameStyle: { useTop: false, name: '团队详情', leftArrow: true, useBar: false },
     ids: '',
     ids: '',
     src: '/image/adimges.jpg',
     src: '/image/adimges.jpg',
-    src1: '/image/head1.png',
     // 主体高度
     // 主体高度
     infoHeight: '',
     infoHeight: '',
-    list: [
-      {
-        id: '1', time: '08:30', date: '2022.01.15', Founder: 'XXX', group: '哈拉海队', person: '10'
-      }
-    ],
-    listend: [
-      {
-        id: '1', name: '经开区足球比赛', state: '已结束', mark: '团队获得第4名', num: '20'
-      },
-      {
-        id: '1', name: '经开区足球比赛', state: '已结束', mark: '团队获得第4名', num: '20'
-      },
-      {
-        id: '1', name: '经开区足球比赛', state: '已结束', mark: '团队获得第4名', num: '20'
-      }
-    ],
-    lists: [
-      {
-        id: '1', name: '老头1', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '老头2', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '老头3', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '老头4', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '老头5', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '老头6', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '老头7', head: '/image/tou.png'
-      },
-
-      {
-        id: '1', name: '老头8', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '老头9', head: '/image/tou.png'
-      },
-    ],
+    //团队详情
+    teamlist: [],
+    //参考历史
+    historylist: [],
   },
   },
   back: function () {
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })
     wx.navigateBack({ url: '/pages/home/index' })
@@ -67,29 +24,27 @@ Page({
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */
   onLoad: function (options) {
   onLoad: function (options) {
+    this.setData({ ids: options.id });
     // 计算高度
     // 计算高度
     this.searchHeight()
     this.searchHeight()
-    this.ids = options.id;
     // 监听用户是否登录
     // 监听用户是否登录
     this.watchLogin();
     this.watchLogin();
   },
   },
    // 监听用户是否登录
    // 监听用户是否登录
    watchLogin: function () {
    watchLogin: function () {
     var that = this;
     var that = this;
-    let id = that.ids
     wx.getStorage({
     wx.getStorage({
       key: 'token',
       key: 'token',
       success: res => {
       success: res => {
         //查询数据
         //查询数据
         wx.request({
         wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id, //接口地址
+          url: `${app.globalData.publicUrl}/courtAdmin/api/team/${this.data.ids}`, //接口地址
           method: 'get',
           method: 'get',
           data: '',
           data: '',
           success(res) {
           success(res) {
             if (res.data.errcode == 0) {
             if (res.data.errcode == 0) {
-              let datas = res.data.data
               that.setData({
               that.setData({
-                list: datas,
+                teamlist: res.data.data,
               });
               });
             } else {
             } else {
               wx.showToast({
               wx.showToast({
@@ -102,8 +57,9 @@ Page({
         })
         })
         //参赛历史
         //参赛历史
         var that = this;
         var that = this;
-        var list = that.data.list;
-        var match_id = that.ids;
+        var list = that.data.teamlist;
+        var match_id = that.data.ids;
+        debugger
         var match_name = list.name;
         var match_name = list.name;
         wx.request({
         wx.request({
           url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
           url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
@@ -114,9 +70,8 @@ Page({
           },
           },
           success(res) {
           success(res) {
             if (res.data.errcode == 0) {
             if (res.data.errcode == 0) {
-              let datas = res.data.data
               that.setData({
               that.setData({
-                listend: datas,
+                historylist: res.data.data,
               });
               });
             } else {
             } else {
               wx.showToast({
               wx.showToast({

+ 8 - 8
pages/team/examine.wxml

@@ -11,11 +11,11 @@
         <image class="image" src="{{src}}"></image>
         <image class="image" src="{{src}}"></image>
       </view>
       </view>
       <view class="one-2">
       <view class="one-2">
-        <image class="imgs" src="{{list.logo[0].url}}"></image>
+        <image class="imgs" src="{{teamlist.logo[0].url}}"></image>
       </view>
       </view>
       <view class="one-3">
       <view class="one-3">
-      <view class="group ">{{list.name}}</view>
-      <view class="person">共{{list.members.length||0}}人</view>
+      <view class="group textOver">{{teamlist.name}}</view>
+      <view class="person">共{{teamlist.members.length||0}}人</view>
     </view>
     </view>
     </view>
     </view>
     <view class="two">
     <view class="two">
@@ -25,7 +25,7 @@
             <text class=" icon iconfont icon-dian"></text>
             <text class=" icon iconfont icon-dian"></text>
           </view>
           </view>
           <view class="two-right1">
           <view class="two-right1">
-            <view><text class="zi">创建人:</text>{{list.create_user}}</view>
+            <view><text class="zi">创建人:</text>{{teamlist.create_user}}</view>
           </view>
           </view>
         </view>
         </view>
         <view class="two2">
         <view class="two2">
@@ -33,19 +33,19 @@
             <text class=" icon iconfont icon-dian"></text>
             <text class=" icon iconfont icon-dian"></text>
           </view>
           </view>
           <view class="two-right2">
           <view class="two-right2">
-            <view><text class="zi">创建时间:</text><text class="date">{{list.create_time}}</text></view>
+            <view><text class="zi">创建时间:</text><text class="date">{{teamlist.create_time}}</text></view>
           </view>
           </view>
         </view>
         </view>
       </view>
       </view>
     </view>
     </view>
     <view class="thr">
     <view class="thr">
       <view><text class="tuan">队员信息</text></view>
       <view><text class="tuan">队员信息</text></view>
-      <view class="thr-1" wx:key="item" wx:for="{{list.members}}">
+      <view class="thr-1" wx:key="item" wx:for="{{teamlist.members}}">
         <view class="thr1">
         <view class="thr1">
           <view class="thr-left">
           <view class="thr-left">
             <image class="img" src="{{item.icon[0].url}}"></image>
             <image class="img" src="{{item.icon[0].url}}"></image>
           </view>
           </view>
-          <view class="thr-right"><text class="name textOver">{{item.nickname}}</text> </view>
+          <view class="thr-right textOver"><text class="name">{{item.nickname}}</text> </view>
         </view>
         </view>
       </view>
       </view>
     </view>
     </view>
@@ -53,7 +53,7 @@
       <view class="four1">
       <view class="four1">
         <text class="four11">参赛历史</text>
         <text class="four11">参赛历史</text>
       </view>
       </view>
-      <view class="list" wx:key="item" wx:for="{{listend}}">
+      <view class="list" wx:key="item" wx:for="{{historylist}}">
         <view class="four2">
         <view class="four2">
           <view class="left">
           <view class="left">
             <view class="names">{{item.match_name}}</view>
             <view class="names">{{item.match_name}}</view>

+ 4 - 9
pages/team/examine.wxss

@@ -22,7 +22,7 @@
   font-weight: 600;
   font-weight: 600;
   position: absolute;
   position: absolute;
   top: 5%;
   top: 5%;
-  left: 42%;
+  left: 43%;
   color: #ffffff;
   color: #ffffff;
 }
 }
 
 
@@ -37,20 +37,18 @@
 .one-3{
 .one-3{
   position: absolute;
   position: absolute;
   margin-top: -22%;
   margin-top: -22%;
-  margin-left: 40%;
+  margin-left: 32%;
   width: 40%;
   width: 40%;
   height: 63.78px;
   height: 63.78px;
 }
 }
 
 
 .imgs {
 .imgs {
   border-radius: 50%;
   border-radius: 50%;
-  margin-top: 4px;
-  margin-left: 2px;
   width: 70px;
   width: 70px;
   height: 70px;
   height: 70px;
 }
 }
 .person {
 .person {
-  margin-left: 21%;
+  text-align: center;
   font-size: 13px;
   font-size: 13px;
   color: #ffffff;
   color: #ffffff;
   font-weight: 300;
   font-weight: 300;
@@ -121,9 +119,6 @@
   background-color: #eeeeee;
   background-color: #eeeeee;
   border-radius: 24.5px;
   border-radius: 24.5px;
 }
 }
-.thr-right{
-  margin-left: 3px;
-}
 
 
 .img {
 .img {
   width: 100%;
   width: 100%;
@@ -161,7 +156,6 @@
 }
 }
 
 
 .name {
 .name {
-  text-align: center;
   font-size: 13px;
   font-size: 13px;
   color: #727272;
   color: #727272;
 }
 }
@@ -172,6 +166,7 @@
 }
 }
 
 
 .group {
 .group {
+  text-align: center;
   color: #ffffff;
   color: #ffffff;
   margin-top: 10%;
   margin-top: 10%;
   margin-bottom: 10%;
   margin-bottom: 10%;

+ 19 - 39
pages/team/index.js

@@ -12,6 +12,7 @@ Page({
     src: '/image/team.png',
     src: '/image/team.png',
     // 主体高度
     // 主体高度
     infoHeight: '',
     infoHeight: '',
+    //团队列表
     teamlist: [],
     teamlist: [],
   },
   },
   // 跳转菜单
   // 跳转菜单
@@ -19,19 +20,10 @@ Page({
     let { route } = e.detail.detail;
     let { route } = e.detail.detail;
     if (route) wx.redirectTo({ url: `/${route}` })
     if (route) wx.redirectTo({ url: `/${route}` })
   },
   },
-  //跳转查看
-  tiao: function (e) {
-    let id = e.currentTarget.dataset.id;
-    wx.navigateTo({
-      url: '/pages/team/examine?id=' + id,
-    })
-  },
-  //跳转加入
+  //跳转查看或加入
   jump: function (e) {
   jump: function (e) {
-    let id = e.currentTarget.dataset.id;
-    wx.navigateTo({
-      url: '/pages/team/apply?id=' + id,
-    })
+    let { id, type } = e.currentTarget.dataset;
+    if (type) wx.navigateTo({ url: `/pages/team/${type}?id=${id}` })
   },
   },
   /**
   /**
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
@@ -42,13 +34,13 @@ Page({
     // 监听用户是否登录
     // 监听用户是否登录
     this.watchLogin();
     this.watchLogin();
   },
   },
-   // 监听用户是否登录
-   watchLogin: function () {
+  // 监听用户是否登录
+  watchLogin: function () {
     var that = this;
     var that = this;
     wx.getStorage({
     wx.getStorage({
       key: 'token',
       key: 'token',
       success: res => {
       success: res => {
-        this.setData({
+        that.setData({
           type: res.data.type,
           type: res.data.type,
         })
         })
         //查询数据
         //查询数据
@@ -58,20 +50,8 @@ Page({
           data: '',
           data: '',
           success(res) {
           success(res) {
             if (res.data.errcode == 0) {
             if (res.data.errcode == 0) {
-              let datas = res.data.data
-              for (let i = 0; i < datas.length; i++) {
-                if (datas[i].status == 0) {
-                  datas[i].status = '待比赛'
-                } else if (datas[i].status == 1) {
-                  datas[i].status = '进行中'
-                } else if (datas[i].status == 2) {
-                  datas[i].status = '报名中'
-                } else if (datas[i].status == 3) {
-                  datas[i].status = '已结束'
-                }
-              }
               that.setData({
               that.setData({
-                teamlist: datas,
+                teamlist: res.data.data,
               });
               });
             } else {
             } else {
               wx.showToast({
               wx.showToast({
@@ -88,17 +68,17 @@ Page({
       }
       }
     })
     })
   },
   },
- // 计算高度
- 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 })
-},
+  // 计算高度
+  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 })
+  },
 
 
   /**
   /**
    * 生命周期函数--监听页面初次渲染完成
    * 生命周期函数--监听页面初次渲染完成

+ 2 - 2
pages/team/index.wxml

@@ -23,8 +23,8 @@
           <view class="time"><text class="date">{{item.create_time}}创建</text></view>
           <view class="time"><text class="date">{{item.create_time}}创建</text></view>
         </view>
         </view>
         <view class="right">
         <view class="right">
-          <button class="button" wx:if="{{type== 2}}" bindtap="jump" data-id="{{item._id}}" >加入</button>
-          <button class="button"  wx:if="{{type!= 2}}" bindtap="tiao" data-id="{{item._id}}">查看</button>
+          <button class="button" wx:if="{{type== 2}}" bindtap="jump" data-id="{{item._id}}" data-type="apply">加入</button>
+          <button class="button"  wx:if="{{type!= 2}}" bindtap="jump" data-id="{{item._id}}" data-type="examine">查看</button>
         </view>
         </view>
       </view>
       </view>
     </view>
     </view>