Browse Source

个人信息 街道修改

master
chenteng 5 years ago
parent
commit
d711edc33e
  1. 2
      models/user.js
  2. 38
      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, avatar: data.avatarUrl,
realName: data.nickName, realName: data.nickName,
// phone: data.phone,//注释此行,submit无法更新phone // phone: data.phone,//注释此行,submit无法更新phone
departId:data.streetsIndex, departId:data.streetsID,
age:data.age, age:data.age,
gender:data.genderIndex, gender:data.genderIndex,
company: data.company, company: data.company,

38
pages/user/myInfo/index.js

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

25
pages/user/myInfo/index.wxml

@ -14,23 +14,15 @@
title="姓名" bindtap="onTapItem" title="姓名" bindtap="onTapItem"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{nikeName}}</view> --> <!-- <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>
<mp-cell link="true" <mp-cell link="true"
data-type="userPhone" data-type="userPhone"
title="手机号" bindtap="onTapPhone" title="手机号" bindtap="onTapPhone"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> --> <!-- <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>
<!-- 新加的 所在街道 年龄 性别 --> <!-- 新加的 所在街道 年龄 性别 -->
<mp-cell link="true" <mp-cell link="true"
data-type="userStreet" data-type="userStreet"
@ -50,13 +42,12 @@
</view> </view>
</picker> </picker>
</mp-cell> </mp-cell>
<!-- 上面的数据不能修改 -->
<mp-cell link="true" <mp-cell link="true"
bindtap="onTapItem" data-type="userAge" bindtap="onTapItem" data-type="userAge"
title="年龄" title="年龄"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> --> <!-- <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>
<!-- 下面是选择框 --> <!-- 下面是选择框 -->
<mp-cell link="true" <mp-cell link="true"
@ -81,14 +72,14 @@
title="工作单位" title="工作单位"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{company}}</view> --> <!-- <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>
<mp-cell link="true" <mp-cell link="true"
bindtap="onTapItem" data-type="position" bindtap="onTapItem" data-type="position"
title="职务" title="职务"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{position}}</view> --> <!-- <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> </mp-cell>
<!-- 新加的 学历 职称 人才称号 获得奖项(荣誉) --> <!-- 新加的 学历 职称 人才称号 获得奖项(荣誉) -->
<!-- 下面是选择框 --> <!-- 下面是选择框 -->
@ -117,21 +108,21 @@
title="职称" title="职称"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> --> <!-- <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>
<mp-cell link="true" <mp-cell link="true"
bindtap="onTapItem" data-type="userTalentTitle" bindtap="onTapItem" data-type="userTalentTitle"
title="人才称号" title="人才称号"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> --> <!-- <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>
<mp-cell link="true" <mp-cell link="true"
bindtap="onTapItem" data-type="userPrize" bindtap="onTapItem" data-type="userPrize"
title="获得奖项(荣誉)" title="获得奖项(荣誉)"
ext-class="cell-item"> ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> --> <!-- <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> </mp-cell>
</view> </view>
<view class="btnView" style="z-index:100;"> <view class="btnView" style="z-index:100;">

Loading…
Cancel
Save