Explorar el Código

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

zs hace 3 años
padre
commit
c266453ad1
Se han modificado 7 ficheros con 217 adiciones y 122 borrados
  1. 2 2
      app.json
  2. 82 65
      pages/information/index.js
  3. 10 8
      pages/information/index.wxml
  4. 76 27
      pages/me/index.js
  5. 17 15
      pages/me/index.wxml
  6. 9 1
      pages/me/index.wxss
  7. 21 4
      pages/password/index.js

+ 2 - 2
app.json

@@ -1,8 +1,7 @@
 {
 {
   "pages": [
   "pages": [
-    "pages/index/index",
-    "pages/register/index",
     "pages/login/index",
     "pages/login/index",
+    "pages/index/index",
     "pages/home/index",
     "pages/home/index",
     "pages/search/index",
     "pages/search/index",
     "pages/administration/index",
     "pages/administration/index",
@@ -24,6 +23,7 @@
     "pages/auditTeam/index",
     "pages/auditTeam/index",
     "pages/match/index",
     "pages/match/index",
     "pages/match/detail",
     "pages/match/detail",
+    "pages/register/index",
     "pages/logs/logs"
     "pages/logs/logs"
   ],
   ],
   "usingComponents": {
   "usingComponents": {

+ 82 - 65
pages/information/index.js

@@ -2,7 +2,6 @@
 import WxValidate from '../../utils/wxValidate'
 import WxValidate from '../../utils/wxValidate'
 const app = getApp()
 const app = getApp()
 Page({
 Page({
-
     /**
     /**
      * 页面的初始数据
      * 页面的初始数据
      */
      */
@@ -11,64 +10,11 @@ Page({
         infoHeight: '',
         infoHeight: '',
         frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
         form: {
         form: {
-            ranks: '比赛第一名队',
-            mechanism: '吉佳通达',
-            sex: ['男', '女'],
-            objectSex: [{ id: 0, name: '男' }, { id: 1, name: '女' },],
-            post: '后勤部长',
-            phone: '12311111111',
-            email: '123@qq.com',
         },
         },
-        index: 0,
+        // index: 0,
         // 上传图片
         // 上传图片
         fileList: [],
         fileList: [],
     },
     },
-    //上传头像,更改头像
-    // changeSrc: function (event) {
-    //     var that = this;
-    //     wx.chooseImage({
-    //         count: 1,//最多可以选择的图片数量,默认9
-    //         sizeType: ['compressed', 'original'],
-    //         sourceType: ['album', 'camera'],
-    //         success: function (res) {
-    //             console.log(res.tempFilePaths + "修改页面")
-    //             var src = res.tempFilePaths;
-    //             that.setData({
-    //                 src: src,
-    //                 upSrc: true,
-
-    //             })
-    //             const { file } = event.detail;
-    //             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 = [] } = that.data;
-    //                         fileList.push({ ...file, url: res.data });
-    //                         that.setData({ fileList });
-    //                     } else {
-    //                         wx.showToast({ title: `${res.data.errmsg}`, icon: 'fail', duration: 2000 })
-    //                     }
-    //                 },
-    //             });
-
-
-    //         }
-    //     })
-
-    // },
-    // 上传图片
-
-
-
-    //上传图片
-
 
 
     afterRead: function (event) {
     afterRead: function (event) {
         const { file } = event.detail;
         const { file } = event.detail;
@@ -92,19 +38,22 @@ Page({
             },
             },
         });
         });
     },
     },
-    //选择
-    bindPickerChange: function (e) {
-        console.log('picker发送选择改变,携带值为', e.detail.value)
-        this.setData({
-            index: e.detail.value
-        })
-    },
+    // //选择
+    // bindPickerChange: function (e) {
+    //     console.log('picker发送选择改变,携带值为', e.detail.value)
+    //     this.setData({
+    //         index: e.detail.value
+    //     })
+    // },
     back: function () {
     back: function () {
         wx.navigateBack({ url: '/pages/me/index' })
         wx.navigateBack({ url: '/pages/me/index' })
     },
     },
-    //提交
-    formSubmit: function (e) {
-        console.log('form发生了submit事件,携带数据为:', e.detail.value)
+    //验证必填项
+    initValidate() {
+        const rules = { phone: { required: true, tel: true }, }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { phone: { required: '请输入手机号' }, };
+        this.WxValidate = new WxValidate(rules, messages)
     },
     },
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
@@ -112,6 +61,74 @@ Page({
     onLoad: function (options) {
     onLoad: function (options) {
         // 计算高度
         // 计算高度
         this.searchHeight()
         this.searchHeight()
+        // 监听用户是否登录
+        this.watchLogin();
+        //验证规则函数
+        this.initValidate()
+
+    },
+    // 监听用户是否登录
+    watchLogin: function () {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            success: res => {
+                //数据请求
+                wx.request({
+                    url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
+                    method: "get",//请求方法
+                    data: {},//请求参数
+                    header: {},
+                    success: res => {
+                        console.log(res);
+                        that.setData({ form: res.data.data })
+                    },
+                    error: err => {
+                        console.log(err);
+                    }
+                })
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/login/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 {
+            let value = e.detail.value;
+            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 () {
     searchHeight: function () {

+ 10 - 8
pages/information/index.wxml

@@ -8,29 +8,31 @@
                 </view>
                 </view>
                 <view class="one">
                 <view class="one">
                     <view class="text">昵称</view>
                     <view class="text">昵称</view>
-                    <input class="input" name="ranks" value="{{form.ranks}}" placeholder="" />
+                    <input class="input" name="nickname" value="{{form.nickname}}" placeholder="请输入昵称" />
                 </view>
                 </view>
                 <view class="one">
                 <view class="one">
                     <view class="text">机构</view>
                     <view class="text">机构</view>
-                    <input class="input" name="mechanism" value="{{form.mechanism}}" placeholder="" />
+                    <input class="input" name="mechanism" value="{{form.mechanism}}" placeholder="请输入机构" />
                 </view>
                 </view>
                 <view class="one">
                 <view class="one">
                     <view class="text">性别</view>
                     <view class="text">性别</view>
-                    <picker name="sex" bindchange="bindPickerChange" value="{{index}}" range="{{form.sex}}">
-                        <view class="input">{{form.sex[index]}}</view>
-                    </picker>
+
+                    <input class="input" name="gender" value="{{form.gender}}" placeholder="请输入性别" />
+                    <!-- <picker name="gender" bindchange="bindPickerChange" value="{{index}}" range="{{form.sex}}">
+                        <view class="input">{{form.gender[index]}}</view>
+                    </picker> -->
                 </view>
                 </view>
                 <view class="one">
                 <view class="one">
                     <view class="text">岗位</view>
                     <view class="text">岗位</view>
-                    <input class="input" name="post" value="{{form.post}}" placeholder="" />
+                    <input class="input" name="work" value="{{form.work}}" placeholder="请输入岗位" />
                 </view>
                 </view>
                 <view class="one">
                 <view class="one">
                     <view class="text">手机号</view>
                     <view class="text">手机号</view>
-                    <input class="input" name="phone" value="{{form.phone}}" placeholder="" />
+                    <input class="input" name="phone" value="{{form.phone}}" placeholder="请输入手机号" />
                 </view>
                 </view>
                 <view class="one">
                 <view class="one">
                     <view class="text">邮箱</view>
                     <view class="text">邮箱</view>
-                    <input class="input" name="email" value="{{form.email}}" placeholder="" />
+                    <input class="input" name="email" value="{{form.email}}" placeholder="请输入邮箱" />
                 </view>
                 </view>
             </view>
             </view>
             <view class="btn-area">
             <view class="btn-area">

+ 76 - 27
pages/me/index.js

@@ -22,28 +22,24 @@ Page({
         state: '已结束', date: '01.15', start: '未开始'
         state: '已结束', date: '01.15', start: '未开始'
       }
       }
     ],
     ],
-    list: [
-      {
-        id: '1', name: '张爽', company: '福瑞科技有限公司', gender: '女', src: '/image/tou.png', address: '马利克克海拉队', team: '队员',
-      },
-    ],
+    list: [{ src: '/image/tou.png', },],
+    item1: {},
     list3: [
     list3: [
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
-      },
-      {
-        id: '2', head: '/image/head1.png', group: '尼奥尔队', time: '08:30', ball: '篮球', date: '2022.01.15', person: '9',
-      },
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
-      },
-      {
-        id: '1', head: '/image/head1.png', group: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
-      },
+      // {
+      //   id: '1', head: '/image/head1.png', name: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
+      // },
+      // {
+      //   id: '2', head: '/image/head1.png', name: '尼奥尔队', time: '08:30', ball: '篮球', date: '2022.01.15', person: '9',
+      // },
+      // {
+      //   id: '1', head: '/image/head1.png', name: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
+      // },
+      // {
+      //   id: '1', head: '/image/head1.png', name: '哈拉海队', time: '08:30', ball: '足球', grade: 'c', date: '2022.01.15', person: '10',
+      // },
     ],
     ],
+    item2: {},
     showModal: false,
     showModal: false,
-    
-
   },
   },
   tabPath(e) {
   tabPath(e) {
     let query = e.detail.detail;
     let query = e.detail.detail;
@@ -73,7 +69,7 @@ Page({
       url: `/pages/createTeam/index`,
       url: `/pages/createTeam/index`,
     })
     })
   },
   },
-  ToDetails:function () {
+  ToDetails: function () {
     wx.navigateTo({
     wx.navigateTo({
       url: `/pages/teamDetails/detail`,
       url: `/pages/teamDetails/detail`,
     })
     })
@@ -96,12 +92,12 @@ Page({
       url: `/pages/auditTeam/index`,
       url: `/pages/auditTeam/index`,
     })
     })
   },
   },
-//解散申请
-apply: function () {
-  wx.navigateTo({
-    url: `/pages/dissolution/index`,
-  })
-},
+  //解散申请
+  apply: function () {
+    wx.navigateTo({
+      url: `/pages/dissolution/index`,
+    })
+  },
   //解散团队弹窗
   //解散团队弹窗
   clickme: function () {
   clickme: function () {
     this.setData({
     this.setData({
@@ -116,13 +112,66 @@ apply: function () {
       showModal: false
       showModal: false
     })
     })
   },
   },
-
   /**
   /**
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */
   onLoad: function (options) {
   onLoad: function (options) {
     // 计算高度
     // 计算高度
     this.searchHeight()
     this.searchHeight()
+    // 监听用户是否登录
+    this.watchLogin();
+    const that = this;
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        //数据请求
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
+          method: "get",//请求方法
+          data: {},//请求参数
+          header: {},
+          success: res => {
+            console.log(res);
+            that.setData({ list3: res.data.data })
+            console.log(res.data.data);
+          },
+          error: err => {
+            console.log(err);
+          }
+        })
+      },
+      fail: res => {
+        wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
+
+  },
+  // 监听用户是否登录
+  watchLogin: function () {
+    const that = this;
+    wx.getStorage({
+      key: 'token',
+      success: res => {
+        //数据请求
+        wx.request({
+          url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
+          method: "get",//请求方法
+          data: {},//请求参数
+          header: {},
+          success: res => {
+            console.log(res);
+            that.setData({ item1: res.data.data })
+            console.log(res.data.data);
+          },
+          error: err => {
+            console.log(err);
+          }
+        })
+      },
+      fail: res => {
+        wx.redirectTo({ url: '/pages/login/index', })
+      }
+    })
   },
   },
   // 计算高度
   // 计算高度
   searchHeight: function () {
   searchHeight: function () {

+ 17 - 15
pages/me/index.wxml

@@ -5,15 +5,15 @@
       <image src="{{src}}" class="images"></image>
       <image src="{{src}}" class="images"></image>
     </view>
     </view>
     <view class="two">
     <view class="two">
-      <view class="list" wx:key="item" wx:for="{{list}}">
+      <view class="list" wx:key="index" wx:for="{{list}}">
         <view class="left1">
         <view class="left1">
           <view class="left1-1">
           <view class="left1-1">
-            <view class="name">{{item.name}}</view>
-            <button class="button" size="mini">{{item.team}}</button>
+            <view class="name">{{item1.nickname}}</view>
+            <button class="button" size="mini">{{item1.status=='0'?'管理员':item1.status=='1'?'团队创建人':'队员'}}</button>
           </view>
           </view>
           <view class="left11-2">
           <view class="left11-2">
-            <text class="text1">{{item.company}}</text>
-            <text class="text1">{{item.gender}}</text>
+            <text class="text1">{{item1.mechanism}}</text>
+            <text class="text1">{{item1.gender}}</text>
           </view>
           </view>
         </view>
         </view>
         <view class="right1">
         <view class="right1">
@@ -24,7 +24,9 @@
             <text class=" icon iconfont icon-qi"></text>
             <text class=" icon iconfont icon-qi"></text>
           </view>
           </view>
           <view class="qian" bindtap="modify">
           <view class="qian" bindtap="modify">
-            <text class="text3">{{item.address}}</text>
+            <text class="text3" wx:if="{{item1.status=='2'||item1.status=='3'}}">{{item1.name}}</text>
+          </view>
+          <view class="icon_arrow" bindtap="modify">
             <van-icon name="arrow" color="rgb(177, 177, 177)" />
             <van-icon name="arrow" color="rgb(177, 177, 177)" />
           </view>
           </view>
         </view>
         </view>
@@ -83,7 +85,7 @@
       <view class="listtuan" wx:if="{{total!=''}}">
       <view class="listtuan" wx:if="{{total!=''}}">
         <view class="otherInfo">
         <view class="otherInfo">
           <text class="tuan">我的团队</text>
           <text class="tuan">我的团队</text>
-          <text class="total">共参加{{total}}个队伍</text>
+          <text class="total">共参加{{list3.length||0}}个队伍</text>
           <text class="chuang" bindtap="create">创建团队</text>
           <text class="chuang" bindtap="create">创建团队</text>
         </view>
         </view>
         <view class="weui-cells mgt-0 {{!showMore? 'hiddenmore' : 'showmore'}}">
         <view class="weui-cells mgt-0 {{!showMore? 'hiddenmore' : 'showmore'}}">
@@ -93,19 +95,19 @@
                 <image src="{{item.head}}" class="dui-image"></image>
                 <image src="{{item.head}}" class="dui-image"></image>
               </view>
               </view>
               <view class="dui-right1">
               <view class="dui-right1">
-                <text class="group">{{item.group}}</text>
+                <text class="group">{{item.name}}</text>
               </view>
               </view>
-              <button class="ball" size="mini" wx:if="{{item.ball=='足球'}}" style="background-color:rgb(63, 127, 245);">{{item.ball}}</button>
-              <button class="ball" size="mini" wx:if="{{item.ball=='篮球'}}" style="background-color:rgb(245, 172, 63);">{{item.ball}}</button>
-              <!-- <text class=" icon iconfont icon-C1" wx:if="{{item.grade}}"></text> -->
-              <button class="grade" size="mini">{{item.grade}}</button>
+              <button class="ball" size="mini" wx:if="{{item.type=='0'}}" style="background-color:rgb(63, 127, 245);">乒乓球</button>
+              <button class="ball" size="mini" wx:if="{{item.type=='1'}}" style="background-color:rgb(245, 172, 63);">足球</button>
+              <button class="ball" size="mini" wx:if="{{item.type=='2'}}" style="background-color:rgb(241, 95, 127);">篮球</button>
+              <!-- <text class=" icon iconfont icon-C1" wx:if="{{item.grade}}"></text>
+              <button class="grade" size="mini">c</button> -->
             </view>
             </view>
             <view class="dui-right"><text class="person">
             <view class="dui-right"><text class="person">
-                共{{item.person}}人
+                共{{item.menber.length||0}}人
               </text>
               </text>
             </view>
             </view>
-            <text class="date">{{item.date}}</text>
-            <text class="date">{{item.time}}创建</text>
+            <text class="date">{{item.create_time}}创建</text>
           </view>
           </view>
           <block wx:if="{{list3.length>2}}">
           <block wx:if="{{list3.length>2}}">
             <view wx:if="{{showMore}}" class="van" bindtap='listToggle'>
             <view wx:if="{{showMore}}" class="van" bindtap='listToggle'>

+ 9 - 1
pages/me/index.wxss

@@ -8,7 +8,15 @@
   float: left;
   float: left;
   width: 3%;
   width: 3%;
 }
 }
+.qian{
+  float: left;
+  width: 80%;
+}
+.icon_arrow{
+  float: right;
+  width: 6%;
 
 
+}
 .theme {
 .theme {
   position: fixed;
   position: fixed;
   margin-top: 5.5%;
   margin-top: 5.5%;
@@ -501,7 +509,7 @@
   position: fixed;
   position: fixed;
   left: 0;
   left: 0;
   z-index: 9999;
   z-index: 9999;
-  margin: -450px 85px;
+  margin: -450px 85px 0 85px;
   background-color: #fff;
   background-color: #fff;
   border-radius: 36rpx;
   border-radius: 36rpx;
   display: flex;
   display: flex;

+ 21 - 4
pages/password/index.js

@@ -10,9 +10,7 @@ Page({
         // 主体高度
         // 主体高度
         infoHeight: '',
         infoHeight: '',
         frameStyle: { useTop: true, name: '修改密码', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '修改密码', leftArrow: true, useBar: false },
-        form:{
-            password:'123456'
-        }
+        form: {}
     },
     },
     back: function () {
     back: function () {
         wx.navigateBack({ url: '/pages/me/index' })
         wx.navigateBack({ url: '/pages/me/index' })
@@ -24,9 +22,28 @@ Page({
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
-    onLoad: function (options) {
+    onLoad: function (e) {
         // 计算高度
         // 计算高度
         this.searchHeight()
         this.searchHeight()
+        const that = this;
+        // 获取用户信息
+        wx.getStorage({
+            key: 'token',
+            success: function (res) {
+                wx.request({
+                    url: `${app.globalData.publicUrl}/courtAdmin/api/user/updatePwd`, //接口地址
+                    method: "post",
+                    data: { "password": "" },
+                    header: {},
+                    success: res => {
+                        console.log(res);
+                    },
+                    error: err => {
+                        console.log(err);
+                    }
+                })
+            }
+        })
     },
     },
     // 计算高度
     // 计算高度
     searchHeight: function () {
     searchHeight: function () {