Browse Source

个人信息授权页面整合

packages
HolyKnightIX 2 years ago
parent
commit
b4f1156449
8 changed files with 263 additions and 81 deletions
  1. BIN
      assets/images/next.png
  2. +10
    -13
      ext.json
  3. +6
    -6
      pages/edit/edit.js
  4. +5
    -5
      pages/edit/edit.wxml
  5. +28
    -13
      pages/edit/edit.wxss
  6. +100
    -29
      pages/setUserInfo/index.js
  7. +91
    -6
      pages/setUserInfo/index.wxml
  8. +23
    -9
      pages/setUserInfo/index.wxss

BIN
assets/images/next.png View File

Before After
Width: 200  |  Height: 200  |  Size: 2.5 KiB

+ 10
- 13
ext.json View File

@@ -1,14 +1,7 @@
{
"ext": {
"attr": {
"car": {
"etcp": {
"etcpAppId": "wx192b7d2e8dcbefd0",
"etcpVersion": "release",
"etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback"
}
},
"mchId": "1604439800",
"mchId": "1602801645",
"imgProxy": [
{
"newUrl": "https://ctest.malls.iformall.com/img",
@@ -24,12 +17,16 @@
}
],
"configUrl": "https://ctest.malls.iformall.com/C/api",
"etcpAppId": "wx219a81b9c87aa4f7",
"etcpVersion": "release",
"businessSwitch": "1",
"businessVersion": "1",
"etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback",
"ifHaveWebSocket": "0",
"ifHaveCarModular": "1"
},
"name": "金泸商务",
"weappId": "wx649b3be73c1afe47",
"name": "富茂光谷测试版",
"weappId": "wx219a81b9c87aa4f7",
"appVersion": "C.test.5.2.0"
},
"debug": false,
@@ -77,15 +74,15 @@
},
"plugins": {
"auto-points-plugin": {
"version": "1.3.0",
"version": "2.4.0",
"provider": "wxfab2bf944bfc4da6"
},
"live-player-plugin": {
"version": "1.3.4",
"version": "1.2.5",
"provider": "wx2b03c6e691cd7370"
}
},
"extAppid": "wx649b3be73c1afe47",
"extAppid": "wx219a81b9c87aa4f7",
"extEnable": true,
"permission": {
"scope.userLocation": {


+ 6
- 6
pages/edit/edit.js View File

@@ -3,8 +3,8 @@ const util = require("../../utils/util.js");
const Http = require("../../utils/HttpBasics");
const config = require("../../config/config");
const imgurl = require("../../utils/imgurl");
Page({

Page({
/**
* 页面的初始数据
*/
@@ -107,7 +107,7 @@ Page({
var birthdate = null;
}
// if (username == null || address == null || sex == 0 || birthdate == null) {
// wx.showToast({
// wx.showToast({chidName
// title: '请输入完整的用户信息',
// icon: "none"
// })
@@ -118,7 +118,7 @@ Page({
tmeparr.map(item => {
item.birthdate = new Date(item.birthdate).getTime()
})
console.log(that.data.childArr)
return
Http.post({
url: config.api.updateInfo,
data: {
@@ -177,10 +177,10 @@ Page({
},
chidName(e) {
let index = e.currentTarget.dataset.index
let tmpeObj = this.data.childArr
tmpeObj[index].name = e.detail.value
let tempObj = this.data.childArr
tempObj[index].name = e.detail.value
this.setData({
childArr: tmpeObj
childArr: tempObj
})
},
childDel(e) {


+ 5
- 5
pages/edit/edit.wxml View File

@@ -13,16 +13,16 @@
<input wx:if="{{flag==1}}" class='input' placeholder='请输入生日' disabled />
<view wx:if="{{flag==2}}" class="picker"> {{date}}</view>
</picker>
<image class="rArrow" src="{{chevronUrl}}" mode='widthFix'></image>
<!-- <image class="rArrow" src="{{chevronUrl}}" mode='widthFix'></image> -->
</view>
<view class='section'>
<text>身高</text>
<input wx:if="{{height}}" name="height" type="text" placeholder='请填写身高单位cm' placeholder='{{height}}' />
<input wx:if="{{height}}" name="height" type="text" placeholder='请填写身高单位cm' placeholder='{{height}}cm' />
<input wx:if="{{!height}}" name="height" type="text" placeholder='请填写身高单位cm' />
</view>
<view class='section'>
<text>体重</text>
<input wx:if="{{weight}}" name="weight" type="text" placeholder='请填写体重单位kg' placeholder='{{weight}}' />
<input wx:if="{{weight}}" name="weight" type="text" placeholder='请填写体重单位kg' placeholder='{{weight}}kg' />
<input wx:if="{{!weight}}" name="weight" type="text" placeholder='请填写体重单位kg' />
</view>
<view class="section section_gap">
@@ -38,7 +38,7 @@
<text>住址</text>
<view class='names' wx:if="{{address}}">{{address}}</view>
<view class='names' wx:if="{{!address}}">请选择地址</view>
<image class="rArrow" src="{{chevronUrl}}" mode='widthFix'></image>
<!-- <image class="rArrow" src="{{chevronUrl}}" mode='widthFix'></image> -->
</view>
</view>

@@ -50,7 +50,7 @@
<view class='contBox_section'>
<text>姓名</text>
<input wx:if="{{item.name}}" type="text" placeholder='{{item.name}}' bindinput="chidName" data-index="{{index}}" />
<input wx:if="{{!item.name}}" type="text" placeholder='请填写名字' bindinput="chidName" data-index="{{index}}" />
<input wx:if="{{!item.name}}" type="text" placeholder='请输入' bindinput="chidName" data-index="{{index}}" />
</view>

<view class="contBox_section sec">


+ 28
- 13
pages/edit/edit.wxss View File

@@ -8,7 +8,7 @@
}

input {
/* width:500rpx; */
width: 120rpx;
display: inline-block;
font-size: 32rpx;
vertical-align: middle;
@@ -20,29 +20,38 @@ input {
}

.section {
display: flex;
justify-content: space-between;
align-items: center;
width: 710rpx;
height: 100rpx;
line-height: 100rpx;
width: 710rpx;
margin: 0 auto;
border-bottom: 1px solid #eee;
text-align: right;
margin: 0;
}

.address {
display: flex;
justify-content: space-between;
width: 710rpx;
margin: 0 auto;
border-bottom: 1px solid #eee;
height: 100rpx;
text-align: right;
margin-top: 25rpx;
/* border-bottom: 1px solid #eee; */
padding-bottom: 10rpx;
}

.radio {
/* .radio {
margin-right: 30rpx;
}
} */

.section__title, .picker, picker {
.section__title,
.picker,
picker {
display: inline-block;
font-size: 32rpx;
color: #999;
width: 500rpx;
width: 200rpx;
}

radio {
@@ -53,13 +62,13 @@ radio {
color: #999;
}

.section > text:nth-of-type(1) {
.section>text:nth-of-type(1) {
font-size: 32rpx;
display: inline-block;
padding: 0 20rpx;
}

.address > text:nth-of-type(1) {
.address>text:nth-of-type(1) {
font-size: 32rpx;
display: inline-block;
/* margin-right: 20rpx; */
@@ -115,12 +124,14 @@ radio {
.child_box {
margin: 20rpx;
overflow: hidden;
border-radius: 30rpx;
}

.contBox {
float: left;
width: 80%;
background-color: #fff;
border-radius: 30rpx;
}

.contBox_section {
@@ -131,6 +142,10 @@ radio {
border-bottom: 1px solid #eee;
}

.contBox_section input {
width: 200rpx;
}

.contBox_section text {
margin: 0 20rpx;
}
@@ -152,4 +167,4 @@ radio {
text-align: center;
margin-top: 100rpx;
margin-left: 2%;
}
}

+ 100
- 29
pages/setUserInfo/index.js View File

@@ -1,5 +1,6 @@
let app = getApp();
const Http = require("../../utils/HttpBasics");
const util = require("../../utils/util.js");
const bgColor = require("../../utils/bgColor.js")
const config = require("../../config/config");
const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
@@ -13,8 +14,17 @@ Page({
navigationBarHeight,
avatarUrl: defaultAvatarUrl,
nickName: '',
username: '',
theme: wx.getSystemInfoSync().theme,
typeLsit: {},
date: '1988-03-12',
dateEnd: '',
dateFlag: 1,
gender: '',
sexArry: ['男', '女'],
sexFlag: 1,
height: '',
weight: ''
},

/**
@@ -40,15 +50,93 @@ Page({
})
},

getNickName(e) {
getUserInfo(token) {
let that = this;
Http.get({
url: config.api.getScore,
data: {
token: token
}
}).then(res => {
console.log(res, 'res');
this.setData({
avatarUrl: res.data.avatarUrl,
nickName: res.data.nickName,
username: res.data.name,
gender: res.data.sex,
sexFlag: 2,
date: util.fmtDate(parseInt(res.data.birthdate)),
dateFlag: 2,
height: res.data.height,
weight: res.data.weight,
})
}).catch(err => {
console.log(err, 'err');
})
},

bindDateChange(e) {
this.setData({
date: e.detail.value,
dateFlag: 2
})
},

bindGenderChange(e) {
this.setData({
gender: e.detail.value,
sexFlag: 2
})
},

address() {
let that = this;
wx.chooseLocation({
success: function (res) {
that.setData({
address: res.name + '(' + res.address + ')',
addressStr: JSON.stringify(res)
})
},
fail: function (error) {
console.log(error)
},
complete: function (data) {
}
})
},

goSetChildren() {
wx.navigateTo({
url: '/pages/edit/edit?type=1"',
})
},

goSetAdress() {
wx.navigateTo({
url: '/pages/siteUser/siteUser"',
})
},

formSubmit(e) {
const that = this

let birthdate = null
if (that.data.dateFlag == 2 && that.data.date) {
birthdate = new Date(that.data.date).getTime();
}

const data = {
avatarUrl: this.data.avatarUrl,
nickName: e.detail.value.nickname
avatarUrl: that.data.avatarUrl,
nickName: e.detail.value.nickname,
name: e.detail.value.username,
sex: that.data.gender,
birthdate: birthdate,
height: e.detail.value.height ? e.detail.value.height : that.data.height,
weight: e.detail.value.weight ? e.detail.value.weight : that.data.weight,
address: that.data.addressStr || null,
}
console.log(data, 'data');
if (data.nickName) {
Http.post({
url: "/user/updateUserInfo",
@@ -56,9 +144,10 @@ Page({
}).then(res => {
if (res.code == 200) {
wx.showToast({
title: '更改成功',
icon: 'success',
duration: 2000
title: "信息提交成功,将在3分钟内生效",
icon: 'none',
duration: 2000,
mask: false
})
setTimeout(() => {
wx.navigateBack()
@@ -76,24 +165,6 @@ Page({
}
},

getUserInfo(token) {
let that = this;
Http.get({
url: config.api.getScore,
data: {
token: token
}
}).then(res => {
console.log(res, 'res');
this.setData({
avatarUrl: res.data.avatarUrl,
nickName: res.data.nickName
})
}).catch(err => {
console.log(err, 'err');
})
},

/**
* 生命周期函数--监听页面加载
*/
@@ -101,12 +172,12 @@ Page({
if (app.globalData.token) {
this.getUserInfo(app.globalData.token)
}
this.getType(),
wx.onThemeChange((result) => {
this.setData({
theme: result.theme
})
this.getType()
wx.onThemeChange((result) => {
this.setData({
theme: result.theme
})
})
},

/**


+ 91
- 6
pages/setUserInfo/index.wxml View File

@@ -3,14 +3,99 @@
<view style="height:{{navigationBarHeight}} "></view>
<view class="container">
<view class="avatar">
<text>头像</text>
<button class="avatarBtn" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
<image class="avatarCover" src="{{avatarUrl}}"></image>
</button>
<text>我的头像</text>
<view class="right">
<button class="avatarBtn" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
<image class="avatarCover" src="{{avatarUrl}}"></image>
</button>
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<form bindsubmit="formSubmit" class="form">
<text class="nickName">昵称</text>
<input type="nickname" name='nickname' class="input" placeholder="请输入昵称" value='{{nickName}}' />
<view class="item">
<text>微信昵称</text>
<view class="right">
<input type="nickname" name='nickname' class="input" placeholder="请输入昵称" value='{{nickName}}' />
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<view class="item">
<text>真实姓名</text>
<view class="right">
<input name='username' class="input" placeholder="请输入姓名" value='{{username}}' />
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<view class="item">
<text>性别</text>
<view class="right">
<picker range="{{sexArry}}" value="{{gender}}" bindchange="bindGenderChange">
<view wx:if="{{sexFlag==1}}" class="input greyFont">
请选择性别
</view>
<view wx:if="{{sexFlag==2}}" class="input">
{{sexArry[gender]}}
</view>
</picker>
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<view class="item">
<text>出生年月</text>
<view class="right">
<picker mode="date" value="{{date}}" start="1930-09-01" end="{{dateEnd}}" bindchange="bindDateChange">
<input wx:if="{{dateFlag==1}}" class='input' placeholder='请选择生日' disabled />
<view wx:if="{{dateFlag==2}}" class="input">{{date}}</view>
</picker>
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<view class="item">
<text>身高</text>
<view class="right">
<input name='height' class="input" placeholder="请输入身高" value='{{height}}' />
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<view class="item">
<text>体重</text>
<view class="right">
<input name='weight' class="input" placeholder="请输入体重" value='{{weight}}' />
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<view class='item' bindtap='address'>
<text>家庭住址</text>
<view class="right">
<view class='input' wx:if="{{address}}">{{address}}</view>
<view class='input greyFont' wx:if="{{!address}}">请选择地址</view>
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<view class='item' bindtap="goSetChildren">
<text>我的子女信息</text>
<view class="right">
<view class="input greyFont">前往设置</view>
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<view class='item' bindtap="goSetAdress">
<text>收货地址</text>
<view class="right">
<view class="input greyFont">前往设置</view>
<image class="next" src="/assets/images/next.png"></image>
</view>
</view>

<button class="submit" type="primary" form-type='submit'>确定</button>
</form>
</view>

+ 23
- 9
pages/setUserInfo/index.wxss View File

@@ -5,6 +5,13 @@
padding: 0 40rpx 0 40rpx;
}

.next {
float: right;
width: 35rpx;
height: 35rpx;
margin-left: 20rpx;
}

.avatar {
display: flex;
justify-content: space-between;
@@ -12,6 +19,11 @@
margin-bottom: 50rpx;
}

.right {
display: flex;
align-items: center;
}

.avatarBtn {
width: 100rpx;
height: 100rpx;
@@ -26,20 +38,22 @@
height: 100%;
}

.form {
position: relative;
}

.nickName {
position: absolute;
top: 18rpx;
width: 60rpx;
.item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 65rpx;
}

.input {
text-align: right;
padding-left: 20rpx;
height: 70rpx;
width: 400rpx;
line-height: 70rpx;
}

.greyFont {
color: #888888;
}

.submit {


Loading…
Cancel
Save