From 1a6905045d38bb50b0c6554c3440bdfd339c8d23 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 30 七月 2024 19:13:46 +0800
Subject: [PATCH] ‘’

---
 wechat_jiaxuan/pages/userinfo/index.js |   49 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/wechat_jiaxuan/pages/userinfo/index.js b/wechat_jiaxuan/pages/userinfo/index.js
index fbe9364..4efa7d6 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: '',
     }
   },
-  onShow() {
+  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() {
@@ -56,7 +69,6 @@
     })
     editMember({
       ...addr,
-      imgurl: imgurl || '',
       name: name || '',
       nickname: nickname || '',
       phone: phone || '',
@@ -65,12 +77,17 @@
       longitude: longitude || '',
       district: district || '',
       housearea: housearea || '',
+      imgurl: imgurl || null,
       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() {
@@ -125,15 +142,10 @@
       areaName: names[2],
     }
     this.setData({ addr })
-  },
-  bindRegionChange(e) {
-    console.log('picker鍙戦�侀�夋嫨鏀瑰彉锛屾惡甯﹀�间负', e.detail.value)
-    const temp = e.detail.value
-    this.setData({
-      region: e.detail.value
-    })
+    console.log('addr', this.data.addr);
   },
   getBindchooseavatar(e) {
+    console.log('e', e);
     var that = this
     if (e.detail.avatarUrl) {
       wx.uploadFile({
@@ -149,23 +161,38 @@
             imgurl: data.data.imgaddr,
             imgurlFull: data.data.url,
           })
+          console.log('imgurlFull', this.data);
         }
       })
     }
   },
+  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 })
+    this.setData({ nickname: 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);
       }
     })
   },

--
Gitblit v1.9.3