YY 3 年之前
父節點
當前提交
d8ca759c26
共有 6 個文件被更改,包括 178 次插入35 次删除
  1. 64 10
      pages/auditTeam/index.js
  2. 11 5
      pages/auditTeam/index.wxml
  3. 21 15
      pages/auditTeam/index.wxss
  4. 3 4
      pages/me/index.wxml
  5. 1 0
      pages/me/index.wxss
  6. 78 1
      pages/password/index.js

+ 64 - 10
pages/auditTeam/index.js

@@ -10,12 +10,7 @@ Page({
         // 主体高度
         infoHeight: '',
         frameStyle: { useTop: true, name: '审核队员', leftArrow: true, useBar: false },
-        list: [
-            { id: '1', team: '我是第一队', time: '2020.01.20 08:30'},
-            { id: '1', team: '我是第一队', time: '2020.01.20 08:30'},
-            { id: '1', team: '我是第一队', time: '2020.01.20 08:30'},
-            { id: '1', team: '我是第一队', time: '2020.01.20 08:30'}
-        ]
+        list: []
     },
 
     back: function () {
@@ -23,11 +18,71 @@ Page({
     },
 
     /**
-     * 生命周期函数--监听页面加载
-     */
+ * 生命周期函数--监听页面加载
+ */
     onLoad: function (options) {
         // 计算高度
-        this.searchHeight()
+        this.searchHeight();
+        // 监听用户是否登录
+        this.watchLogin();
+    },
+    // 监听用户是否登录
+    watchLogin: function () {
+        const that = this;
+        wx.getStorage({
+            key: 'token',
+            success: res => {
+                //数据请求
+                wx.request({
+                    url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply`, //接口地址
+                    method: "get",
+                    data: {},
+                    header: {},
+                    success: res => {
+                        console.log(res);
+                        that.setData({ list: res.data.data })
+                    },
+                    error: err => {
+                        console.log(err);
+                    }
+                })
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/login/index', })
+            }
+        })
+    },
+    //通过
+    adopt: function (e) {
+        let { id } = e.currentTarget.dataset;
+        wx.request({
+            url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply/${id}`, //接口地址
+            method: "post",
+            data: { status: '1' },
+            header: {},
+            success: res => {
+                console.log(res);
+            },
+            error: err => {
+                console.log(err);
+            }
+        })
+    },
+    //驳回
+    reject: function (e) {
+        let { id } = e.currentTarget.dataset;
+        wx.request({
+            url: `${app.globalData.publicUrl}/courtAdmin/api/joinapply/${id}`, //接口地址
+            method: "post",
+            data: { status: '-1' },
+            header: {},
+            success: res => {
+                console.log(res);
+            },
+            error: err => {
+                console.log(err);
+            }
+        })
     },
     // 计算高度
     searchHeight: function () {
@@ -39,7 +94,6 @@ Page({
         if (frameStyle.useBar) infoHeight = infoHeight - 50;
         if (infoHeight) this.setData({ infoHeight: infoHeight })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 11 - 5
pages/auditTeam/index.wxml

@@ -1,11 +1,17 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="main" style="height:{{infoHeight}}px;">
         <view class="one" wx:key="item" wx:for="{{list}}">
-            <image class="logo" src="/image/logo1.png"></image>
-            <text class="text1">{{item.team}}</text>
-            <text class="text2">申请时间:{{item.time}}</text>
-            <button size="mini" class="btn1">驳回</button>
-            <button size="mini" class="btn2">通过</button>
+            <view class="one_l">
+                <image class="icon" src="{{item.icon[0].url}}"></image>
+            </view>
+            <view class="one_r">
+                <view class="text1">{{item.apply_user}}</view>
+                <view class="text2">申请时间:{{item.apply_time}}</view>
+            </view>
+            <view class="btn">
+                <button size="mini" bindtap="reject" data-id="{{item._id}}" class="btn1">驳回</button>
+                <button size="mini" bindtap="adopt" data-id="{{item._id}}" class="btn2">通过</button>
+            </view>
         </view>
     </view>
 </mobile-main>

+ 21 - 15
pages/auditTeam/index.wxss

@@ -10,46 +10,52 @@
     background-color: #fff;
 }
 
-.logo {
+.one_l {
+    width: 25%;
+    float: left;
+}
+
+.one_r {
+    width: 70%;
+    float: left;
+}
+
+.icon {
     height: 50px;
     width: 50px;
     padding: 12px;
 }
 
 .text1 {
-    position: relative;
-    left: 10px;
-    top: -45px;
+    margin: 10px 0 10px 0;
 }
 
 .text2 {
-    position: relative;
-    left: -70px;
-    top: -10px;
+    margin: 0 0 8px 0;
     font-size: 14px;
     color: #666;
 }
+
+.btn {
+    width: 100%;
+}
+
 .btn1 {
-    position: relative;
-    left: 50px;
-    top: -4px;
+    
     width: 80px !important;
     height: 30px !important;
     background-color: rgba(136, 136, 136, 0.4);
     border-radius: 30px;
     color: #5e5e5e;
-    margin: 4px 0 4px 0;
+    margin:4px 0px 4px -45px;
 }
 
 .btn2 {
-    position: relative;
-    top: -4px;
-    left: 140px;
     width: 80px !important;
     height: 30px !important;
     background-image: linear-gradient(to right, #f43f3f, #ce4bd2);
     border-radius: 30px;
     color: #ffffff;
     text-align: center;
-    margin: 4px 0 4px 0;
+    margin: 4px 0 4px 100px;
 }

+ 3 - 4
pages/me/index.wxml

@@ -24,7 +24,7 @@
             <text class=" icon iconfont icon-qi"></text>
           </view>
           <view class="qian">
-            <text class="text3" wx:if="{{item1.status=='2'||item1.status=='3'}}">{{item1.name}}</text>
+            <text class="text3" wx:if="{{item1.type=='2'||item1.type=='3'}}">{{item1.name}}</text>
           </view>
           <view class="icon_arrow" bindtap="modify">
             <van-icon name="arrow" color="rgb(177, 177, 177)" />
@@ -86,8 +86,7 @@
         <view class="otherInfo">
           <text class="tuan">我的团队</text>
           <text class="total">共参加{{list3.length||0}}个队伍</text>
-          <text class="chuang" bindtap="create">创建团队</text>
-          <!-- <text class="chuang" bindtap="create" wx:if="{{list3.length<1}}">创建团队</text> -->
+          <text class="chuang" bindtap="create" wx:if="{{list3.length<1||item.type=='0'}}">创建团队</text>
         </view>
         <view class="weui-cells mgt-0 {{!showMore? 'hiddenmore' : 'showmore'}}">
           <view wx:key="item" wx:for="{{list3}}" wx:for-index="idx" wx:key="key" bindtap="ToDetails" class="list3 {{idx>1 ? 'more-item' : ''}}">
@@ -105,7 +104,7 @@
               <button class="grade" size="mini">c</button> -->
             </view>
             <view class="dui-right"><text class="person">
-                共{{item.menber.length||0}}人
+                共{{item.members.length||0}}人
               </text>
             </view>
             <text class="date">{{item.create_time}}创建</text>

+ 1 - 0
pages/me/index.wxss

@@ -487,6 +487,7 @@
 .listtuan {
   background-color: white;
   border-radius: 5%;
+  padding: 0 0 5px 0;
 }
 
 .hiddenmore .more-item {

+ 78 - 1
pages/password/index.js

@@ -16,14 +16,91 @@ Page({
     back: function () {
         wx.navigateBack({ url: '/pages/me/index' })
     },
-
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    //验证必填项
+    initValidate() {
+        const rules = { password: { required: true }, }
+        // 验证字段的提示信息,若不传则调用默认的信息
+        const messages = { password: { required: '请输入新密码' }, };
+        this.WxValidate = new WxValidate(rules, messages)
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
         // 计算高度
         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 {
+            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
+                                })
+                            }
+                        },
+                    })
+                }
+            })
+        }
+    },
+
     // 计算高度
     searchHeight: function () {
         let frameStyle = this.data.frameStyle;