Ver código fonte

my-profile page

邹能昇 5 dias atrás
pai
commit
6f42617488

+ 26 - 1
nova-werun/pages/my/my-profile/index.js

@@ -119,6 +119,13 @@ Page({
             console.log(this.data.height);
         }
     },
+    //点击清空
+    clearHeight(){
+        this.setData({
+            height:null
+        })
+        console.log('清空',this.data.height);
+    },
     //获取头像名称
     async getname() {
         const currentUser = Parse.User.current();
@@ -139,7 +146,6 @@ Page({
         console.log(this.data.User1List);
     },
     onSelect(event) {
-        console.log(event.detail);
         let {
             name
         } = event.detail
@@ -147,11 +153,30 @@ Page({
             sex : name,
             show2: false
         })
+        console.log(this.data.sex);
     },
     showSelect() {
         this.setData({
             show2: true
         })
     },
+    //修改名字
+    changenickname(e){
+        this.setData({
+            nickname:e.detail
+        })
+        console.log(this.data.nickname);
+    },
+    //上传信息
+    async setinfo(){
+        const currentUser = Parse.User.current();
+        let Userquery = new Parse.Query('_User');
+        Userquery.equalTo('company', company);
+        Userquery.equalTo('objectId', currentUser.id);
+        Userquery.notEqualTo('isDeleted', true)
+        let user = await Userquery.first();
+        user.set('sex',this.data.sex)
+        user.set('nickname',this.data.nickname)
+    }
 
 })

+ 2 - 2
nova-werun/pages/my/my-profile/index.wxml

@@ -8,9 +8,9 @@
         </view>
 
     </view>
-    <van-field value="{{ nickname }}" required clearable label="昵称"  placeholder="请输入昵称" bind:click-icon="onClickIcon" />
+    <van-field value="{{ nickname }}" required clearable label="昵称" maxlength="8"  placeholder="请输入昵称" bind:change="changenickname" />
     <van-field class="field" required model:value="{{ sex }}" readonly maxlength="1" label="性别"  bind:tap="showSelect" />
-    <van-field value="{{ height }}" required  clearable  label="身高" type="number"   placeholder="请输入身高" bind:blur="getHeight" />
+    <van-field value="{{ height }}" required  clearable  label="身高" type="number"   placeholder="请输入身高" bind:blur="getHeight" bind:clear='clearHeight' />
     <van-action-sheet show="{{ show2 }}"  actions="{{ actions }}" bind:select="onSelect" />
 
     <view class="submitbox">