From b022834cf81ea67a6f28d31cc057d494ac6dc8ed Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 30 七月 2024 14:03:02 +0800
Subject: [PATCH] 提交

---
 wechat_jiaxuan/pages/userinfo/index.js |   68 ++++++++++++++++++++++++++++------
 1 files changed, 56 insertions(+), 12 deletions(-)

diff --git a/wechat_jiaxuan/pages/userinfo/index.js b/wechat_jiaxuan/pages/userinfo/index.js
index a6c42a2..b153030 100644
--- a/wechat_jiaxuan/pages/userinfo/index.js
+++ b/wechat_jiaxuan/pages/userinfo/index.js
@@ -2,7 +2,8 @@
   uploadUrl,
   editMember,
   getMemberInfo,
-  getArea
+  getArea,
+  getWxMiniPhone
 } from '../../api/index'
 Page({
 
@@ -33,7 +34,19 @@
       val5: '',
     }
   },
-  onLoad(options) {
+  onLoad() {
+    wx.getUserInfo({
+      success: function(res) {
+        console.log('res', res);
+        var userInfo = res.userInfo
+        var nickName = userInfo.nickName
+        var avatarUrl = userInfo.avatarUrl
+        var gender = userInfo.gender //鎬у埆 0锛氭湭鐭ャ��1锛氱敺銆�2锛氬コ
+        var province = userInfo.province
+        var city = userInfo.city
+        var country = userInfo.country
+      }
+    })
     this.initData()
   },
   onSubmit() {
@@ -67,10 +80,14 @@
       housearea: housearea || '',
       housetype: houseType.val1 + '-' + houseType.val2 + '-' + houseType.val3 + '-' + houseType.val4 + '-' + houseType.val5
     }).then(res => {
+      wx.setStorageSync('member', res.data)
       wx.showToast({
         title: '淇濆瓨鎴愬姛',
         icon: 'none'
       })
+      setTimeout(() => {
+        wx.navigateBack()
+      }, 500)
     })
   },
   initData() {
@@ -133,16 +150,53 @@
       region: e.detail.value
     })
   },
+  getBindchooseavatar(e) {
+    var that = this
+    if (e.detail.avatarUrl) {
+      wx.uploadFile({
+        url: uploadUrl,
+        filePath: e.detail.avatarUrl,
+        formData: {
+          folder: "member"
+        },
+        name: 'file',
+        success (res) {
+          let data = JSON.parse(res.data)
+          that.setData({
+            imgurl: data.data.imgaddr,
+            imgurlFull: data.data.url,
+          })
+        }
+      })
+    }
+  },
+  getPhoneNumber (e) {
+    const data = { ...e.detail }
+    getWxMiniPhone({
+      encryptedData: data.encryptedData,
+      iv: data.iv,
+      sessionKey: wx.getStorageSync('sessionKey') || data.iv,
+    }).then(res => {
+      this.setData({
+        phone: res.data
+      })
+    })
+  },
+  getNickName(e) {
+    this.setData({ nikname: e.detail.value })
+  },
   changeAddr() {
     // console.log('鐐瑰嚮浜�');
     wx.chooseLocation({
       type: 'wgs84',
       success: (res) => {
+        console.log('res', res);
         this.setData({
           longitude: res.longitude,
           latitude: res.latitude,
           address: res.address,
         })
+        console.log('address', this.data.address);
       }
     })
   },
@@ -198,22 +252,12 @@
               imgurl: data.data.imgaddr,
               imgurlFull: data.data.url,
             })
-            setTimeout(() => {
-              console.log('imgurlFull', this.data.imgurlFull);
-            }, 1000)
           }
         })
       }
     })
   },
   onReady() {
-
-  },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
-  onShow() {
 
   },
 

--
Gitblit v1.9.3