zs пре 3 година
родитељ
комит
b6a32cada3

+ 38 - 34
pages/administration/detail.js

@@ -7,46 +7,47 @@ Page({
    * 页面的初始数据
    */
   data: {
+    ids: '',
     src: '/image/adimges.jpg',
     src1: '/image/head1.png',
     frameStyle: { useTop: false, name: '团队审核', leftArrow: true, useBar: false },
     // 主体高度
     infoHeight: '',
-    list: [
-      {
-        id: '1',time: '08:30', date: '2022.01.15',Founder:'XXX',group:'哈拉海队',person:'10'
-      }
-    ],
-    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'
+    list: [],
+    lists: [],
+  },
+  watchLogin: function () {
+    var that = this;
+    let id = that.ids
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        //查询数据
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id, //接口地址
+          method: 'get',
+          data: '',
+          success(res) {
+            if (res.data.errcode == 0) {
+              let datas = res.data.data
+              console.log('单', datas);
+              that.setData({
+                list: datas,
+              });
+            } else {
+              wx.showToast({
+                title: res.data.errmsg,
+                icon: 'none',
+                duration: 2000
+              })
+            }
+          }
+        })
       },
-    ],
+      fail: res => {
+        return wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
   },
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })
@@ -55,8 +56,11 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    this.ids = options.id;
     // 计算高度
     this.searchHeight()
+    // 监听用户是否登录
+    this.watchLogin();
   },
   // 计算高度
   searchHeight: function () {

+ 10 - 10
pages/administration/detail.wxml

@@ -10,22 +10,22 @@
         </view>
         <image style="width: 100%; height: 280px; background-color: #eeeeee;" src="{{src}}"></image>
       </view>
-      <view class="one-2" wx:key="item" wx:for="{{list}}">
-        <image class="imgs" src="{{src1}}"></image>
+      <view class="one-2">
+        <image class="imgs" src="{{list.logo}}"></image>
       </view>
-      <view class="one-3" wx:key="item" wx:for="{{list}}">
-        <view class="group">{{item.group}}</view>
-        <view class="person">共{{item.person}}人</view>
+      <view class="one-3">
+        <view class="group">{{list.name}}</view>
+        <view class="person">共{{members.length}}人</view>
       </view>
     </view>
-    <view class="two" wx:key="item" wx:for="{{list}}">
+    <view class="two">
       <view class="two-1">
         <view class="two1">
           <view class="two-left1">
             <text class=" icon iconfont icon-dian"></text>
           </view>
           <view class="two-right1">
-            <view><text class="zi">创建人:</text>{{item.Founder}}</view>
+            <view><text class="zi">创建人:</text>{{list.create_user}}</view>
           </view>
         </view>
         <view class="two2">
@@ -33,17 +33,17 @@
             <text class=" icon iconfont icon-dian"></text>
           </view>
           <view class="two-right2">
-            <view><text class="zi">创建时间:</text><text class="date">{{item.date}}</text>{{item.time}}</view>
+            <view><text class="zi">创建时间:</text><text class="date">{{list.create_time}}</text></view>
           </view>
         </view>
       </view>
     </view>
     <view class="thr">
       <view><text class="tuan">队员信息</text></view>
-      <view class="thr-1" wx:key="item" wx:for="{{lists}}">
+      <view class="thr-1" wx:key="item" wx:for="{{list.members}}">
         <view class="thr1">
           <view class="thr-left">
-            <image class="img" src="{{item.head}}"></image>
+            <image class="img" src="{{item.logo}}"></image>
           </view>
           <view class="thr-right"><text class="name">{{item.name}}</text> </view>
         </view>

+ 66 - 45
pages/administration/index.js

@@ -15,57 +15,73 @@ Page({
     frameStyle: { useTop: true, name: '比赛管理', leftArrow: false, useBar: true },
     // 主体高度
     infoHeight: '',
-    list: [
-      {
-        id: '1', name: '朝阳区乒乓球比赛', week: '星期五', time: '13:00',
-        state: '进行中', listbisai: [
-          {
-            id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '1', groupname2: '马尼拉老年组', group: '第一组', fraction1: '2', groupname1: '哈拉海队幼儿园', match: '循环赛'
+    list: [],
+    liststart: [],
+    listend: [],
+  },
+   // 查询数据
+   search: function () {
+    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 datastart = []
+          let dataend = []
+          for (let i = 0; i < datas.length; i++) {
+            if (datas[i].status == 0) {
+              datas[i].status = '待比赛'
+              datastart.push(datas[i])
+            } else if (datas[i].status == 1) {
+              datas[i].status = '进行中'
+              datass.push(datas[i])
+            } else if (datas[i].status == 2) {
+              datas[i].status = '报名中'
+            } else if (datas[i].status == 3) {
+              datas[i].status = '已结束'
+              dataend.push(datas[i])
+            }
           }
-        ], date: '2022.01.15', address: '吉林省长春市远创国际A座'
-      },
-      {
-        id: '1', name: '经开区足球比赛',
-        week: '星期一', listbisai: [
-          {
-            id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '1', groupname2: '马尼拉老年组', group: '第一组', fraction1: '2', groupname1: '哈拉海队幼儿园', match: '循环赛'
-          }
-        ], time: '09:00', state: '进行中', date: '2022.01.20', address: '吉林省长春市远创国际A座'
-      },
-
-    ],
-    liststart: [
-      {
-        id: '1', name: '朝阳区乒乓球比赛', week: '星期五', time: '13:00',
-        state: '待比赛', listbisai: [
-          {
-            id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '0', groupname2: '马尼拉老年组', group: '第一组', fraction1: '0', groupname1: '哈拉海队幼儿园', match: '循环赛'
-          }
-        ], date: '2022.01.15', address: '吉林省长春市远创国际A座'
-      },
-      {
-        id: '1', name: '经开区足球比赛',
-        week: '星期一', listbisai: [], time: '09:00', state: '待比赛', date: '2022.01.20', address: '吉林省长春市远创国际A座'
-      },
-    ],
-    listend: [
-      {
-        id: '1', name: '朝阳区乒乓球比赛', week: '星期五', time: '13:00',
-        state: '已结束', listbisai: [], date: '2022.01.15', address: '吉林省长春市远创国际A座'
-      },
-      {
-        id: '1', name: '朝阳区乒乓球比赛', week: '星期五', time: '13:00',
-        state: '已结束', listbisai: [], date: '2022.01.15', address: '吉林省长春市远创国际A座'
+          that.setData({
+            list: datass,
+            liststart: datastart,
+            listend: dataend,
+          });
+        } else {
+          wx.showToast({
+            title: res.data.errmsg,
+            icon: 'none',
+            duration: 2000
+          })
+        }
+      }
+    })
+  },
+   // 监听用户是否登录
+   watchLogin: function () {
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        console.log(res);
       },
-    ],
+      fail: res => {
+       return wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
   },
   tabPath(e) {
     let query = e.detail.detail;
     if (query) wx.redirectTo({ url: `/pages/${query}/index` })
   },
