Przeglądaj źródła

[编辑个人信息][修改]:[编辑个人信息的地址修改]

tags/同保楼3.1.3
meo 6 lat temu
rodzic
commit
ab2ac8c146
2 zmienionych plików z 18 dodań i 6 usunięć
  1. +17
    -5
      pages/edit/edit.js
  2. +1
    -1
      pages/user/index.wxml

+ 17
- 5
pages/edit/edit.js Wyświetl plik

@@ -2,7 +2,6 @@ const util = require("../../utils/util.js");
const Http = require("../../utils/HttpBasics"); const Http = require("../../utils/HttpBasics");
const config = require("../../config/config"); const config = require("../../config/config");
Page({ Page({

/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
@@ -49,8 +48,10 @@ Page({
let that = this; let that = this;
wx.chooseLocation({ wx.chooseLocation({
success: function (res) { success: function (res) {
console.log(res)
that.setData({ that.setData({
address: res.name + '(' + res.address + ')', address: res.name + '(' + res.address + ')',
addressStr: JSON.stringify(res)
}) })
}, },
fail: function (error) { fail: function (error) {
@@ -73,8 +74,8 @@ Page({
} else { } else {
var sex = that.data.sex; var sex = that.data.sex;
} }
if (that.data.address) {
var address = that.data.address;
if (that.data.addressStr) {
var address = that.data.addressStr;
} }
else { else {
var address = null; var address = null;
@@ -93,6 +94,10 @@ Page({
} else { } else {
var birthdate = null; var birthdate = null;
} }
console.log(username)
console.log(address)
console.log(sex)
console.log(birthdate)
if (username == null || address == null || sex == 0 || birthdate == null) { if (username == null || address == null || sex == 0 || birthdate == null) {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
@@ -146,10 +151,17 @@ Page({
url: config.api.getScore, url: config.api.getScore,
data: {} data: {}
}).then(res => { }).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({ that.setData({
address: res.data.address, address: res.data.address,
addressStr: res.data.address
}) })
} }
if (res.data.name) { if (res.data.name) {


+ 1
- 1
pages/user/index.wxml Wyświetl plik

@@ -70,7 +70,7 @@
<view class="margin"></view> <view class="margin"></view>
<!-- <button bindtap="navigateTo" class="user-out-btn">退出登陆</button> --> <!-- <button bindtap="navigateTo" class="user-out-btn">退出登陆</button> -->
<view bindlongtap='showVersion' class='version'> <view bindlongtap='showVersion' class='version'>
<view wx:if="{{flag=='show'}}">版本号:3.1.2</view>
<view wx:if="{{flag=='show'}}">版本号:3.1.3</view>
<view wx:if="{{flag=='hidden'}}"></view> <view wx:if="{{flag=='hidden'}}"></view>
</view> </view>
</view> </view>


Ładowanie…
Anuluj
Zapisz