From d9a89d83c2048a964f16ca179feb2b7f21b9d33a Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 29 七月 2024 16:28:47 +0800
Subject: [PATCH] 提交

---
 wechat_jiaxuan/pages/userinfo/index.js |   87 +++++++++++++++++++++++++++++++++----------
 1 files changed, 66 insertions(+), 21 deletions(-)

diff --git a/wechat_jiaxuan/pages/userinfo/index.js b/wechat_jiaxuan/pages/userinfo/index.js
index ab3fa95..7aa68b1 100644
--- a/wechat_jiaxuan/pages/userinfo/index.js
+++ b/wechat_jiaxuan/pages/userinfo/index.js
@@ -1,7 +1,8 @@
 import {
   uploadUrl,
   editMember,
-  getMemberInfo
+  getMemberInfo,
+  getArea
 } from '../../api/index'
 Page({
 
@@ -19,8 +20,9 @@
     longitude: '',
     district: '',
     housearea: '',
-    // 鍩庡競銆傚湴鍧�
-    region: [],
+    
+    addr: {},
+    areaData: [],
 
     showHouseType: false,
     houseType: {
@@ -31,7 +33,7 @@
       val5: '',
     }
   },
-  onLoad(options) {
+  onShow() {
     this.initData()
   },
   onSubmit() {
@@ -45,13 +47,15 @@
       longitude,
       district,
       housearea,
-      houseType
+      houseType,
+      addr
     } = this.data
     if (!nickname) return wx.showToast({
       title: '璇疯緭鍏ユ樀绉�',
       icon: 'none'
     })
     editMember({
+      ...addr,
       imgurl: imgurl || '',
       name: name || '',
       nickname: nickname || '',
@@ -63,6 +67,7 @@
       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'
@@ -93,8 +98,64 @@
         longitude: res.data.longitude || '',
         district: res.data.district || '',
         housearea: res.data.housearea || '',
+        addr: {
+          provinceCode: res.data.provinceCode,
+          provinceName: res.data.provinceName,
+          cityCode: res.data.cityCode,
+          cityName: res.data.cityName,
+          areaCode: res.data.areaCode,
+          areaName: res.data.areaName,
+        }
+
       })
     })
+    getArea().then(res => {
+      this.setData({ areaData: res.data })
+    })
+  },
+  positionChange (e) {
+    console.log(e.detail.value)
+    const names = e.detail.value
+    const codes = e.detail.code
+    let addr = {
+      provinceCode: codes[0] + '00',
+      provinceName: names[0],
+      cityCode: codes[1] + '00',
+      cityName: names[1],
+      areaCode: codes[2] + '00',
+      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
+    })
+  },
+  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,
+          })
+        }
+      })
+    }
+  },
+  getNickName(e) {
+    this.setData({ nikname: e.detail.value })
   },
   changeAddr() {
     // console.log('鐐瑰嚮浜�');
@@ -107,12 +168,6 @@
           address: res.address,
         })
       }
-    })
-  },
-  bindRegionChange(e) {
-    console.log('picker鍙戦�侀�夋嫨鏀瑰彉锛屾惡甯﹀�间负', e.detail.value)
-    this.setData({
-      region: e.detail.value
     })
   },
   openHouse() {
@@ -167,22 +222,12 @@
               imgurl: data.data.imgaddr,
               imgurlFull: data.data.url,
             })
-            setTimeout(() => {
-              console.log('imgurlFull', this.data.imgurlFull);
-            }, 1000)
           }
         })
       }
     })
   },
   onReady() {
-
-  },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
-  onShow() {
 
   },
 

--
Gitblit v1.9.3