diff --git a/models/user.js b/models/user.js
index 49b4680..0d9aa52 100644
--- a/models/user.js
+++ b/models/user.js
@@ -26,20 +26,24 @@ class UserModel extends HTTP {
}
- updateUserInfo(avatarUrl, nickName, success){
+ updateUserInfo(data, success){
let params = {
url: UserConst.user_updateUserInfo_url,
method: Method.POST,
data: {
isRegister: 2, //1.注册 2.修改用户信息
- avatar: avatarUrl,
- realName: nickName,
+ avatar: data.avatarUrl,
+ realName: data.nickName,
+ phone: data.phone,
+ company: data.company,
+ position: data.position
},
success: success
}
this.request(params)
}
+
getMyMessageList(page, success){
let params = {
url: UserConst.user_myMessage_url,
diff --git a/pages/user/myInfo/index.js b/pages/user/myInfo/index.js
index becffa6..6026688 100644
--- a/pages/user/myInfo/index.js
+++ b/pages/user/myInfo/index.js
@@ -10,7 +10,7 @@ Page({
*/
data: {
avatarUrl:String,
- nikeName: String,
+ nickName: String,
phone: String,
company: String,
position: String,
@@ -23,7 +23,7 @@ Page({
console.log(options)
this.setData({
avatarUrl: options.userIcon,
- nikeName: options.userName,
+ nickName: options.userName,
phone: options.userPhone || '',
company: options.company || '',
position: options.position || '',
@@ -32,9 +32,9 @@ Page({
onTapItem(e) {
const { type } = e.currentTarget.dataset
console.log(type)
- // if(type === 'userIcon'){
- // this.upload()
- // }
+ if(type === 'userIcon'){
+ this.upload()
+ }
},
upload(){
let that = this
@@ -69,34 +69,16 @@ Page({
}
})
},
- getUserInfo(){
- userModel.getUserInfo(res => {
- let nickName = res.result.nickName
- let avatarUrl = res.result.avatarUrl
- this.setData({
- avatarUrl: res.result.avatarUrl,
- nikeName: res.result.nickName,
- phone: res.result.phone || '',
- company: res.result.company || '',
- position: res.result.position || '',
- })
- store.saveUserInfo({
- nickName: res.result.nickName,
- avatarUrl: res.result.avatarUrl,
- phone: res.result.phone || ''
- })
- })
- },
- bindNikeNameInput(e){
+ bindNickNameInput(e){
this.setData({
- nikeName:e.detail.value
- })
- },
- bindPhoneInput(e) {
- this.setData({
- phone: e.detail.value
+ nickName:e.detail.value
})
},
+ // bindPhoneInput(e) {
+ // this.setData({
+ // phone: e.detail.value
+ // })
+ // },
bindCompanyInput(e) {
this.setData({
company: e.detail.value
@@ -108,15 +90,13 @@ Page({
})
},
submit(){
- let avatarUrl = this.data.avatarUrl
- let nikeName = this.data.nikeName
- let phone = this.data.phone
- let company = this.data.company
- let position = this.data.position
-
- userModel.updateUserInfo(avatarUrl, nikeName, phone, company, position, res => {
- // that.getUserInfo()
+ userModel.updateUserInfo(this.data, res => {
if(res.code === 200){
+ store.saveUserInfo({
+ nickName: this.data.nickName,
+ avatarUrl: this.data.avatarUrl,
+ phone: this.data.phone || ''
+ })
wx.showToast({
title: '修改成功',
icon: 'none',
diff --git a/pages/user/myInfo/index.wxml b/pages/user/myInfo/index.wxml
index 571a821..5bb46cb 100644
--- a/pages/user/myInfo/index.wxml
+++ b/pages/user/myInfo/index.wxml
@@ -4,6 +4,7 @@
@@ -11,32 +12,32 @@
bindtap="onTapItem" data-type="userName"
title="名字"
ext-class="cell-item">
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
diff --git a/pages/user/myInfo/index.wxss b/pages/user/myInfo/index.wxss
index c1af3ba..84b4e1f 100644
--- a/pages/user/myInfo/index.wxss
+++ b/pages/user/myInfo/index.wxss
@@ -59,11 +59,23 @@
padding: 0 10px 0 0;
}
.footer_input{
+ padding: 0 5px;
font-size: 14px;
border: 1px solid #AAAAAA;
border-radius: 4px;
height: 30px;
text-align: left;
+ color: #3B3B3B;
+}
+.footer_input_phone{
+ padding: 0 5px;
+ font-size: 14px;
+ border: 1px solid #AAAAAA;
+ border-radius: 4px;
+ height: 30px;
+ text-align: left;
+ color: #3B3B3B;
+ background-color: #f7f7f7;
}
.msg_footer{
font-size: 14px;