YY пре 3 година
родитељ
комит
18ef6d748c
2 измењених фајлова са 39 додато и 36 уклоњено
  1. 35 31
      pages/information/index.js
  2. 4 5
      pages/information/index.wxml

+ 35 - 31
pages/information/index.js

@@ -9,13 +9,18 @@ Page({
         // 主体高度
         infoHeight: '',
         frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
-        form: {
-        },
-        // index: 0,
-        // 上传图片
+        form: {},
         fileList: [],
+        gender: ['男', '女'],
+        // objectGender: [{id: 0,name: '男'},{id: 1,name: '女'},],
+        // index: 0,
     },
-
+    bindPickerChange: function (e) {
+        console.log('picker发送选择改变,携带值为', e.detail.value)
+        this.setData({
+          index: e.detail.value
+        })
+      },
     //上传图片
     imgUpload: function (e) {
         const that = this;
@@ -42,30 +47,30 @@ Page({
             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
-                        })
-                    }
-                },
-            })
+            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
+            //             })
+            //         }
+            //     },
+            // })
         }
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
@@ -93,13 +98,13 @@ Page({
                 //数据请求
                 wx.request({
                     url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
-                    method: "get",//请求方法
-                    data: {},//请求参数
+                    method: "get",
+                    data: {},
                     header: {},
                     success: res => {
                         that.setData({ form: res.data.data })
                         let icon = res.data.data.icon;
-                        this.setData({ fileList: icon })
+                        that.setData({ fileList: icon })
                     },
                     error: err => {
                     }
@@ -110,7 +115,6 @@ Page({
             }
         })
     },
-
     // 计算高度
     searchHeight: function () {
         let frameStyle = this.data.frameStyle;

+ 4 - 5
pages/information/index.wxml

@@ -4,7 +4,7 @@
             <view class="form" style="height:{{infoHeight-140}}px;">
                 <view class="zero">
                     <view class="text">头像</view>
-                    <upload class="tou" list="{{fileList}}" count="{{1}}"  bind:imgUpload="imgUpload" bind:imgDel="imgDel"></upload>
+                    <upload class="tou" list="{{fileList}}" count="{{1}}" bind:imgUpload="imgUpload" bind:imgDel="imgDel"></upload>
                 </view>
                 <view class="one">
                     <view class="text">昵称</view>
@@ -16,10 +16,9 @@
                 </view>
                 <view class="one">
                     <view class="text">性别</view>
-                    <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> -->
+                    <picker name="gender" bindchange="bindPickerChange" value="{{form.gender}}" range="{{gender}}">
+                        <view class="input">{{form.gender}}</view>
+                    </picker>
                 </view>
                 <view class="one">
                     <view class="text">岗位</view>