Ver Fonte

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

YY há 3 anos atrás
pai
commit
5f28bde997

+ 66 - 0
pages/add/index.js

@@ -20,6 +20,52 @@ Page({
       apply_id: '1',// 申请人id
     },
   },
+  // 申请加入
+  onSubmit: function (e) {
+    let form = this.data.form;
+    var team_id = form.team_id;
+    var team_name = form.team_name;
+    var apply_time = form.apply_time + ' ' + this.data.time;
+    var apply_user = form.apply_user;
+    var apply_id = form.apply_id;
+    const params = {
+      "team_id": team_id,
+      "team_name": team_name,
+      "apply_time": apply_time,
+      "apply_user": apply_user,
+      "apply_id": apply_id,
+    };
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply`, //接口地址
+      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/team/apply?id=' + team_id })// 跳转页面
+        } 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', })
+      }
+    })
+  },
   bindDateChange3: function (e) {
     console.log('picker发送选择改变,携带值为', e.detail.value)
     this.setData({
@@ -49,12 +95,32 @@ Page({
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })
   },
+  backup: function () {
+    let form = this.data.form;
+    var team_id = form.team_id;
+    wx.navigateTo({ url: '/pages/team/apply?id=' + team_id })// 跳转页面
+  },
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    // 监听用户是否登录
+    this.watchLogin();
     // 计算高度
     this.searchHeight()
+    
+    var myObject = JSON.parse(decodeURIComponent(options.obj));
+    let forms = {
+      team_id: myObject.id,
+      team_name: myObject.name,
+      apply_time: '2022-03-22',
+      apply_user: myObject.user,
+      apply_id: '1'
+      // apply_id: myObject.cid
+    }
+    this.setData({
+      form: forms
+    });
   },
   // 计算高度
   searchHeight: function () {

+ 3 - 3
pages/add/index.wxml

@@ -32,7 +32,7 @@
           </view>
           <view class="one_list">
             <view class="text">申请人id</view>
-            <view class="text">{{form.team_name}}</view>
+            <view class="text">{{form.apply_id}}</view>
           </view>
         </view>
       </form>
@@ -40,10 +40,10 @@
     <view class="four">
       <view class="four-1">
         <view class="four1">
-          <button class="button" form-type="submit">返回</button>
+          <button class="button" bindtap="backup">返回</button>
         </view>
         <view class="four2">
-          <button class="buttons" form-type="submit">确认</button>
+          <button class="buttons" bindtap="onSubmit" >确认</button>
         </view>
       </view>
     </view>

+ 2 - 2
pages/manage/index.wxml

@@ -9,7 +9,7 @@
                 <view class="left">
                   <image class="head" src="{{item.logo[0].url}}"></image>
                   <text class="group" bindtap="tiao">{{item.name}}</text>
-                  <text class="person">共{{item.menber.length||0}}人</text>
+                  <text class="person">共{{item.members.length||0}}人</text>
                   <view class="fou"><text>创建人:{{item.create_user}}</text></view>
                   <view class="time"><text class="date">{{item.create_time}}创建</text></view>
                 </view>
@@ -42,7 +42,7 @@
                 <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.menber.length||0}}人</text>
+                  <text class="person" wx:if="{{!item.status}}">共{{item.members.length||0}}人</text>
                   <view class="fou"><text>创建人:{{item.create_user}}</text></view>
                   <view class="time"><text class="date">{{item.create_time}}创建</text></view>
                 </view>

+ 12 - 21
pages/match/detail.js

@@ -76,27 +76,18 @@ Page({
     ],
   },
   //上传图片
-  afterRead: function (event) {
-    const { file } = event.detail;
-    // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式app.globalData.fileUrl:
-    console.log(file);
-    wx.uploadFile({
-      url: `${app.globalData.imageUrl}/files/court/elimg/upload`,
-      filePath: file.url,
-      name: 'file',
-      formData: {},
-      success: (res) => {
-        console.log(res);
-        if (res.statusCode == '200') {
-          let data = [{ name: JSON.parse(res.data).name, url: `${app.globalData.imageUrl}` + JSON.parse(res.data).uri }]
-          const { fileList = [] } = this.data;
-          fileList.push({ ...file, url: res.data });
-          this.setData({ fileList });
-        } else {
-          wx.showToast({ title: `${res.data.errmsg}`, icon: 'fail', duration: 2000 })
-        }
-      },
-    });
+  imgUpload:function(e){
+    const that = this;
+    let data = that.data.fileList;
+    data.push(e.detail)
+    that.setData({fileList:data})
+  },
+  //删除图片
+  imgDel:function(e){
+    const that = this;
+    let data = that.data.fileList;
+    let arr = data.filter((i,index) => index != e.detail.index)
+    that.setData({fileList:arr})
   },
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })

+ 3 - 2
pages/match/detail.json

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

+ 1 - 1
pages/match/detail.wxml

@@ -70,7 +70,7 @@
     </view>
     <view class="upload">
       <view class="upload_1">
-        <van-uploader file-list="{{fileList}}" preview-image="true" max-count="4" bind:after-read="afterRead" />
+        <upload list="{{fileList}}" count="{{4}}"  bind:imgUpload="imgUpload" bind:imgDel="imgDel"></upload>
       </view>
     </view>
     <view class="five">

+ 46 - 5
pages/team/apply.js

@@ -1,12 +1,14 @@
 // pages/login/login.js
 import WxValidate from '../../utils/wxValidate'
 const app = getApp()
+const moment = require("../../utils/moment.min")
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
+    apply_time:'',
     ids: '',
     src: '/image/adimges.jpg',
     src1: '/image/head1.png',
@@ -31,7 +33,7 @@ Page({
           success(res) {
             if (res.data.errcode == 0) {
               let datas = res.data.data
-              console.log('单',datas);
+              console.log('单', datas);
               that.setData({
                 list: datas,
               });
@@ -54,9 +56,44 @@ Page({
     let query = e.detail.detail;
     if (query) wx.redirectTo({ url: `/pages/${query}/index` })
   },
-  add: function () {
-    wx.navigateTo({
-      url: '/pages/add/index',
+  add: function (e) {
+    let obj = e.currentTarget.dataset;
+    let forms = {
+      team_id: obj.id,
+      team_name: obj.name,
+      apply_time: this.data.apply_time,
+      apply_user: obj.user,
+      apply_id: '1'
+      // apply_id: obj.cid
+    }
+    // wx.navigateTo({
+    //   url: '/pages/add/index?obj=' + decodeURIComponent(JSON.stringify(obj)),
+    // })
+    wx.showModal({
+      title: '',
+      content: '是否申请加入',
+      success(res) {
+        if (res.confirm) {
+          wx.request({
+            url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply`, //接口地址
+            method: 'post',
+            data: forms,
+            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('用户点击取消')
+        }
+      }
     })
   },
   back: function () {
@@ -68,7 +105,7 @@ Page({
       content: '是否确认退出团队',
       success(res) {
         if (res.confirm) {
-          console.log('用户点击确定')
+
         } else if (res.cancel) {
           console.log('用户点击取消')
         }
@@ -79,6 +116,10 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    let apply_time = moment().format('YYYY-MM-DD HH:mm:ss');
+    this.setData({
+      apply_time: apply_time,
+    });
     // 计算高度
     this.searchHeight()
     this.ids = options.id;

+ 4 - 4
pages/team/apply.wxml

@@ -16,7 +16,7 @@
     </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">共{{item.menber.length||0}}人</view>
+      <view class="person">共{{item.members.length||0}}人</view>
     </view>
     <view class="two">
       <view class="two-1">
@@ -50,9 +50,9 @@
       </view>
     </view>
     <view class="four">
-      <button class="button" form-type="submit">待通过</button>
-      <button class="button" form-type="submit" bindtap='add'>申请加入</button>
-      <button class="button" form-type="submit" bindtap='out'>退出团队</button>
+      <button class="button" data-id="{{list._id}}" data-name="{{list.name}}" data-cid="{{list.create_id}}" data-user="{{list.create_user}}" bindtap='add' >待通过</button>
+      <button class="button" data-id="{{list._id}}" data-name="{{list.name}}" data-cid="{{list.create_id}}" data-user="{{list.create_user}}" bindtap='add'>申请加入</button>
+      <button class="button" bindtap='out'>退出团队</button>
     </view>
   </view>
 </mobile-main>

+ 79 - 13
pages/team/examine.js

@@ -7,6 +7,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    ids: '',
     src: '/image/adimges.jpg',
     src1: '/image/head1.png',
     frameStyle: { useTop: false, name: '团队详情', leftArrow: true, useBar: false },
@@ -14,51 +15,113 @@ Page({
     infoHeight: '',
     list: [
       {
-        id: '1',time: '08:30', date: '2022.01.15',Founder:'XXX',group:'哈拉海队',person:'10'
+        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'
+        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: '老头1', head: '/image/tou.png'
       },
       {
-        id: '1',name:'老头2',head:'/image/tou.png'
+        id: '1', name: '老头2', head: '/image/tou.png'
       },
       {
-        id: '1',name:'老头3',head:'/image/tou.png'
+        id: '1', name: '老头3', head: '/image/tou.png'
       },
       {
-        id: '1',name:'老头4',head:'/image/tou.png'
+        id: '1', name: '老头4', head: '/image/tou.png'
       },
       {
-        id: '1',name:'老头5',head:'/image/tou.png'
+        id: '1', name: '老头5', head: '/image/tou.png'
       },
       {
-        id: '1',name:'老头6',head:'/image/tou.png'
+        id: '1', name: '老头6', head: '/image/tou.png'
       },
       {
-        id: '1',name:'老头7',head:'/image/tou.png'
+        id: '1', name: '老头7', head: '/image/tou.png'
       },
 
       {
-        id: '1',name:'老头8',head:'/image/tou.png'
+        id: '1', name: '老头8', head: '/image/tou.png'
       },
       {
-        id: '1',name:'老头9',head:'/image/tou.png'
+        id: '1', name: '老头9', head: '/image/tou.png'
       },
     ],
   },
+  // 监听用户是否登录
+  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
+              })
+            }
+          }
+        })
+        //参赛历史
+        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,
+          },
+          success(res) {
+            if (res.data.errcode == 0) {
+              let datas = res.data.data
+              console.log('团队详情', datas);
+              that.setData({
+                listend: 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' })
   },
@@ -68,6 +131,9 @@ Page({
   onLoad: function (options) {
     // 计算高度
     this.searchHeight()
+    this.ids = options.id;
+    // 监听用户是否登录
+    this.watchLogin();
   },
   // 计算高度
   searchHeight: function () {

+ 14 - 14
pages/team/examine.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 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">共{{item.members.length||0}}人</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="{{list.logo[0].url}}"></image>
           </view>
           <view class="thr-right"><text class="name">{{item.name}}</text> </view>
         </view>
@@ -63,13 +63,13 @@
       <view class="list" wx:key="item" wx:for="{{listend}}">
         <view class="four2">
           <view class="left">
-            <view class="names">{{item.name}}</view>
-            <button class="buttonend" size="mini">{{item.state}}</button>
+            <view class="names">{{item.match_name}}</view>
+            <button class="buttonend" size="mini">{{item.status}}</button>
             <view class="otherInfos">
-              <text class="text1">{{item.mark}}</text>
+              <text class="text1">团队获得第{{item.rank}}名</text>
             </view>
           </view>
-          <view class="num"><text class="text3">{{item.num}}</text></view>
+          <view class="num"><text class="text3">{{item.integral}}</text></view>
         </view>
       </view>
     </view>

+ 7 - 3
pages/team/index.js

@@ -7,6 +7,7 @@ Page({
    * 页面的初始数据
    */
   data: {
+    status:'',
     src: '/image/team.png',
     frameStyle: { useTop: true, name: '我的团队', leftArrow: false, useBar: true },
     // 主体高度
@@ -17,14 +18,14 @@ Page({
     let query = e.detail.detail;
     if (query) wx.redirectTo({ url: `/pages/${query}/index` })
   },
-  tiao: function () {
+  tiao: function (e) {
+    let id= e.currentTarget.dataset.name;
     wx.navigateTo({
-      url: '/pages/team/examine',
+      url: '/pages/team/examine?id='+id,
     })
   },
   jump: function (e) {
     let id= e.currentTarget.dataset.name;
-    console.log(id);
     wx.navigateTo({
       url: '/pages/team/apply?id='+id,
     })
@@ -35,6 +36,9 @@ Page({
     wx.getStorage({
       key: 'token',
       success: res => {
+        this.setData({
+          status: res.data.status,
+        })
         //查询数据
         wx.request({
           url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址

+ 4 - 3
pages/team/index.wxml

@@ -17,13 +17,14 @@
       <view class="two">
         <view class="left">
           <image class="head" src="{{item.logo}}"></image>
-          <text class="group" bindtap="tiao" >{{item.name}}</text>
-          <text class="person">共{{item.menber.length||0}}人</text>
+          <text class="group">{{item.name}}</text>
+          <text class="person">共{{item.members.length||0}}人</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" data-name="{{item._id}}" >加入</button>
+          <button class="button" wx:if="{{status== 2}}" form-type="submit" bindtap="jump" data-name="{{item._id}}" >加入</button>
+          <button class="button"  wx:if="{{status!= 2}}" bindtap="tiao" data-name="{{item._id}}">查看</button>
         </view>
       </view>
     </view>