YY 3 rokov pred
rodič
commit
4a3a63ec4a

+ 25 - 30
pages/createTeam/index.js

@@ -172,36 +172,31 @@ Page({
             value.logo = this.data.fileList;
             value.members = this.data.members;
             value.create_id = this.data.form.create_id;
-            wx.getStorage({
-                key: 'token',
-                success: function (res) {
-                    wx.request({
-                        url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
-                        method: "post",//请求方法
-                        //请求参数
-                        data: value,
-                        header: {},
-                        success: res => {
-                            console.log(res);
-                            if (res.data.errcode == 0) {
-                                wx.showToast({
-                                    title: '创建团队成功',
-                                    icon: 'success',
-                                    duration: 2000//延迟两秒
-                                })
-                                return wx.redirectTo({ url: '/pages/me/index' })// 跳转页面
-                            } else {
-                                wx.showToast({
-                                    title: '创建团队失败',
-                                    icon: 'error',
-                                    duration: 2000
-                                })
-                            }
-                        },
-                        error: err => {
-                            console.log(err);
-                        }
-                    })
+            wx.request({
+                url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
+                method: "post",//请求方法
+                //请求参数
+                data: value,
+                header: {},
+                success: res => {
+                    console.log(res);
+                    if (res.data.errcode == 0) {
+                        wx.showToast({
+                            title: '创建团队成功',
+                            icon: 'success',
+                            duration: 2000//延迟两秒
+                        })
+                        return wx.redirectTo({ url: '/pages/me/index' })// 跳转页面
+                    } else {
+                        wx.showToast({
+                            title: '创建团队失败',
+                            icon: 'error',
+                            duration: 2000
+                        })
+                    }
+                },
+                error: err => {
+                    console.log(err);
                 }
             })
         }

+ 33 - 37
pages/information/index.js

@@ -40,6 +40,38 @@ Page({
     back: function () {
         wx.navigateBack({ url: '/pages/me/index' })
     },
+    //提交
+    formSubmit: function (e) {
+        const value = e.detail.value;
+        if (!this.WxValidate.checkForm(value)) {
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
+        } else {
+            value.icon = this.data.fileList;
+            wx.request({
+                url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
+                method: "post",
+                data: value,
+                header: {},
+                success: res => {
+                    if (res.data.errcode == 0) {
+                        wx.showToast({
+                            title: '保存成功',
+                            icon: 'success',
+                            duration: 2000//延迟两秒
+                        })
+                    } else {
+                        wx.showToast({
+                            title: '保存失败',
+                            icon: 'success',
+                            duration: 2000
+                        })
+                    }
+                },
+            })
+        }
+    },
 
     /**
      * 生命周期函数--监听页面加载
@@ -87,43 +119,7 @@ Page({
             }
         })
     },
-    //提交
-    formSubmit: function (e) {
-        const value = e.detail.value;
-        if (!this.WxValidate.checkForm(value)) {
-            const error = this.WxValidate.errorList[0];
-            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
-            return false
-        } else {
-            value.icon = this.data.fileList;
-            wx.getStorage({
-                key: 'token',
-                success: function (res) {
-                    wx.request({
-                        url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
-                        method: "post",
-                        data: value,
-                        header: {},
-                        success: res => {
-                            if (res.data.errcode == 0) {
-                                wx.showToast({
-                                    title: '保存成功',
-                                    icon: 'success',
-                                    duration: 2000//延迟两秒
-                                })
-                            } else {
-                                wx.showToast({
-                                    title: '保存失败',
-                                    icon: 'success',
-                                    duration: 2000
-                                })
-                            }
-                        },
-                    })
-                }
-            })
-        }
-    },
+
     // 计算高度
     searchHeight: function () {
         let frameStyle = this.data.frameStyle;

+ 35 - 40
pages/layNew/index.js

@@ -101,7 +101,7 @@ Page({
         // 监听用户是否登录
         this.watchLogin();
         //验证规则函数
-        // this.initValidate();
+        this.initValidate();
     },
     // 监听用户是否登录
     watchLogin: function () {
@@ -136,17 +136,16 @@ Page({
         })
     },
     //验证必填项
-    //  initValidate() {
-    //     const rules = { phone: { required: true}, }
-    //     // 验证字段的提示信息,若不传则调用默认的信息
-    //     const messages = { phone: { required: '请输入手机号' }, };
-    //     this.WxValidate = new WxValidate(rules, messages)
-    // },
+    initValidate() {
+        const rules = { match_name: { required: true }, }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { match_name: { required: '请输入比赛名称' }, };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
     //提交
     formSubmit: function (e) {
         var match_time = this.data.date + '  ' + this.data.time;
         const value = e.detail.value;
-        // console.log(value);
         value.match_id = this.data.id;
         value.red_id = this.data.red._id;
         value.red_name = this.data.red.team_name;
@@ -158,38 +157,34 @@ Page({
         value.blue_members = this.data.blue.members;
         value.match_time = match_time;
         console.log(value);
-        // if (!this.WxValidate.checkForm(value)) {
-        //     const error = this.WxValidate.errorList[0];
-        //     wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
-        //     return false
-        // } else {
-        wx.getStorage({
-            key: 'token',
-            success: function (res) {
-                wx.request({
-                    url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`, //接口地址
-                    method: "post",
-                    data: value,
-                    header: {},
-                    success: res => {
-                        if (res.data.errcode == 0) {
-                            wx.showToast({
-                                title: '保存成功',
-                                icon: 'success',
-                                duration: 2000//延迟两秒
-                            })
-                        } else {
-                            wx.showToast({
-                                title: '保存失败',
-                                icon: 'success',
-                                duration: 2000
-                            })
-                        }
-                    },
-                })
-            }
-        })
-        // }
+        if (!this.WxValidate.checkForm(value)) {
+            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/schedule`, //接口地址
+                method: "post",
+                data: value,
+                header: {},
+                success: res => {
+                    console.log(res);
+                    if (res.data.errcode == 0) {
+                        wx.showToast({
+                            title: '保存成功',
+                            icon: 'success',
+                            duration: 2000//延迟两秒
+                        })
+                    } else {
+                        wx.showToast({
+                            title: '保存失败',
+                            icon: 'success',
+                            duration: 2000
+                        })
+                    }
+                },
+            })
+        }
     },
     // 计算高度
     searchHeight: function () {

+ 6 - 7
pages/me/index.js

@@ -61,12 +61,9 @@ Page({
   },
   //团队创建人-团队详情
   ToDetails: function (e) {
-    // let id = e.currentTarget.dataset.id;
-    // console.log(e.currentTarget.dataset.id);
-    // wx.navigateTo({
-    //   url: `/pages/teamDetails/detail?id=` + id,
-    // })
-     wx.navigateTo({
+    let id = e.currentTarget.dataset.id;
+    console.log(e.currentTarget.dataset.id);
+    wx.navigateTo({
       url: `/pages/teamDetails/detail?id=` + id,
     })
   },
@@ -94,7 +91,6 @@ Page({
       url: `/pages/meMatch/detail`,
     })
   },
-
   //已上传图片
   Uploaded: function () {
     wx.navigateTo({
@@ -145,6 +141,7 @@ Page({
       key: 'token',
       success: res => {
         //数据请求
+        //用户详情
         wx.request({
           url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
           method: "get",//请求方法
@@ -162,6 +159,7 @@ Page({
             console.log(err);
           }
         })
+        //团队管理员-团队列表
         wx.request({
           url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
           method: "get",//请求方法
@@ -176,6 +174,7 @@ Page({
             console.log(err);
           }
         })
+        //个人用户-所在团队列表
         wx.request({
           url: `${app.globalData.publicUrl}/courtAdmin/api/team/userteams`, //接口地址
           method: "get",//请求方法

+ 1 - 13
pages/me/index.wxml

@@ -1,7 +1,6 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:tabPath="tabPath">
   <view slot="info" class="main" style="height:{{infoHeight}}px;">
     <view class="one">
-      <!-- <text class="theme">我的</text> -->
       <image src="{{src}}" class="images"></image>
     </view>
     <view class="two">
@@ -88,9 +87,7 @@
           <view class="otherInfo_1">
             <text class="tuan">我的团队</text>
             <text class="total">共参加{{list3.length||0}}个队伍</text>
-            <text class="chuang" bindtap="create" wx:if="{{list3.length<2&&item1.type=='1'}}">创建团队</text>
-            <text class="chuang" bindtap="create" wx:if="{{list3.length<1&&item1.type=='1'}}">创建团队</text>
-            <!-- <text class="chuang" bindtap="create">创建团队</text> -->
+            <text class="chuang" bindtap="create" wx:if="{{list3.length<1}}">创建团队</text>
           </view>
         </view>
         <view class="weui-cells mgt-0 {{!showMore? 'hiddenmore' : 'showmore'}}">
@@ -127,7 +124,6 @@
         <view class="otherInfo">
           <text class="tuan">我的团队</text>
           <text class="total1">暂无加入任何团队</text>
-          <!-- <text class="chuang">创建团队</text> -->
         </view>
         <view class="jian">
           <view class="viewjian"><text class="jiantext">该账号无法加入或创建团队</text></view>
@@ -230,14 +226,6 @@
           <text class="six-text">比赛管理</text>
         </view>
       </view>
-      <!-- <view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view>
-      <view class="modalDlg" wx:if="{{showModal}}">
-        <text class="modal_text1">解散团队</text>
-        <text class="modal_text2">{{list3[0].name}}</text>
-        <text class="modal_text3">解散的团队不可恢复</text>
-        <button bindtap="apply" data-id="{{list3[0]._id}}" class="modal_button">解散申请</button>
-        <text bindtap="go" class="modal_text4">取消</text>
-      </view> -->
     </view>
   </view>
 </mobile-main>

+ 3 - 12
pages/meMatch/index.js

@@ -97,10 +97,11 @@ Page({
   // 监听用户是否登录
   watchLogin: function () {
     var that = this;
-    //待申请-报名中的比赛
+    let team_id = this.data.list1._id;
     wx.getStorage({
       key: 'token',
       success: res => {
+        //待申请-报名中的比赛
         wx.request({
           url: `${app.globalData.publicUrl}/courtAdmin/api/match`, //接口地址
           method: 'get',
@@ -110,16 +111,7 @@ Page({
             that.setData({ list: res.data.data })
           }
         })
-      },
-      fail: res => {
-        return wx.redirectTo({ url: '/pages/login/index', })
-      }
-    })
-    //已申请-已报名的比赛
-    let team_id = this.data.list1._id;
-    wx.getStorage({
-      key: 'token',
-      success: res => {
+        //已申请-已报名的比赛
         wx.request({
           url: `${app.globalData.publicUrl}/courtAdmin/api/matchteam`, //接口地址
           method: 'get',
@@ -134,7 +126,6 @@ Page({
         return wx.redirectTo({ url: '/pages/login/index', })
       }
     })
-
   },
   // 计算高度
   searchHeight: function () {

+ 29 - 34
pages/password/index.js

@@ -16,42 +16,37 @@ Page({
     back: function () {
         wx.navigateBack({ url: '/pages/me/index' })
     },
-        //提交
-        formSubmit: function (e) {
-            const value = e.detail.value;
-            if (!this.WxValidate.checkForm(value)) {
-                const error = this.WxValidate.errorList[0];
-                wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
-                return false
-            } else {
-                wx.getStorage({
-                    key: 'token',
-                    success: function (res) {
-                        wx.request({
-                            url: `${app.globalData.publicUrl}/courtAdmin/api/user/updatePwd/${res.data.id}`, //接口地址
-                            method: "post",
-                            data: value,
-                            header: {},
-                            success: res => {
-                                if (res.data.errcode == 0) {
-                                    wx.showToast({
-                                        title: '保存成功',
-                                        icon: 'success',
-                                        duration: 2000//延迟两秒
-                                    })
-                                } else {
-                                    wx.showToast({
-                                        title: '保存失败',
-                                        icon: 'success',
-                                        duration: 2000
-                                    })
-                                }
-                            },
+    //提交
+    formSubmit: function (e) {
+        const value = e.detail.value;
+        if (!this.WxValidate.checkForm(value)) {
+            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/user/updatePwd/${res.data.id}`, //接口地址
+                method: "post",
+                data: value,
+                header: {},
+                success: res => {
+                    if (res.data.errcode == 0) {
+                        wx.showToast({
+                            title: '保存成功',
+                            icon: 'success',
+                            duration: 2000//延迟两秒
+                        })
+                    } else {
+                        wx.showToast({
+                            title: '保存失败',
+                            icon: 'success',
+                            duration: 2000
                         })
                     }
-                })
-            }
-        },
+                },
+            })
+        }
+    },
     /**
      * 生命周期函数--监听页面加载
      */

+ 21 - 27
pages/teamDetails/detail.js

@@ -49,35 +49,29 @@ Page({
     var that = this;
     var id = that.data.list.id;
     var list = that.data.list;
-    wx.getStorage({
-      key: 'token',
-      success: function (res) {
+    wx.request({
+      url: `${app.globalData.publicUrl}/courtAdmin/api/team/${id}`, //接口地址
+      method: "post",
+      data: list,
+      header: {},
+      success: res => {
         console.log(res);
-        wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/team/${id}`, //接口地址
-          method: "post",
-          data: list,
-          header: {},
-          success: res => {
-            console.log(res);
-            if (res.data.errcode == 0) {
-              wx.showToast({
-                title: '保存成功',
-                icon: 'success',
-                duration: 4000//延迟两秒
-              })
-              return wx.redirectTo({ url: '/pages/me/index' })// 跳转页面
-            } else {
-              wx.showToast({
-                title: '保存失败',
-                icon: 'success',
-                duration: 2000
-              })
-            }
+        if (res.data.errcode == 0) {
+          wx.showToast({
+            title: '保存成功',
+            icon: 'success',
+            duration: 4000//延迟两秒
+          })
+          return wx.redirectTo({ url: '/pages/me/index' })// 跳转页面
+        } else {
+          wx.showToast({
+            title: '保存失败',
+            icon: 'success',
+            duration: 2000
+          })
+        }
 
-          },
-        })
-      }
+      },
     })
   },
 

+ 23 - 31
pages/teamDetails/index.js

@@ -23,38 +23,30 @@ Page({
   outTeam: function (e) {
     console.log(this.data.list.id);
     var id = this.data.list._id;
-    wx.getStorage({
-      key: 'token',
-      success: res => {
-        console.log(res.data.id);
-        var id1 = res.data.id;
-        wx.showModal({
-          title: '是否退出团队',
-          success(res) {
-            if (res.confirm) {
-              console.log('用户点击确定')
-              //数据请求
-              wx.request({
-                url: `${app.globalData.publicUrl}/courtAdmin/api/team/leaves`, //接口地址
-                method: "get",//请求方法
-                data: { user_id: id1, team_id: id },//请求参数
-                header: {},
-                success: res => {
-                  return wx.redirectTo({ url: '/pages/me/index' })// 跳转页面
-                },
-                error: err => {
-                  console.log(err);
-                }
-              })
-
-            } else if (res.cancel) {
-              console.log('用户点击取消')
+    console.log(res.data.id);
+    var id1 = res.data.id;
+    wx.showModal({
+      title: '是否退出团队',
+      success(res) {
+        if (res.confirm) {
+          console.log('用户点击确定')
+          //数据请求
+          wx.request({
+            url: `${app.globalData.publicUrl}/courtAdmin/api/team/leaves`, //接口地址
+            method: "get",//请求方法
+            data: { user_id: id1, team_id: id },//请求参数
+            header: {},
+            success: res => {
+              return wx.redirectTo({ url: '/pages/me/index' })// 跳转页面
+            },
+            error: err => {
+              console.log(err);
             }
-          }
-        })
-      },
-      fail: res => {
-        wx.redirectTo({ url: '/pages/login/index', })
+          })
+
+        } else if (res.cancel) {
+          console.log('用户点击取消')
+        }
       }
     })
   },