YY 3 tahun lalu
induk
melakukan
e4594ed430
3 mengubah file dengan 111 tambahan dan 100 penghapusan
  1. 55 54
      pages/createTeam/index.js
  2. 51 45
      pages/information/index.js
  3. 5 1
      pages/information/index.wxml

+ 55 - 54
pages/createTeam/index.js

@@ -27,6 +27,9 @@ Page({
         // 上传图片
         // 上传图片
         fileList: [],
         fileList: [],
     },
     },
+    back: function () {
+        wx.navigateBack({ url: '/pages/me/index' })
+    },
     determine: function (e) {
     determine: function (e) {
         this.setData({ showModal: false })
         this.setData({ showModal: false })
     },
     },
@@ -67,9 +70,7 @@ Page({
             ['form.create_time']: e.detail.value
             ['form.create_time']: e.detail.value
         })
         })
     },
     },
-    back: function () {
-        wx.navigateBack({ url: '/pages/me/index' })
-    },
+
     //点击减号删除
     //点击减号删除
     delList: function (e) {
     delList: function (e) {
         var id = e.currentTarget.dataset.id;
         var id = e.currentTarget.dataset.id;
@@ -96,17 +97,54 @@ Page({
         let arr = data.filter((i, index) => index != e.detail.index)
         let arr = data.filter((i, index) => index != e.detail.index)
         that.setData({ fileList: arr })
         that.setData({ fileList: arr })
     },
     },
-
+    //提交
+    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.logo = this.data.fileList;
+            value.members = this.data.members;
+            value.create_id = this.data.form.create_id;
+            wx.request({
+                url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
+                method: "post",//请求方法
+                //请求参数
+                data: value,
+                header: {},
+                success: 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 => {
+                }
+            })
+        }
+    },
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad: function (options) {
     onLoad: function (options) {
+        //验证规则函数
+        this.initValidate()
         // 计算高度
         // 计算高度
         this.searchHeight()
         this.searchHeight()
         // 监听用户是否登录
         // 监听用户是否登录
         this.watchLogin();
         this.watchLogin();
-        //验证规则函数
-        this.initValidate()
     },
     },
     //验证必填项
     //验证必填项
     initValidate() {
     initValidate() {
@@ -115,6 +153,16 @@ Page({
         const messages = { name: { required: '请输入团队名称' }, type: { required: '请输入团队类型' }, create_user: { required: '请输入团队创建人名称' }, };
         const messages = { name: { required: '请输入团队名称' }, type: { required: '请输入团队类型' }, create_user: { required: '请输入团队创建人名称' }, };
         this.WxValidate = new WxValidate(rules, messages)
         this.WxValidate = new WxValidate(rules, messages)
     },
     },
+    // 计算高度
+    searchHeight: function () {
+        let frameStyle = this.data.frameStyle;
+        let client = app.globalData.client;
+        // 减去状态栏
+        let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+        // 是否减去底部菜单
+        if (frameStyle.useBar) infoHeight = infoHeight - 50;
+        if (infoHeight) this.setData({ infoHeight: infoHeight })
+    },
     // 监听用户是否登录
     // 监听用户是否登录
     watchLogin: function () {
     watchLogin: function () {
         const that = this;
         const that = this;
@@ -151,54 +199,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.logo = this.data.fileList;
-            value.members = this.data.members;
-            value.create_id = this.data.form.create_id;
-            wx.request({
-                url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
-                method: "post",//请求方法
-                //请求参数
-                data: value,
-                header: {},
-                success: 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 => {
-                }
-            })
-        }
-    },
-    // 计算高度
-    searchHeight: function () {
-        let frameStyle = this.data.frameStyle;
-        let client = app.globalData.client;
-        // 减去状态栏
-        let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
-        // 是否减去底部菜单
-        if (frameStyle.useBar) infoHeight = infoHeight - 50;
-        if (infoHeight) this.setData({ infoHeight: infoHeight })
-    },
+
     /**
     /**
      * 生命周期函数--监听页面初次渲染完成
      * 生命周期函数--监听页面初次渲染完成
      */
      */

+ 51 - 45
pages/information/index.js

@@ -11,16 +11,12 @@ Page({
         frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
         frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
         form: {},
         form: {},
         fileList: [],
         fileList: [],
-        gender: ['男', '女'],
-        // objectGender: [{id: 0,name: '男'},{id: 1,name: '女'},],
-        // index: 0,
+        gender: [{ id: '0', name: '男' }, { id: 1, name: '女' },],
+        index: 0,
+    },
+    back: function () {
+        wx.navigateBack({ url: '/pages/me/index' })
     },
     },
-    bindPickerChange: function (e) {
-        console.log('picker发送选择改变,携带值为', e.detail.value)
-        this.setData({
-          index: e.detail.value
-        })
-      },
     //上传图片
     //上传图片
     imgUpload: function (e) {
     imgUpload: function (e) {
         const that = this;
         const that = this;
@@ -35,8 +31,12 @@ Page({
         let arr = data.filter((i, index) => index != e.detail.index)
         let arr = data.filter((i, index) => index != e.detail.index)
         that.setData({ fileList: arr })
         that.setData({ fileList: arr })
     },
     },
-    back: function () {
-        wx.navigateBack({ url: '/pages/me/index' })
+    // 选择用户性别
+    bindPickerChange: function (e) {
+        const that = this;
+        let index = e.detail.value;
+        let data = that.data.gender[index];
+        if (data) that.setData({ 'form.gender': data.name });
     },
     },
     //提交
     //提交
     formSubmit: function (e) {
     formSubmit: function (e) {
@@ -47,40 +47,44 @@ Page({
             return false
             return false
         } else {
         } else {
             value.icon = this.data.fileList;
             value.icon = this.data.fileList;
-            console.log(value);
-            // 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
-            //             })
-            //         }
-            //     },
-            // })
+            value.id = this.data.form.id;
+            value.status = this.data.form.status;
+            value.type = this.data.form.type;
+            value.gender = this.data.form.gender;
+            wx.request({
+                url: `${app.globalData.publicUrl}/courtAdmin/api/user/${value.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
+                        })
+                    }
+                },
+            })
         }
         }
     },
     },
     /**
     /**
      * 生命周期函数--监听页面加载
      * 生命周期函数--监听页面加载
      */
      */
     onLoad: function (options) {
     onLoad: function (options) {
+        //验证规则函数
+        this.initValidate();
         // 计算高度
         // 计算高度
         this.searchHeight();
         this.searchHeight();
         // 监听用户是否登录
         // 监听用户是否登录
         this.watchLogin();
         this.watchLogin();
-        //验证规则函数
-        this.initValidate();
+
     },
     },
     //验证必填项
     //验证必填项
     initValidate() {
     initValidate() {
@@ -89,6 +93,17 @@ Page({
         const messages = { phone: { required: '请输入手机号' }, };
         const messages = { phone: { required: '请输入手机号' }, };
         this.WxValidate = new WxValidate(rules, messages)
         this.WxValidate = new WxValidate(rules, messages)
     },
     },
+    // 计算高度
+    searchHeight: function () {
+        let frameStyle = this.data.frameStyle;
+        let client = app.globalData.client;
+        let infoHeight = client.windowHeight;
+        // 是否去掉状态栏
+        if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
+        // 是否减去底部菜单
+        if (frameStyle.useBar) infoHeight = infoHeight - 50;
+        if (infoHeight) this.setData({ infoHeight: infoHeight })
+    },
     // 监听用户是否登录
     // 监听用户是否登录
     watchLogin: function () {
     watchLogin: function () {
         const that = this;
         const that = this;
@@ -115,16 +130,7 @@ Page({
             }
             }
         })
         })
     },
     },
-    // 计算高度
-    searchHeight: function () {
-        let frameStyle = this.data.frameStyle;
-        let client = app.globalData.client;
-        // 减去状态栏
-        let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
-        // 是否减去底部菜单
-        if (frameStyle.useBar) infoHeight = infoHeight - 50;
-        if (infoHeight) this.setData({ infoHeight: infoHeight })
-    },
+
 
 
     /**
     /**
      * 生命周期函数--监听页面初次渲染完成
      * 生命周期函数--监听页面初次渲染完成

+ 5 - 1
pages/information/index.wxml

@@ -16,9 +16,13 @@
                 </view>
                 </view>
                 <view class="one">
                 <view class="one">
                     <view class="text">性别</view>
                     <view class="text">性别</view>
-                    <picker name="gender" bindchange="bindPickerChange" value="{{form.gender}}" range="{{gender}}">
+                    <picker name="gender" mode="selector" bindchange="bindPickerChange" range-key="name" range="{{gender}}">
                         <view class="input">{{form.gender}}</view>
                         <view class="input">{{form.gender}}</view>
                     </picker>
                     </picker>
+                    <!-- <picker class="picker" mode="selector" bindchange="typeChange" name="type" range-key="value" range="{{typeList}}">
+                        <view class="weui-select">{{form.type_name||'用户类别'}}</view>
+                    </picker> -->
+
                 </view>
                 </view>
                 <view class="one">
                 <view class="one">
                     <view class="text">岗位</view>
                     <view class="text">岗位</view>