-  tiao: function () {
+  tiao: function (e) {
+    let id= e.currentTarget.dataset.name;
+    console.log(id);
     wx.navigateTo({
-      url: '/pages/list/index',
+      url: '/pages/list/index?id='+id,
     })
   },
   xun: function () {
@@ -88,16 +104,21 @@ Page({
       url: `/pages/manage/index`,
     })
   },
+  //标签页
   setup() {
-    const active = ref(0);
-    return { active };
+    const activeName = ref('a');
+    return { activeName };
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    // 监听用户是否登录
+    this.watchLogin();
     // 计算高度
     this.searchHeight()
+    // 查询数据
+    this.search();
   },
   // 计算高度
   searchHeight: function () {

+ 14 - 22
pages/administration/index.wxml

@@ -1,11 +1,10 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:tabPath="tabPath">
   <view slot="info" class="main" style="height:{{infoHeight}}px;">
-    <!-- <text class="theme">比赛管理</text> -->
     <view class="one">
       <image src="{{src}}" class="images"></image>
     </view>
     <view class="two">
-      <text class="themes" bindtap='jump' >创建比赛</text>
+      <text class="themes" bindtap='jump'>创建比赛</text>
       <image class="imags" src="{{src1}}"></image>
     </view>
     <view class="thr">
@@ -15,22 +14,20 @@
         <image class="imagh" src="{{src2}}"></image>
       </view>
       <view class="right">
-        <text class="th" bindtap='shen' >团队审批</text>
+        <text class="th" bindtap='shen'>团队审批</text>
         <image class="imagx" src="{{src5}}"></image>
         <image class="imagh" src="{{src2}}"></image>
       </view>
     </view>
     <view class="four">
-      <van-tabs v-model:active="active" class="van">
+      <van-tabs v-model:active="activeName">
         <van-tab title="进行中">
           <view class="list" wx:key="item" wx:for="{{list}}">
-            <view class="name" bindtap="tiao" >{{item.name}}</view>
-            <button class="button" size="mini">{{item.state}}</button>
+            <view class="name" data-name="{{item._id}}" bindtap="tiao">{{item.name}}</view>
+            <button class="button" size="mini">{{item.status}}</button>
             <view class="left1">
               <view class="otherInfos">
-                <text class="text1">{{item.date}}</text>
-                <text class="text1">{{item.week}}</text>
-                <text class="text1">{{item.time}}</text>
+                <text class="text1">{{item.single_time}}</text>
               </view>
               <view class="otherInfo textOver"><text class="text3">{{item.address}}</text></view>
             </view>
@@ -59,18 +56,16 @@
         </van-tab>
         <van-tab title="未开始">
           <view class="list" wx:key="item" wx:for="{{liststart}}">
-            <view class="name" bindtap="tiao" >{{item.name}}</view>
-            <button class="buttonstart" size="mini">{{item.state}}</button>
+            <view class="name" data-name="{{item._id}}" bindtap="tiao">{{item.name}}</view>
+            <button class="buttonstart" size="mini">{{item.status}}</button>
             <view class="left1">
               <view class="otherInfos">
-                <text class="text1">{{item.date}}</text>
-                <text class="text1">{{item.week}}</text>
-                <text class="text1">{{item.time}}</text>
+                <text class="text1">{{item.single_time}}</text>
               </view>
               <view class="otherInfo textOver"><text class="text3">{{item.address}}</text></view>
             </view>
             <view class="right1" wx:if="{{item.listbisai}}" wx:for="{{item.listbisai}}" wx:for-item="items" wx:key="key">
-              <view class="right1_1" bindtap="xun" >
+              <view class="right1_1" bindtap="xun">
                 <text class="text4">{{items.match}}</text>
                 <text class="text4">{{items.group}}</text>
               </view>
@@ -94,18 +89,15 @@
         </van-tab>
         <van-tab title="已结束">
           <view class="list" wx:key="item" wx:for="{{listend}}">
-            <view class="name" bindtap="tiao" >{{item.name}}</view>
-            <button class="buttonend" size="mini">{{item.state}}</button>
+            <view class="name" data-name="{{item._id}}" bindtap="tiao">{{item.name}}</view>
+            <button class="buttonend" size="mini">{{item.status}}</button>
             <view class="left1">
               <view class="otherInfos">
-                <text class="text1">{{item.date}}</text>
-                <text class="text1">{{item.week}}</text>
-                <text class="text1">{{item.time}}</text>
+                <text class="text1">{{item.single_time}}</text>
               </view>
               <view class="otherInfo textOver"><text class="text3">{{item.address}}</text></view>
             </view>
-            <view class="right1" wx:if="{{item.listbisai}}" wx:for="{{item.listbisai}}" wx:for-item="items"
-            wx:key="key">
+            <view class="right1" wx:if="{{item.listbisai}}" wx:for="{{item.listbisai}}" wx:for-item="items" wx:key="key">
               <view class="right1_1">
                 <text class="text4">{{items.match}}</text>
                 <text class="text4">{{items.group}}</text>

+ 73 - 1
pages/competition/index.js

@@ -10,7 +10,8 @@ Page({
     frameStyle: { useTop: true, name: '创建比赛', leftArrow: true, useBar: false },
     // 主体高度
     infoHeight: '',
-
+    names: '',
+    address: '',
     date: '2018-01-01',//默认起始时间  
     date2: '2018-01-24',//默认结束时间 
     singledate: '2018-09-01',
@@ -30,6 +31,71 @@ Page({
     // 赛制储存信息
     szList: [],
   },
+  initValidate() {
+    const rules = { name: { required: true }, match_time: { required: true, }, single_time: { required: true }, address: { required: true, }, format: { required: true } }
+    // 验证字段的提示信息,若不传则调用默认的信息
+    const messages = { name: { required: '请输入比赛名称', }, match_time: { required: '请输入时间', }, single_time: { required: '请输入单场时间', }, address: { required: '请输入地点', }, format: { required: '请选择赛制', } };
+    this.WxValidate = new WxValidate(rules, messages)
+  },
+  // 监听用户是否登录
+  watchLogin: function () {
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        console.log(res);
+      },
+      fail: res => {
+        return wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
+  },
+  // 提交创建
+  onSubmit: function (e) {
+    var name = this.data.names;
+    var match_time = this.data.date + ' - ' + this.data.date2;
+    var single_time = this.data.singledate + ' ' + this.data.time;
+    var address = this.data.address;
+    var format = this.data.szList;
+    const params = {
+      "name": name,
+      "match_time": match_time,
+      "single_time": single_time,
+      "address": address,
+      "format": format,
+    };
+    if (!this.WxValidate.checkForm(params)) {
+      const error = this.WxValidate.errorList[0];
+      wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+      return false
+    } else {
+      wx.request({
+        url: `${app.globalData.publicUrl}/courtAdmin/api/match`, //接口地址
+        method: 'post',
+        data: params,
+        success(res) {
+          console.log(res.data);
+          if (res.data.errcode == 0) {
+            wx.showToast({ title: `创建比赛成功`, icon: 'success', duration: 2000 }) //创建成功提示
+            wx.navigateTo({ url: '/pages/administration/index' })// 跳转页面
+          } else {
+            wx.showToast({
+              title: res.data.errmsg,
+              icon: 'none',
+              duration: 2000
+            })
+          }
+        }
+      })
+    }
+  },
+  //input改变值
+  onChangenames(e) {
+    this.data.names = e.detail
+  },
+  //input改变值
+  onChangeaddress(e) {
+    this.data.address = e.detail
+  },
   // 确定选择
   szChange: function (e) {
     const that = this;
@@ -96,10 +162,16 @@ Page({
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })
   },
+
+
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    // 监听用户是否登录
+    this.watchLogin();
+    //验证规则函数
+    this.initValidate()
     // 计算高度
     this.searchHeight()
     const that = this;

+ 3 - 3
pages/competition/index.wxml

@@ -2,7 +2,7 @@
   <view slot="info" class="main" style="height:{{infoHeight}}px;">
     <view>
       <van-cell-group>
-        <van-field value="{{ name }}" label="比赛名称" placeholder="请输入比赛名称" input-align="right" />
+        <van-field value="{{names}}" bind:change="onChangenames" label="比赛名称" placeholder="请输入比赛名称" input-align="right" />
       </van-cell-group>
     </view>
     <view class="page">
@@ -36,7 +36,7 @@
       </view>
       <view class="adress">
         <van-cell-group>
-          <van-field value="{{ address }}" label="地点" placeholder="请输入地点" input-align="right" />
+          <van-field value="{{ address }}"  bind:change="onChangeaddress" label="地点" placeholder="请输入地点" input-align="right" />
         </van-cell-group>
       </view>
       <view class="multone">
@@ -61,7 +61,7 @@
     </view>
     <view class="team">
       <view class="two">
-        <button class="button" form-type="submit">创建比赛</button>
+        <button class="button" bindtap="onSubmit">创建比赛</button>
       </view>
     </view>
   </view>

+ 2 - 2
pages/competition/index.wxss

@@ -45,7 +45,7 @@
 .section {
   font-size: 14px;
   font-weight: 500;
-  width: 100%;
+  width: 96%;
   margin-top: 0.8px;
   padding-left: 13px;
   line-height: 80rpx;
@@ -54,7 +54,7 @@
 
 .section__title {
   float: left;
-  width: 61%;
+  width: 65%;
 }
 
 .picker {

+ 44 - 25
pages/home/index.js

@@ -11,32 +11,49 @@ Page({
     frameStyle: { useTop: false, name: '首页', leftArrow: false, useBar: true, tabSelectid: '0' },
     // 主体高度
     infoHeight: '',
-    list: [
-      {
-        id: '1', name: '朝阳区乒乓球比赛', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '1', groupname2: '马尼拉老年组', group: '第一组', fraction1: '2', groupname1: '哈拉海队幼儿园', match: '循环赛', week: '星期五', time: '13:00',
-        state: '进行中', listbisai: [
-          {
-            id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '1', groupname2: '马尼拉老年组', group: '第一组', fraction1: '2', groupname1: '哈拉海队幼儿园', match: '循环赛'
+    list: [],
+  },
+   // 查询数据
+   search: function () {
+    var that = this;
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/match`, //接口地址
+      method: 'get',
+      data: {},
+      success(res) {
+        console.log('res', res.data);
+        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 = '已结束'
+            }
           }
-        ], date: '2022.01.15', address: '吉林省长春市远创国际A座'
-      },
-      {
-        id: '1', name: '经开区足球比赛', fraction2: '1', groupname2: '马尼拉老年组', group: '第二组', fraction1: '2', groupname1: '哈拉海队幼儿园', match: '循环赛',
-        week: '星期一', listbisai: [], head2: '/image/head2.png', head1: '/image/head1.png', time: '09:00', state: '待比赛', date: '2022.01.20', address: '吉林省长春市远创国际A座'
-      },
-      {
-        id: '1', name: '经开区足球比赛', fraction2: '1', groupname2: '马尼拉老年组', group: '第二组', fraction1: '2', groupname1: '哈拉海队幼儿园', match: '循环赛',
-        week: '星期一', listbisai: [], head2: '/image/head2.png', head1: '/image/head1.png', time: '09:00', state: '报名中', date: '2022.01.20', address: '吉林省长春市远创国际A座'
-      },
-      {
-        id: '1', name: '经开区足球比赛', fraction2: '1', groupname2: '马尼拉老年组', group: '第二组', fraction1: '2', groupname1: '哈拉海队幼儿园', match: '循环赛',
-        week: '星期一', listbisai: [], head2: '/image/head2.png', head1: '/image/head1.png', time: '09:00', state: '已结束', date: '2022.01.20', address: '吉林省长春市远创国际A座'
-      },
-    ],
+          that.setData({
+            //getSales:temp,
+            list: datas,
+          });
+        } else {
+          wx.showToast({
+            title: res.data.errmsg,
+            icon: 'none',
+            duration: 2000
+          })
+        }
+      }
+    })
   },
-  tiao: function () {
+  tiao: function (e) {
+    let id= e.currentTarget.dataset.name;
+    console.log(id);
     wx.navigateTo({
-      url: '/pages/list/index',
+      url: '/pages/list/index?id='+id,
     })
   },
   xun: function () {
@@ -55,7 +72,9 @@ Page({
     // 监听用户是否登录
     this.watchLogin();
     // 计算高度
-    this.searchHeight()
+    this.searchHeight();
+    // 查询数据
+    this.search();
   },
   // 监听用户是否登录
   watchLogin: function () {
@@ -65,7 +84,7 @@ Page({
         console.log(res);
       },
       fail: res => {
-        wx.redirectTo({ url: '/pages/login/index', })
+       return wx.redirectTo({ url: '/pages/login/index', })
       }
     })
   },

+ 8 - 8
pages/home/index.wxml

@@ -6,18 +6,18 @@
     <view class="two">
       <view class="list" wx:key="item" wx:for="{{list}}">
         <view class="listtou">
-          <view class="name" bindtap="tiao">{{item.name}}</view>
-          <view class="listbut"> <button class="button" size="mini" style="background:rgb(238, 147, 28);" wx:if="{{item.state == '进行中'}}">{{item.state}}</button>
-            <button class="button" size="mini" style="background:rgb(238, 88, 28);" wx:if="{{item.state == '待比赛'}}">{{item.state}}</button>
-            <button class="button" size="mini" style="background:rgb(54, 233, 48)" wx:if="{{item.state == '报名中'}}">{{item.state}}</button>
-            <button class="button" size="mini" style="background:rgb(136, 136, 136);" wx:if="{{item.state == '已结束'}}">{{item.state}}</button>
+          <view class="name"  bindtap="tiao" data-name="{{item._id}}">{{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(136, 136, 136);" wx:if="{{item.status == '已结束'}}">{{item.status}}</button>
           </view>
         </view>
         <view class="left1">
           <view class="otherInfos">
-            <text class="text1">{{item.date}}</text>
-            <text class="text1">{{item.week}}</text>
-            <text class="text1">{{item.time}}</text>
+            <text class="text1">{{item.single_time}}</text>
+            <!-- <text class="text1">{{item.week}}</text>
+            <text class="text1">{{item.time}}</text> -->
           </view>
           <view class="otherInfo textOver"><text class="text3">{{item.address}}</text></view>
         </view>

+ 111 - 64
pages/list/index.js

@@ -7,80 +7,124 @@ Page({
    * 页面的初始数据
    */
   data: {
+    ids: '',
     src: '/image/yun.jpg',
     frameStyle: { useTop: false, name: '比赛列表', leftArrow: false, useBar: false, tabSelectid: '0' },
     // 主体高度
     infoHeight: '',
     active: 1,
-    list: [
-      {
-        id: '1', name: '经开区足球比赛', fraction2: '1', groupname2: '马尼拉老年组', group: '第二组', fraction1: '2', groupname1: '哈拉海队幼儿园', match: '循环淘汰赛', listbisai: [], head2: '/image/head2.png', head1: '/image/head1.png', state: '报名中', datestart: '2022.01.20', dateend: '2022.01.22', address: '吉林省长春市远创国际A座'
-      }
-    ],
-    lists: [
-      {
-        id: '1', name: '参赛队伍名称', person: '20', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '参赛队伍名称', person: '20', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '参赛队伍名称', person: '20', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '参赛队伍名称', person: '20', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '参赛队伍名称', person: '20', head: '/image/tou.png'
-      },
-      {
-        id: '1', name: '参赛队伍名称', person: '20', head: '/image/tou.png'
+    list: [],
+    lists: [],
+    listbang: [],
+    listbisai: [],
+  },
+   // 监听用户是否登录
+   watchLogin: function () {
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        var that = this;
+        let id = that.ids
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/match/` + id, //接口地址
+          method: 'get',
+          // data: {},
+          success(res) {
+            console.log('res', res.data);
+            if (res.data.errcode == 0) {
+              let datas = res.data.data
+              if (datas.status == 0) {
+                datas.status = '待比赛'
+              } else if (datas.status == 1) {
+                datas.status = '进行中'
+              } else if (datas.status == 2) {
+                datas.status = '报名中'
+              } else if (datas.status == 3) {
+                datas.status = '已结束'
+              }
+              that.setData({
+                //getSales:temp,
+                list: datas,
+              });
+              // 查询参赛队伍数据
+              that.ranks();
+              // 查询赛程列表数据
+              that.course();
+            } else {
+              wx.showToast({
+                title: res.data.errmsg,
+                icon: 'none',
+                duration: 2000
+              })
+            }
+          }
+        })
       },
-      {
-        id: '1', name: '参赛队伍名称', person: '20', head: '/image/tou.png'
+      fail: res => {
+       return wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
+  },
+  // 查询参赛队伍数据
+  ranks: function () {
+    var that = this;
+    var list = that.data.list;
+    var match_id = that.ids;
+    var match_name = list.name;
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
+      method: 'get',
+      data: {
+        "match_id": match_id,
+        "match_name": match_name,
       },
-
-      {
-        id: '1', name: '参赛队伍名称', person: '20', head: '/image/tou.png'
+      success(res) {
+        if (res.data.errcode == 0) {
+          let datacan = res.data.data
+          that.setData({
+            lists: datacan,
+            listbang: datacan,
+          });
+        } else {
+          wx.showToast({
+            title: res.data.errmsg,
+            icon: 'none',
+            duration: 2000
+          })
+        }
       }
-    ],
-    listbang: [{
-      id: 1,
-      name: "哈拉海队幼儿组",
-      head: '/image/head2.png',
-      score1: "9",
-      score2: "0",
-      score0: "1"
-    }, {
-      id: 2,
-      name: "哈拉海队幼儿组",
-      head: '/image/head2.png',
-      score1: "1",
-      score2: "0",
-      score0: "1"
-    }, {
-      id: 3,
-      name: "哈拉海队幼儿组",
-      head: '/image/head2.png',
-      score1: "1",
-      score2: "0",
-      score0: "1"
-    }, {
-      id: 4,
-      name: "哈拉海队幼儿组",
-      head: '/image/head2.png',
-      score1: "1",
-      score2: "1",
-      score0: "1"
-    }],
-    listbisai: [
-      {
-        id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '0', groupname2: '马尼拉组', fraction1: '0', site: '第一场', groupname1: '哈拉海组', time: '13:00', date: '01.15', start: '未开始'
+    })
+  },
+  // 查询赛程列表数据
+  course: function () {
+    var that = this;
+    var list = that.data.list;
+    var match_id = that.ids;
+    var match_name = list.name;
+    var match_time = list.match_time;
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`, //接口地址
+      method: 'get',
+      data: {
+        "match_id": match_id,
+        "match_name": match_name,
+        "match_time": match_time,
       },
-      {
-        id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '0', groupname2: '马尼拉组', fraction1: '0', site: '第一场', groupname1: '哈拉海组', time: '13:00', date: '01.15', start: '已结束'
+      success(res) {
+        if (res.data.errcode == 0) {
+          let datasai = res.data.data
+          that.setData({
+            listbisai: datasai,
+          });
+        } else {
+          wx.showToast({
+            title: res.data.errmsg,
+            icon: 'none',
+            duration: 2000
+          })
+        }
       }
-    ],
+    })
   },
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })
@@ -93,8 +137,11 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    // 监听用户是否登录
+    this.watchLogin();
     // 计算高度
     this.searchHeight()
+    this.ids = options.id;
   },
   // 计算高度
   searchHeight: function () {

+ 37 - 46
pages/list/index.wxml

@@ -7,23 +7,22 @@
       <image style="width: 100%; height: 240px; background-color: #eeeeee;" src="{{src}}"></image>
     </view>
     <view class="two">
-      <view class="list" wx:key="item" wx:for="{{list}}">
+      <view class="list">
         <view class="listtou">
-          <view class="name">{{item.name}}</view>
-          <view class="listbut"> <button class="button" size="mini" style="background:rgb(238, 147, 28);" wx:if="{{item.state == '进行中'}}">{{item.state}}</button>
-            <button class="button" size="mini" style="background:rgb(238, 88, 28);" wx:if="{{item.state == '待比赛'}}">{{item.state}}</button>
-            <button class="button" size="mini" style="background:rgb(54, 233, 48)" wx:if="{{item.state == '报名中'}}">{{item.state}}</button>
-            <button class="button" size="mini" style="background:rgb(136, 136, 136);" wx:if="{{item.state == '已结束'}}">{{item.state}}</button>
+          <view class="name">{{list.name}}</view>
+          <view class="listbut"> <button class="button" size="mini" style="background:rgb(238, 147, 28);" wx:if="{{list.status == '进行中'}}">{{list.status}}</button>
+            <button class="button" size="mini" style="background:rgb(238, 88, 28);" wx:if="{{list.status == '待比赛'}}">{{list.status}}</button>
+            <button class="button" size="mini" style="background:rgb(54, 233, 48)" wx:if="{{list.status == '报名中'}}">{{list.status}}</button>
+            <button class="button" size="mini" style="background:rgb(136, 136, 136);" wx:if="{{list.status == '已结束'}}">{{list.status}}</button>
           </view>
         </view>
         <view class="left1">
           <view class="otherInfos">
-            <text class="text1">{{item.datestart}}</text>
-            -
-            <text class="text1">{{item.dateend}}</text>
+            <!-- <text class="text1">{{list.datestart}}</text> -->
+            <text class="text1">{{list.match_time}}</text>
           </view>
-          <view class="otherInfoq"><text class="text3">{{item.address}}</text></view>
-          <view class="otherInfo"><text class="text3">{{item.match}}</text></view>
+          <view class="otherInfoq"><text class="text3">{{list.address}}</text></view>
+          <view class="otherInfo"><text class="text3">{{list.format[0].type}}{{list.format[0].name}}</text></view>
         </view>
         <view class="right1" wx:if="{{item.listbisai}}" wx:for="{{item.listbisai}}" wx:for-item="items" wx:key="key">
           <view class="right1_1">
@@ -56,42 +55,38 @@
             <view class="thr-1" wx:key="item" wx:for="{{lists}}">
               <view class="thr1">
                 <view class="thr-left">
-                  <image class="img" src="{{item.head}}"></image>
+                  <image class="img" src="{{item.logo}}"></image>
                 </view>
-                <view class="thr-right textOver"><text class="thrname">{{item.name}}</text> </view>
-                <view><text class="thrperson">{{item.person}}人</text> </view>
+                <view class="thr-right textOver"><text class="thrname">{{item.team_name}}</text> </view>
+                <view><text class="thrperson">{{item.match_num}}人</text> </view>
               </view>
             </view>
           </view>
         </van-tab>
         <van-tab title="赛程列表">
-          <view class="root">
+          <view class="root" wx:if="{{status=='未开始'}}" wx:key="item" wx:for="{{listbisai}}">
             <image class='background-image' src='/image/huang.png'></image>
             <view class="content">
-              <view class="four" wx:if="{{listbisai.length!=0}}" wx:key="item" wx:for="{{listbisai}}">
+              <view class="four">
                 <view class="four-1">
                   <view class="fourleft3">
-                    <text class="fourtext5">{{item.start}}</text>
-                    <text class="fourtext6">{{item.date}} {{item.time}}</text>
+                    <text class="fourtext5">{{item.status}}</text>
+                    <text class="fourtext6">{{item.match_time}}</text>
                   </view>
                   <view class="fourright4">
-                    <view class="fourright1_1">
-                      <text class="fourtext4-1">{{item.match}}</text>
-                      <text class="fourtext4-1">{{item.group}}</text>
-                    </view>
                     <view class="fourright1_2">
                       <view class="fourright1_2o">
-                        <image class="fourhead1" src="{{item.head1}}"></image>
+                        <image class="fourhead1" src="{{item.blue_logo}}"></image>
                       </view>
-                      <view class="fourright1_2t"><text>{{item.groupname1}}</text></view>
+                      <view class="fourright1_2t"><text>{{item.blue_name}}</text></view>
                       <view class="fourright1_2i">
-                        <text class="fourtext6-1">{{item.fraction1}}</text>
+                        <text class="fourtext6-1">{{item.blue_branch}}</text>
                         <text class="fourtext8-1">:</text>
-                        <text class="fourtext7-1">{{item.fraction2}}</text>
+                        <text class="fourtext7-1">{{item.red_branch}}</text>
                       </view>
-                      <view class="fourright1_2t"><text>{{item.groupname2}}</text></view>
+                      <view class="fourright1_2t"><text>{{item.red_name}}</text></view>
                       <view class="fourright1_2o">
-                        <image class="fourhead2" src="{{item.head2}}"></image>
+                        <image class="fourhead2" src="{{item.red_logo}}"></image>
                       </view>
                     </view>
                   </view>
@@ -99,33 +94,29 @@
               </view>
             </view>
           </view>
-          <view class="root">
+          <view class="root" wx:if="{{status=='已结束'}}" wx:key="item" wx:for="{{listbisai}}">
             <image class='background-image' src='/image/hhh.png'></image>
             <view class="content">
-              <view class="four" wx:if="{{listbisai.length!=0}}" wx:key="item" wx:for="{{listbisai}}">
+              <view class="four">
                 <view class="four-1">
                   <view class="fourleft3">
-                    <text class="fourtext5">{{item.start}}</text>
-                    <text class="fourtext6">{{item.date}} {{item.time}}</text>
+                    <text class="fourtext5">{{item.status}}</text>
+                    <text class="fourtext6">{{item.match_time}}</text>
                   </view>
                   <view class="fourright4">
-                    <view class="fourright1_1">
-                      <text class="fourtext4-1">{{item.match}}</text>
-                      <text class="fourtext4-1">{{item.group}}</text>
-                    </view>
                     <view class="fourright1_2">
                       <view class="fourright1_2o">
-                        <image class="fourhead1" src="{{item.head1}}"></image>
+                        <image class="fourhead1" src="{{item.blue_logo}}"></image>
                       </view>
-                      <view class="fourright1_2t"><text>{{item.groupname1}}</text></view>
+                      <view class="fourright1_2t"><text>{{item.blue_name}}</text></view>
                       <view class="fourright1_2i">
-                        <text class="fourtext6-1">{{item.fraction1}}</text>
+                        <text class="fourtext6-1">{{item.blue_branch}}</text>
                         <text class="fourtext8-1">:</text>
-                        <text class="fourtext7-1">{{item.fraction2}}</text>
+                        <text class="fourtext7-1">{{item.red_branch}}</text>
                       </view>
-                      <view class="fourright1_2t"><text>{{item.groupname2}}</text></view>
+                      <view class="fourright1_2t"><text>{{item.red_name}}</text></view>
                       <view class="fourright1_2o">
-                        <image class="fourhead2" src="{{item.head2}}"></image>
+                        <image class="fourhead2" src="{{item.red_logo}}"></image>
                       </view>
                     </view>
                   </view>
@@ -144,15 +135,15 @@
           <view class="listbang {{index < 3 ? 'select-item' : 'dis-select-item'}}" wx:key="item" wx:for="{{listbang}}">
             <view class="item sortContent" v-for="(item,index) of list" :key="index">
               <view class="pai {{index < 3 ? 'pai1' : 'pai'}}">{{index+1}}</view>
-              <image class="headtou" src="{{item.head}}"></image>
+              <image class="headtou" src="{{item.logo}}"></image>
               <view class="dui">
-                {{item.name}}
+                {{item.team_name}}
               </view>
               <view class="fen">
-                <text class="score1 {{index < 3 ? 'scorea' : 'scoreb'}}">{{item.score1}}</text>/ <text>{{item.score2}}</text>
+                <text class="score1 {{index < 3 ? 'scorea' : 'scoreb'}}">{{item.win}}</text>/ <text>{{item.shu}}</text>
               </view>
               <view class="fens">
-                <text class="score1 {{index < 3 ? 'scorea' : 'scorec'}}">{{item.score0}}</text>
+                <text class="score1 {{index < 3 ? 'scorea' : 'scorec'}}">{{item.integral}}</text>
               </view>
             </view>
           </view>

+ 150 - 16
pages/manage/index.js

@@ -7,38 +7,172 @@ Page({
    * 页面的初始数据
    */
   data: {
+    logo:'',
+    ids: '',
     frameStyle: { useTop: true, name: '团队管理', leftArrow: true, useBar: false },
     // 主体高度
     infoHeight: '',
-    list: [
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', date: '2022.01.15', person: '10',Founder:'XXX'
-      },
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队',resaon:'解散团队', time: '08:30', date: '2022.01.15', person: '10',Founder:'XXX'
-      },
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', date: '2022.01.15', person: '10',Founder:'XXX'
-      },
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', date: '2022.01.15', person: '10',Founder:'XXX'
+    list: [],
+    listbisai: [],
+    lists: [],
+  },
+  // 监听用户是否登录
+  watchLogin: function () {
+    var that = this;
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        var that = this;
+        var list = that.data.list;
+        var match_id = that.ids;
+        var match_name = list.name;
+        var match_time=list.match_time;
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
+          method: 'get',
+          data: {
+            "match_id": match_id,
+            "match_name": match_name,
+            "match_time": match_time,
+          },
+          success(res) {
+            if (res.data.errcode == 0) {
+              let datasai = res.data.data
+              console.log('datasai',datasai);
+              that.setData({
+                listbisai: datasai,
+              });
+            } else {
+              wx.showToast({
+                title: res.data.errmsg,
+                icon: 'none',
+                duration: 2000
+              })
+            }
+          }
+        })
+        //查询数据
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
+          method: 'get',
+          data: '',
+          success(res) {
+            console.log('res', res.data);
+            let datas = res.data.data
+            if (res.data.errcode == 0) {
+              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({
+                list: datas,
+              });
+            } else {
+              wx.showToast({
+                title: res.data.errmsg,
+                icon: 'none',
+                duration: 2000
+              })
+            }
+          }
+        })
+        //解散团队数据
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/dismissapply`, //接口地址
+          method: 'get',
+          data: {
+            // create_id
+            // apply_time
+            status:that.data.list.status
+          },
+          success(res) {
+            console.log('resdis', res.data);
+            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({
+                lists: datas,
+              });
+            } else {
+              wx.showToast({
+                title: res.data.errmsg,
+                icon: 'none',
+                duration: 2000
+              })
+            }
+          }
+        })
       },
-    ],
+      fail: res => {
+        return wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
   },
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })
   },
-  shen: function () {
+  shen: function (e) {
+    let id= e.currentTarget.dataset.name;
+    console.log(id);
     wx.navigateTo({
-      url: `/pages/administration/detail`,
+      url: '/pages/administration/detail?id='+id,
+    })
+  },
+  out: function (e){
+    debugger
+    let id= e.currentTarget.dataset.name;
+    wx.showModal({
+      title: '',
+      content: '是否确认解散团队',
+      success(res) {
+        if (res.confirm) {
+          wx.request({
+            url: `${app.globalData.publicUrl}/courtAdmin/api/dismissapply/`+id, //接口地址
+            method: 'get',
+            data: '',
+            success(res) {
+              if (res.data.errcode == 0) {
+                wx.showToast({ title: `解散团队成功`, icon: 'success', duration: 2000 }) //创建成功提示
+              } else {
+                wx.showToast({
+                  title: res.data.errmsg,
+                  icon: 'none',
+                  duration: 2000
+                })
+              }
+            }
+          })
+        } else if (res.cancel) {
+          console.log('用户点击取消')
+        }
+      }
     })
   },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    // 监听用户是否登录
+    this.watchLogin();
     // 计算高度
-    this.searchHeight()
+    this.searchHeight();
   },
   // 计算高度
   searchHeight: function () {

+ 32 - 17
pages/manage/index.wxml

@@ -4,35 +4,50 @@
       <van-tabs active="{{ active }}">
         <van-tab title="全部团队">
           <view>
-            <view class="list" wx:key="item" wx:for="{{list}}">
+            <view class="list" wx:key="item" wx:for="{{list}}" data-name="{{item._id}}" bindtap='shen'>
               <view class="two">
                 <view class="left">
-                  <image class="head" src="{{item.head}}"></image>
-                  <text class="group" bindtap="tiao">{{item.group}}</text>
-                  <text class="person">共{{item.person}}人</text>
-                  <view class="fou"><text>创建人:{{item.Founder}}</text></view>
-                  <view class="time"><text class="date">{{item.date}}</text><text>{{item.time}}创建</text></view>
+                  <image class="head" src="{{item.logo[0].url}}"></image>
+                  <text class="group" bindtap="tiao">{{item.name}}</text>
+                  <text class="person">共{{members.length}}人</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">
-                  <button class="button" bindtap="jump" wx:if="{{item.group}}">通过</button>
-                </view> -->
               </view>
             </view>
           </view>
         </van-tab>
-        <van-tab title="审批团队">
+        <van-tab title="参赛团队">
           <view>
-            <view class="list" wx:key="item" wx:for="{{list}}">
+            <view class="list" wx:key="item" wx:for="{{listbisai}}" data-name="{{item._id}}" bindtap='shen'>
               <view class="two">
                 <view class="left">
-                  <image class="head" src="{{item.head}}"></image>
-                  <text class="group" bindtap="tiao">{{item.group}} <text class="resaon">{{item.resaon}}</text> </text>
-                  <text class="person" wx:if="{{!item.resaon}}">共{{item.person}}人</text>
-                  <view class="fou"><text>创建人:{{item.Founder}}</text></view>
-                  <view class="time"><text class="date">{{item.date}}</text><text>{{item.time}}创建</text></view>
+                  <image class="head" src="{{item.logo[0].url}}"></image>
+                  <text class="group" bindtap="tiao">{{item.team_name}} <text class="resaon">{{item.status}}</text> </text>
+                  <text class="person" wx:if="{{!item.status}}">共{{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">
-                  <button class="{{item.resaon == '解散团队' ? 'button' : 'buttons'}}" bindtap='shen'>通过</button>
+                  <button class="{{item.status == '解散团队' ? 'button' : 'buttons'}}" data-name="{{item._id}}" bindtap='shen'>通过</button>
+                </view>
+              </view>
+            </view>
+          </view>
+        </van-tab>
+        <van-tab title="解散团队" data-name="{{item._id}}" bindtap='shen'>
+          <view>
+            <view class="list" wx:key="item" wx:for="{{lists}}">
+              <view class="two">
+                <view class="left">
+                  <image class="head" src="{{item.logo[0].url}}"></image>
+                  <text class="group" bindtap="tiao">{{item.team_name}} <text class="resaon">{{item.status}}</text> </text>
+                  <text class="person" wx:if="{{!item.status}}">共{{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">
+                  <button class="{{item.status == '解散团队' ? 'button' : 'buttons'}}" data-name="{{item._id}}" bindtap='out'>通过</button>
                 </view>
               </view>
             </view>

+ 1 - 3
pages/manage/index.wxss

@@ -3,8 +3,6 @@
   width: 100%;
 }
 .van-tabs__line {
-  margin-left: 27px !important;
-  width: 38.800003px !important;
   background-color: blue !important;
 }
 .list{
@@ -68,7 +66,7 @@
   font-size: 16px;
   line-height: 30px;
   font-weight: 500;
-  margin-left: 2%;
+  margin-left: 4%;
   margin-right: 8%;
 }
 .fou{

+ 5 - 5
pages/me/index.wxss

@@ -129,7 +129,7 @@
   top: -2px;
   left: 7%;
   z-index: 1;
-  width: 100%;
+  width: 91%;
 }
 
 .text5 {
@@ -214,13 +214,13 @@
 .right4 {
   border-radius: 5px;
   position: relative;
-  width: 100%;
+  width: 80%;
   height: 80px;
 }
 
 .right1_2 {
   float: left;
-  width: 100%;
+  width: 118%;
   margin-top: 3px;
 }
 
@@ -250,7 +250,7 @@
 
 .right1_2 .right1_2t {
   float: left;
-  width: 25%;
+  width: 30%;
   text-align: center;
   padding: 10px 0;
 }
@@ -261,7 +261,7 @@
 
 .right1_2 .right1_2i {
   float: left;
-  width: 10%;
+  width: 16%;
   text-align: center;
   padding: 6px 0;
 }

+ 59 - 16
pages/search/index.js

@@ -8,25 +8,17 @@ Page({
    */
   data: {
     src: '/image/home.png',
-    frameStyle: { useTop: true, name: '查询比赛', leftArrow: false, useBar: true},
+    frameStyle: { useTop: true, name: '查询比赛', leftArrow: false, useBar: true },
     // 主体高度
     infoHeight: '',
-    list: [
-      {
-        id: '1', name: '朝阳区乒乓球比赛', head2: '/image/head2.png', head1: '/image/head1.png',fraction2: '0', groupname2: '马尼拉组', group: '第一组', fraction1: '0', site: '第一场', groupname1: '哈拉海组', match: '循环赛', week: '星期五', time: '13:00',
-        state: '待比赛', date: '2022.01.15', address: '吉林省长春市远创国际A座'
-      }
-    ],
-    listend: [
-      {
-        id: '1', name: '朝阳区乒乓球比赛', head2: '/image/head2.png', head1: '/image/head1.png',fraction2: '0', groupname2: '马尼拉组', group: '第一组', fraction1: '0', site: '第一场', groupname1: '哈拉海组', match: '循环赛', week: '星期五', time: '13:00',
-        state: '已结束', date: '2022.01.15', address: '吉林省长春市远创国际A座'
-      }
-    ],
+    list: [],
+    listend: [],
   },
-  tiao: function () {
+  tiao: function (e) {
+    let id = e.currentTarget.dataset.name;
+    console.log(id);
     wx.navigateTo({
-      url: '/pages/list/index',
+      url: '/pages/list/index?id=' + id,
     })
   },
   //标签页
@@ -38,12 +30,63 @@ Page({
     let query = e.detail.detail;
     if (query) wx.redirectTo({ url: `/pages/${query}/index` })
   },
+  // 监听用户是否登录
+  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) {
+            console.log('res', res.data);
+            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])
+                }
+              }
+              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', })
+      }
+    })
+  },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
     // 计算高度
-    this.searchHeight()
+    this.searchHeight();
+    // 监听用户是否登录
+    this.watchLogin();
   },
   // 计算高度
   searchHeight: function () {

+ 6 - 14
pages/search/index.wxml

@@ -5,18 +5,12 @@
         <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 style="margin-left: 10px;margin-top: 2%;">
-                <text class="text1">{{item.date}}</text>
-                <text class="text1">{{item.week}}</text>
-              </view> -->
               <view class="list1">
-                <view class="names" bindtap="tiao">{{item.name}}</view>
-                <button class="button" size="mini">{{item.state}}</button>
+                <view class="names" data-name="{{item._id}}" bindtap="tiao">{{item.name}}</view>
+                <button class="button" size="mini">{{item.status}}</button>
                 <view class="leftmueen">
                   <view class="otherInfos">
-                    <text class="text9">{{item.date}}</text>
-                    <text class="text10">{{item.week}}</text>
-                    <text class="text10">{{item.time}}</text>
+                    <text class="text9">{{item.single_time}}</text>
                   </view>
                   <view class="otherInfo textOver"><text class="text3">{{item.address}}</text></view>
                 </view>
@@ -26,13 +20,11 @@
           <van-tab title="历史比赛" name="b" style="font-weight: 500;">
             <view class="beijing1" wx:key="item" wx:for="{{listend}}">
               <view class="list1">
-                <view class="names" bindtap="tiao">{{item.name}}</view>
-                <button class="buttonend" size="mini">{{item.state}}</button>
+                <view class="names" data-name="{{item._id}}" bindtap="tiao">{{item.name}}</view>
+                <button class="buttonend" size="mini">{{item.status}}</button>
                 <view class="leftmueen">
                   <view class="otherInfos">
-                    <text class="text9">{{item.date}}</text>
-                    <text class="text10">{{item.week}}</text>
-                    <text class="text10">{{item.time}}</text>
+                    <text class="text9">{{item.single_time}}</text>
                   </view>
                   <view class="otherInfo"><text class="text3">{{item.address}}</text></view>
                 </view>

+ 3 - 0
pages/search/index.wxss

@@ -22,6 +22,9 @@
   background-color: white;
   padding-top: 5px;
 }
+.beijing1{
+  margin-bottom: 1.5%;
+}
 
 .two {
   float: left;

+ 38 - 30
pages/team/apply.js

@@ -7,43 +7,48 @@ Page({
    * 页面的初始数据
    */
   data: {
+    ids: '',
     src: '/image/adimges.jpg',
     src1: '/image/head1.png',
     frameStyle: { useTop: false, name: '团队审核', leftArrow: true, useBar: false },
     // 主体高度
     infoHeight: '',
-    list: [
-      {
-        id: '1', time: '08:30', date: '2022.01.15', Founder: 'XXX', group: '哈拉海队', person: '10', grade: 'c'
-      }
-    ],
-    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'
+    list: [],
+    lists: [],
+  },
+  // 监听用户是否登录
+  watchLogin: function () {
+    var that = this;
+    let id = that.ids
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        //查询数据
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id, //接口地址
+          method: 'get',
+          data: '',
+          success(res) {
+            if (res.data.errcode == 0) {
+              let datas = res.data.data
+              console.log('单',datas);
+              that.setData({
+                list: datas,
+              });
+            } else {
+              wx.showToast({
+                title: res.data.errmsg,
+                icon: 'none',
+                duration: 2000
+              })
+            }
+          }
+        })
       },
-
-      {
-        id: '1', name: '老头8', head: '/image/tou.png'
+      fail: res => {
+        return wx.redirectTo({ url: '/pages/login/index', })
       }
-    ],
+    })
   },
   tabPath(e) {
     let query = e.detail.detail;
@@ -76,6 +81,9 @@ Page({
   onLoad: function (options) {
     // 计算高度
     this.searchHeight()
+    this.ids = options.id;
+    // 监听用户是否登录
+    this.watchLogin();
   },
   // 计算高度
   searchHeight: function () {

+ 10 - 24
pages/team/apply.wxml

@@ -10,22 +10,22 @@
         </view>
         <image style="width: 100%; height: 280px; background-color: #eeeeee;" src="{{src}}"></image>
       </view>
-      <view class="one-2" wx:key="item" wx:for="{{list}}">
-        <image class="imgs" src="{{src1}}"></image>
+      <view class="one-2">
+        <image class="imgs" src="{{list.logo[0].url}}"></image>
       </view>
     </view>
-    <view class="one-3" wx:key="item" wx:for="{{list}}">
-      <view class="group">{{item.group}}<text class=" icon iconfont icon-C1" wx:if="{{item.grade}}"></text></view>
-      <view class="person">共{{item.person}}人</view>
+    <view class="one-3">
+      <view class="group">{{list.name}}<text class=" icon iconfont icon-C1" wx:if="{{list.type}}"></text></view>
+      <view class="person">共{{members.length}}人</view>
     </view>
-    <view class="two" wx:key="item" wx:for="{{list}}">
+    <view class="two">
       <view class="two-1">
         <view class="two1">
           <view class="two-left1">
             <text class=" icon iconfont icon-dian"></text>
           </view>
           <view class="two-right1">
-            <view><text class="zi">创建人:</text>{{item.Founder}}</view>
+            <view><text class="zi">创建人:</text>{{list.create_user}}</view>
           </view>
         </view>
         <view class="two2">
@@ -33,35 +33,21 @@
             <text class=" icon iconfont icon-dian"></text>
           </view>
           <view class="two-right2">
-            <view><text class="zi">创建时间:</text><text class="date">{{item.date}}</text>{{item.time}}</view>
+            <view><text class="zi">创建时间:</text><text class="date">{{list.create_time}}</text></view>
           </view>
         </view>
       </view>
     </view>
     <view class="thr">
       <view><text class="tuan">队员信息</text></view>
-      <view class="thr-1" wx:key="item" wx:for="{{lists}}">
+      <view class="thr-1" wx:key="item" wx:for="{{list.members}}">
         <view class="thr1">
           <view class="thr-left">
-            <image class="img" src="{{item.head}}"></image>
+            <image class="img" src="{{list.logo[0].url}}"></image>
           </view>
           <view class="thr-right"><text class="name">{{item.name}}</text> </view>
         </view>
       </view>
-      <!-- <view class="thr-2">
-        <view class="thr2">
-          <view class="thr3">
-            <text class=" icon iconfont icon-jian-"></text>
-          </view>
-        </view>
-      </view>
-      <view class="thr-2">
-        <view class="thr2">
-          <view class="thr3">
-            <text class=" icon iconfont icon-jia"></text>
-          </view>
-        </view>
-      </view> -->
     </view>
     <view class="four">
       <button class="button" form-type="submit">待通过</button>

+ 51 - 16
pages/team/index.js

@@ -11,20 +11,7 @@ Page({
     frameStyle: { useTop: true, name: '我的团队', leftArrow: false, useBar: true },
     // 主体高度
     infoHeight: '',
-    list: [
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', date: '2022.01.15', person: '10',Founder:'XXX'
-      },
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', date: '2022.01.15', person: '10',Founder:'XXX'
-      },
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', date: '2022.01.15', person: '10',Founder:'XXX'
-      },
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', date: '2022.01.15', person: '10',Founder:'XXX'
-      },
-    ],
+    list: [],
   },
   tabPath(e) {
     let query = e.detail.detail;
@@ -35,9 +22,55 @@ Page({
       url: '/pages/team/examine',
     })
   },
-  jump: function () {
+  jump: function (e) {
+    let id= e.currentTarget.dataset.name;
+    console.log(id);
     wx.navigateTo({
-      url: '/pages/team/apply',
+      url: '/pages/team/apply?id='+id,
+    })
+  },
+  // 监听用户是否登录
+  watchLogin: function () {
+    var that = this;
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        //查询数据
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
+          method: 'get',
+          data: '',
+          success(res) {
+            console.log('res', res.data);
+            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({
+                list: datas,
+              });
+            } else {
+              wx.showToast({
+                title: res.data.errmsg,
+                icon: 'none',
+                duration: 2000
+              })
+            }
+          }
+        })
+      },
+      fail: res => {
+        return wx.redirectTo({ url: '/pages/login/index', })
+      }
     })
   },
   /**
@@ -46,6 +79,8 @@ Page({
   onLoad: function (options) {
     // 计算高度
     this.searchHeight()
+    // 监听用户是否登录
+    this.watchLogin();
   },
   // 计算高度
   searchHeight: function () {

+ 6 - 6
pages/team/index.wxml

@@ -16,14 +16,14 @@
     <view class="list" wx:key="item" wx:for="{{list}}">
       <view class="two">
         <view class="left">
-          <image class="head" src="{{item.head}}"></image>
-          <text class="group" bindtap="tiao" >{{item.group}}</text>
-          <text class="person">共{{item.person}}人</text>
-          <view class="fou"><text>创建人:{{item.Founder}}</text></view>
-          <view class="time"><text class="date">{{item.date}}</text><text>{{item.time}}创建</text></view>
+          <image class="head" src="{{item.logo}}"></image>
+          <text class="group" bindtap="tiao" >{{item.name}}</text>
+          <text class="person">共{{members.length}}人</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">
-          <button class="button" form-type="submit" bindtap="jump" >加入</button>
+          <button class="button" form-type="submit" bindtap="jump" data-name="{{item._id}}" >加入</button>
         </view>
       </view>
     </view>