Browse Source

个人信息 街道修改

master
chenteng 5 years ago
parent
commit
d711edc33e
  1. 2
      models/user.js
  2. 40
      pages/user/myInfo/index.js
  3. 25
      pages/user/myInfo/index.wxml

2
models/user.js

@ -43,7 +43,7 @@ class UserModel extends HTTP {
avatar: data.avatarUrl,
realName: data.nickName,
// phone: data.phone,//注释此行,submit无法更新phone
departId:data.streetsIndex,
departId:data.streetsID,
age:data.age,
gender:data.genderIndex,
company: data.company,

40
pages/user/myInfo/index.js

@ -19,6 +19,7 @@ Page({
position: String,
streets:[],
streetsIndex:Number,
streetsID:String,
age:String,
gender:['','男','女'],
genderIndex:Number,
@ -41,7 +42,6 @@ Page({
this.setData({ close: false });
},
vantConfirm(){
this.setData({
realData:this.data.tempData
})
@ -104,7 +104,7 @@ Page({
phone: options.userPhone || '',
company: options.company || '',
position: options.position || '',
streetsIndex:options.street || '',
streetsID:options.street || '',//得到streetsID的值
age:options.age || '',
genderIndex:options.genderIndex || '',
educationIndex:options.education || '',
@ -119,12 +119,14 @@ Page({
streett[index] = value.departName
})
streett.unshift('')
// console.log(streett)
this.setData({
streets: streett
streets: streett//得到street列表
})
resultss.forEach((value,index)=>{
if(value.id == this.data.streetsID){
return this.setData({streetsIndex: index+1})
}
})
// console.log("查看data里streets的值");
// console.log(this.data.streetsIndex);
})
},
@ -175,11 +177,11 @@ Page({
}
})
},
bindNickNameInput(e){
this.setData({
nickName:e.detail.value
})
},
// bindNickNameInput(e){
// this.setData({
// nickName:e.detail.value
// })
// },
// bindPhoneInput(e) {
// this.setData({
// phone: e.detail.value
@ -206,8 +208,14 @@ Page({
})
},
bindstreetChange:function(e){
this.setData({
streetsIndex:e.detail.value
// console.log("bindstreetChange");
// console.log(e.detail.value);
var i = e.detail.value-1
topicModel.getStreetList(res=>{
this.setData({
streetsIndex:e.detail.value,
streetsID:res.result[i].id
})
})
},
onTapPhone:function(){
@ -216,15 +224,15 @@ Page({
})
},
submit(){
console.log("submit");
console.log(this.data);
// console.log("submit");
// console.log(this.data);
userModel.updateUserInfo(this.data, res => {
if(res.code === 200){
store.saveUserInfo({
nickName: this.data.nickName,
avatarUrl: this.data.avatarUrl,
phone: this.data.phone || '',
departId:this.data.streetsIndex,
departId:this.data.streetsID,
age:this.data.age,
gender:this.data.genderIndex,
company:this.data.company,

25
pages/user/myInfo/index.wxml

@ -14,23 +14,15 @@
title="姓名" bindtap="onTapItem"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{nikeName}}</view> -->
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="120" bindinput="bindNickNameInput" value="{{nickName}}" disabled placeholder="请输入"></input>
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="120" value="{{nickName}}" disabled placeholder="请输入"></input>
</mp-cell>
<mp-cell link="true"
data-type="userPhone"
title="手机号" bindtap="onTapPhone"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" bindinput="bindPhoneInput" value="{{phone}}" disabled placeholder="请输入"></input>
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" value="{{phone}}" disabled placeholder="请输入"></input>
</mp-cell>
<!-- 新加的 所在街道 年龄 性别 -->
<mp-cell link="true"
data-type="userStreet"
@ -50,13 +42,12 @@
</view>
</picker>
</mp-cell>
<!-- 上面的数据不能修改 -->
<mp-cell link="true"
bindtap="onTapItem" data-type="userAge"
title="年龄"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" bindinput="bindAgeInput" value="{{age}}" disabled placeholder="请输入"></input>
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" value="{{age}}" disabled placeholder="请输入"></input>
</mp-cell>
<!-- 下面是选择框 -->
<mp-cell link="true"
@ -81,14 +72,14 @@
title="工作单位"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{company}}</view> -->
<input slot="footer" class="footer_input_phone" style="text-align:right;" maxlength="45" bindinput="bindCompanyInput" value="{{company}}" disabled placeholder="请输入"></input>
<input slot="footer" class="footer_input_phone" style="text-align:right;" maxlength="45" value="{{company}}" disabled placeholder="请输入"></input>
</mp-cell>
<mp-cell link="true"
bindtap="onTapItem" data-type="position"
title="职务"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{position}}</view> -->
<input slot="footer" class="footer_input_phone"style="text-align:right;" maxlength="45" bindinput="bindPositionInput" value="{{position}}" disabled placeholder="请输入"></input>
<input slot="footer" class="footer_input_phone"style="text-align:right;" maxlength="45" value="{{position}}" disabled placeholder="请输入"></input>
</mp-cell>
<!-- 新加的 学历 职称 人才称号 获得奖项(荣誉) -->
<!-- 下面是选择框 -->
@ -117,21 +108,21 @@
title="职称"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<input slot="footer" class="footer_input_phone" maxlength="45" bindinput="bindProfessionalTitleInput" value="{{professionalTitle}}" disabled placeholder="请输入" style="text-align:right;"></input>
<input slot="footer" class="footer_input_phone" maxlength="45" value="{{professionalTitle}}" disabled placeholder="请输入" style="text-align:right;"></input>
</mp-cell>
<mp-cell link="true"
bindtap="onTapItem" data-type="userTalentTitle"
title="人才称号"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" bindinput="bindTalentTitleInput" value="{{talentTitle}}" disabled placeholder="请输入"></input>
<input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" value="{{talentTitle}}" disabled placeholder="请输入"></input>
</mp-cell>
<mp-cell link="true"
bindtap="onTapItem" data-type="userPrize"
title="获得奖项(荣誉)"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<input slot="footer" class="footer_input_phone" style="text-align:right;" maxlength="45" bindinput="bindPrizeInput" value="{{prize}}" disabled placeholder="请输入"></input>
<input slot="footer" class="footer_input_phone" style="text-align:right;" maxlength="45" value="{{prize}}" disabled placeholder="请输入"></input>
</mp-cell>
</view>
<view class="btnView" style="z-index:100;">

Loading…
Cancel
Save