From ab2ac8c146ab0bc603aaef3c7e3c8d6eb94e842a Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Mon, 10 Dec 2018 15:57:59 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=BC=96=E8=BE=91=E4=B8=AA=E4=BA=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF][=E4=BF=AE=E6=94=B9]:[=E7=BC=96=E8=BE=91=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=BF=A1=E6=81=AF=E7=9A=84=E5=9C=B0=E5=9D=80=E4=BF=AE?= =?UTF-8?q?=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/edit/edit.js | 22 +++++++++++++++++----- pages/user/index.wxml | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pages/edit/edit.js b/pages/edit/edit.js index 97601ec..453f30b 100644 --- a/pages/edit/edit.js +++ b/pages/edit/edit.js @@ -2,7 +2,6 @@ const util = require("../../utils/util.js"); const Http = require("../../utils/HttpBasics"); const config = require("../../config/config"); Page({ - /** * 页面的初始数据 */ @@ -49,8 +48,10 @@ Page({ let that = this; wx.chooseLocation({ success: function (res) { + console.log(res) that.setData({ address: res.name + '(' + res.address + ')', + addressStr: JSON.stringify(res) }) }, fail: function (error) { @@ -73,8 +74,8 @@ Page({ } else { var sex = that.data.sex; } - if (that.data.address) { - var address = that.data.address; + if (that.data.addressStr) { + var address = that.data.addressStr; } else { var address = null; @@ -93,6 +94,10 @@ Page({ } else { var birthdate = null; } + console.log(username) + console.log(address) + console.log(sex) + console.log(birthdate) if (username == null || address == null || sex == 0 || birthdate == null) { wx.showModal({ title: '提示', @@ -146,10 +151,17 @@ Page({ url: config.api.getScore, data: {} }).then(res => { - console.log(res); - if (res.data.address) { + console.log(res.data.address); + var reg = RegExp(/address/); + if (res.data.address.match(reg)) { + that.setData({ + address: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name, + addressStr: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name + }) + }else{ that.setData({ address: res.data.address, + addressStr: res.data.address }) } if (res.data.name) { diff --git a/pages/user/index.wxml b/pages/user/index.wxml index 78057c7..66009e2 100644 --- a/pages/user/index.wxml +++ b/pages/user/index.wxml @@ -70,7 +70,7 @@ - 版本号:3.1.2 + 版本号:3.1.3