Browse Source

个人信息

master
chenteng 5 years ago
parent
commit
6622bbc58d
  1. 9
      models/user.js
  2. 53
      pages/topics/talents/index.js
  3. 19
      pages/topics/talents/index.wxml
  4. 4
      pages/topics/talents/index.wxss
  5. 9
      pages/user/index.js
  6. 137
      pages/user/myInfo/index.js
  7. 3
      pages/user/myInfo/index.json
  8. 173
      pages/user/myInfo/index.wxml
  9. 37
      pages/user/myInfo/index.wxss
  10. 2
      pages/user/myWhistle/index.js
  11. 5
      pages/user/myWhistle/whistleDetail/index.js

9
models/user.js

@ -41,8 +41,15 @@ class UserModel extends HTTP {
avatar: data.avatarUrl, avatar: data.avatarUrl,
realName: data.nickName, realName: data.nickName,
phone: data.phone, phone: data.phone,
departId:data.street,
age:data.age,
gender:data.genderIndex,
company: data.company, company: data.company,
position: data.position position: data.position,
education:data.educationIndex,
title:data.professionalTitle,
designation:data.talentTitle,
honor:data.prize
}, },
success: success success: success
} }

53
pages/topics/talents/index.js

@ -136,14 +136,6 @@ Component({
}, },
submit() { submit() {
// if (this.data.messageTitle === '') {
// wx.showModal({
// title: '提示',
// content: '请输入标题',
// showCancel: false
// })
// return
// }
if (this.data.messageDetail === ''){ if (this.data.messageDetail === ''){
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
@ -161,33 +153,16 @@ Component({
}) })
return return
} }
//仿照这个方法添加文本,图片,街道
// topicModel.addMessage(this.data.messageTitle, this.data.messageDetail,this.data.files,res=>{
// if(res.code === 200){
// this.setData({
// messageTitle:'',
// messageDetail: '',
// files:[],
// },()=>{
// wx.showToast({
// title: res.message,
// icon: 'none'
// })
// })
// }
// })
topicModel.addTalents(this.data.messageDetail, this.data.files,this.data.streetID,res=>{ topicModel.addTalents(this.data.messageDetail, this.data.files,this.data.streetID,res=>{
const id = res.result;
console.log("得到id值");
console.log(id);
if(res.code === 200){ if(res.code === 200){
this.setData({ this.setData({
messageDetail: '', messageDetail: '',
streetID:'', streetID:'',
files:[], files:[],
},()=>{ },()=>{
// wx.showToast({
// title: res.message,
// icon: 'none'
// })
wx.showModal({ wx.showModal({
title: '提交成功', title: '提交成功',
content: '问题已收到,我们会尽快给您答复的!', content: '问题已收到,我们会尽快给您答复的!',
@ -196,22 +171,24 @@ Component({
success (res) { success (res) {
if (res.confirm) { if (res.confirm) {
console.log('用户点击查看进度') console.log('用户点击查看进度')
console.log(res)
// 查看进度怎么填呀?? // 查看进度怎么填呀??
// wx.navigateTo({
// url: `/pages/article/index?id=${id}`,
// })
//不用wx.navigateTo,改用wx.redirectTo(url: 'test?id=1'})
//浩然会给我一个接口返回id值
console.log('talent的id')
console.log(id);
wx.redirectTo({
// url: '../../user/myWhistle/whistleDetail/index?id=${id}',
url: '/pages/user/myWhistle/whistleDetail/index?id='+id,
})
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击知道了') console.log('用户点击知道了')
} }
} }
}) })
}) })
} }
}) })

19
pages/topics/talents/index.wxml

@ -1,23 +1,5 @@
<!--pages/topics/common/message/index.wxml--> <!--pages/topics/common/message/index.wxml-->
<view class="container"> <view class="container">
<!-- <view class="item">
<view class="must_fill">*</view>
<input class="title" maxlength="95" value="{{messageTitle}}" bindinput="bindTextInput" placeholder="请输入标题"></input>
</view> -->
<!-- <view class="line-view"></view>
<view class="item">
<view class="must_fill">*</view>
<textarea class="textArea" maxlength="1000" value="{{messageDetail}}" bindinput="bindTextAreaInput" placeholder="请描述您的问题" />
</view>
<mp-cells ext-class="uploader_msg_bd">
<mp-cell>
<mp-uploader ext-class="myUploader" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" max-count="9" delete="true"></mp-uploader>
</mp-cell>
</mp-cells> -->
<!-- 线 --> <!-- 线 -->
<view class="line-view"></view> <view class="line-view"></view>
<!-- 请描述您的问题加上传图片 --> <!-- 请描述您的问题加上传图片 -->
@ -28,7 +10,6 @@
</view> </view>
<!-- 添加图片 --> <!-- 添加图片 -->
<view> <view>
<!-- <mp-uploader max-count="9" delete="true" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" select="{{selectFile}}" ></mp-uploader> -->
<mp-uploader ext-class="myUploader" delete="true" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" select="{{selectFile}}" max-count="9" title=""></mp-uploader> <mp-uploader ext-class="myUploader" delete="true" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" select="{{selectFile}}" max-count="9" title=""></mp-uploader>
</view> </view>
</view> </view>

4
pages/topics/talents/index.wxss

@ -1,4 +1,4 @@
/* pages/topics/common/message/index.wxss */ /* pages/topics/talent/message/index.wxss */
@import '../../../style/font.wxss'; @import '../../../style/font.wxss';
.container{ .container{
padding: 0px 20px; padding: 0px 20px;
@ -77,6 +77,8 @@
} }
.select-view{ .select-view{
display: flex; display: flex;
/* btnView是position:fix,所以为防止遮挡,设置街道选择盒子下边框margin-bottom为100px */
margin-bottom: 100px;
} }
.select-mark{ .select-mark{
width:15px; width:15px;

9
pages/user/index.js

@ -27,6 +27,8 @@ Page({
}, },
onShow: function () { onShow: function () {
if (store.hasBindUserInfo()) { if (store.hasBindUserInfo()) {
console.log("onshow");
this.getUserInfo() this.getUserInfo()
this.setData({ this.setData({
isAuth: true isAuth: true
@ -44,6 +46,8 @@ Page({
// 获取用户信息 // 获取用户信息
getUserInfo () { getUserInfo () {
userModel.getUserInfo(res => { userModel.getUserInfo(res => {
console.log("getUserInfo");
console.log(res) console.log(res)
let nickName = res.result.nickName let nickName = res.result.nickName
let avatarUrl = res.result.avatarUrl let avatarUrl = res.result.avatarUrl
@ -100,11 +104,12 @@ Page({
// cell点击 // cell点击
onTapItem (e) { onTapItem (e) {
const { type } = e.currentTarget.dataset const { type } = e.currentTarget.dataset
//console.log(type) console.log(type)
if(this.data.isAuth){ if(this.data.isAuth){
if (type === 'myInfo') { if (type === 'myInfo') {
wx.navigateTo({ wx.navigateTo({
url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`, url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}&street=${this.data.userInfo.departId || ''}&age=${this.data.userInfo.age || ''}&genderIndex=${this.data.userInfo.gender || ''}&education=${this.data.userInfo.education || ''}&professionalTitle=${this.data.userInfo.title || ''}&talentTitle=${this.data.userInfo.designation || ''}&prize=${this.data.userInfo.honor || ''}`,
}) })
} else { } else {
wx.navigateTo({ wx.navigateTo({

137
pages/user/myInfo/index.js

@ -14,12 +14,98 @@ Page({
phone: String, phone: String,
company: String, company: String,
position: String, position: String,
street:String,
age:String,
gender:['','男','女'],
genderIndex:Number,
educationIndex:Number,
education:['','高中','专科','本科','硕士','博士'],
professionalTitle:String,
talentTitle:String,
prize:String,
show: false,
tempData:String,
realData:String,
type:String,
value:String,
},
getUserInfo(event) {
console.log(event.detail);
},
onClose() {
this.setData({ close: false });
},
vantConfirm(){
console.log("vant confirm");
this.setData({
realData:this.data.tempData
})
console.log(this.data.realData);
if(this.data.type === 'userName'){
this.setData({
nickName:this.data.realData
})
}
if(this.data.type === 'userPhone'){
this.setData({
phone:this.data.realData
})
}
if(this.data.type === 'userStreet'){
this.setData({
street:this.data.realData
})
}
if(this.data.type === 'userAge'){
this.setData({
age:this.data.realData
})
}
if(this.data.type === 'workUnit'){
this.setData({
workUnit:this.data.realData
})
}
if(this.data.type === 'position'){
this.setData({
position:this.data.realData
})
}
if(this.data.type === 'workUnit'){
this.setData({
company:this.data.realData
})
}
if(this.data.type === 'userProfessionalTitle'){
this.setData({
professionalTitle:this.data.realData
})
}
if(this.data.type === 'userTalentTitle'){
this.setData({
talentTitle:this.data.realData
})
}
if(this.data.type === 'userPrize'){
this.setData({
prize:this.data.realData
})
}
this.setData({
value:''
})
},
tempData: function(e){
this.setData({
tempData:e.detail.value
})
}, },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) { onLoad: function (options) {
console.log("index.js");
console.log(options) console.log(options)
this.setData({ this.setData({
avatarUrl: options.userIcon, avatarUrl: options.userIcon,
@ -27,18 +113,34 @@ Page({
phone: options.userPhone || '', phone: options.userPhone || '',
company: options.company || '', company: options.company || '',
position: options.position || '', position: options.position || '',
street:options.street || '',
age:options.age || '',
genderIndex:options.genderIndex || '',
educationIndex:options.education || '',
professionalTitle:options.professionalTitle || '',
talentTitle:options.talentTitle || '',
prize:options.prize || '',
}) })
}, },
//性别和学历有专门的bind方法。此方法修改年龄,工作单位,职务,职称等
onTapItem(e) { onTapItem(e) {
const { type } = e.currentTarget.dataset const { type } = e.currentTarget.dataset
this.setData({
type:type
})
console.log(type) console.log(type)
//如果等于userIcon调用upload方法更新头像
if(type === 'userIcon'){ if(type === 'userIcon'){
this.upload() this.upload()
}else{
this.setData({
show:true
})
} }
}, },
upload(){ upload(){
let that = this let that = this
wx.chooseImage({ wx.chooseImage({
success(res) { success(res) {
wx.showLoading() wx.showLoading()
@ -89,13 +191,38 @@ Page({
// position: e.detail.value // position: e.detail.value
// }) // })
// }, // },
bindGenderChange: function(e) {
console.log("bindGenderChange");
console.log(e);
this.setData({
genderIndex:e.detail.value
})
console.log(this.data.genderIndex);
},
bindEducationChange:function(e){
this.setData({
educationIndex:e.detail.value
})
console.log(this.data.educationIndex);
},
submit(){ submit(){
console.log("submit");
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.street,
age:this.data.age,
gender:this.data.genderIndex,//
company:this.data.company,
position:this.data.position,
education:this.data.educationIndex,//
title:this.data.professionalTitle,
designation:this.data.talentTitle,
honor:this.data.prize
}) })
wx.showToast({ wx.showToast({
title: '修改成功', title: '修改成功',

3
pages/user/myInfo/index.json

@ -3,6 +3,7 @@
"usingComponents": { "usingComponents": {
"e-ibutton": "/components/image-button/index", "e-ibutton": "/components/image-button/index",
"mp-cells": "/components/weui/cells/cells", "mp-cells": "/components/weui/cells/cells",
"mp-cell": "/components/weui/cell/cell" "mp-cell": "/components/weui/cell/cell",
"van-dialog": "/components/vant/dialog/index"
} }
} }

173
pages/user/myInfo/index.wxml

@ -1,43 +1,140 @@
<!--pages/user/myInfo/index.wxml--> <!--pages/user/myInfo/index.wxml-->
<view class="container"> <view class="container">
<mp-cells ext-class="page_bd"> <mp-cells ext-class="page_bd" >
<mp-cell <view class="cellAll">
bindtap="onTapItem" data-type="userIcon" <mp-cell
title="头像" bindtap="onTapItem" data-type="userIcon"
link="true" title="头像"
ext-class="cell-item"> link="true"
<image slot="footer" class="user_logo" src="{{avatarUrl}}" /> ext-class="cell-item">
</mp-cell> <image slot="footer" class="user_logo" src="{{avatarUrl}}" />
<mp-cell </mp-cell>
bindtap="onTapItem" data-type="userName" <mp-cell link="true"
title="名字" data-type="userName"
ext-class="cell-item"> title="姓名" bindtap="onTapItem"
<!-- <view slot="footer" class="msg_footer" >{{nikeName}}</view> --> ext-class="cell-item">
<input slot="footer" class="footer_input_phone" maxlength="120" bindinput="bindNickNameInput" value="{{nickName}}" disabled></input> <!-- <view slot="footer" class="msg_footer" >{{nikeName}}</view> -->
</mp-cell> <input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="120" bindinput="bindNickNameInput" value="{{nickName}}" disabled placeholder="请输入"></input>
<mp-cell </mp-cell>
bindtap="onTapItem" data-type="userPhone" <mp-cell link="true"
title="手机号" data-type="userPhone"
ext-class="cell-item"> title="手机号" bindtap="onTapItem"
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> --> ext-class="cell-item">
<input slot="footer" class="footer_input_phone" maxlength="45" bindinput="bindPhoneInput" value="{{phone}}" disabled></input> <!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
</mp-cell> <input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" bindinput="bindPhoneInput" value="{{phone}}" disabled placeholder="请输入"></input>
<mp-cell </mp-cell>
bindtap="onTapItem" data-type="workUnit" <!-- 新加的 所在街道 年龄 性别 -->
title="工作单位" <mp-cell link="true"
ext-class="cell-item"> data-type="userStreet"
<!-- <view slot="footer" class="msg_footer" >{{company}}</view> --> title="所在街道" bindtap="onTapItem"
<input slot="footer" class="footer_input_phone" maxlength="45" bindinput="bindCompanyInput" value="{{company}}" disabled></input> ext-class="cell-item">
</mp-cell> <!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<mp-cell <input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" bindinput="bindStreetInput" value="{{street}}" disabled placeholder=""></input>
bindtap="onTapItem" data-type="position" </mp-cell>
title="职务" <!-- 上面的数据不能修改 -->
ext-class="cell-item"> <mp-cell link="true"
<!-- <view slot="footer" class="msg_footer" >{{position}}</view> --> bindtap="onTapItem" data-type="userAge"
<input slot="footer" class="footer_input_phone" maxlength="45" bindinput="bindPositionInput" value="{{position}}" disabled></input> title="年龄"
</mp-cell> ext-class="cell-item">
<view class="btnView"> <!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<e-ibutton title="提交" bind:onTap="submit"/> <input slot="footer" style="text-align:right;" class="footer_input_phone" maxlength="45" bindinput="bindAgeInput" value="{{age}}" disabled placeholder="请输入"></input>
</mp-cell>
<!-- 下面是选择框 -->
<mp-cell link="true"
data-type="userGender"
title="性别"
ext-class="cell-item">
<picker slot="footer" class="footer_input_phone picker-view" range="{{gender}}" bindchange="bindGenderChange">
<view class="picker-block">
<block wx:if="{{genderIndex == 0}}" >
<view class="picker-if">
请选择
</view>
</block>
<block wx:else>
{{gender[genderIndex]}}
</block>
</view>
</picker>
</mp-cell>
<mp-cell link="true"
bindtap="onTapItem" data-type="workUnit"
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>
</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>
</mp-cell>
<!-- 新加的 学历 职称 人才称号 获得奖项(荣誉) -->
<!-- 下面是选择框 -->
<mp-cell link="true"
data-type="userEducation"
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="bindEducationInput" value="{{education}}" disabled placeholder="请选择"></input> -->
<picker slot="footer" class="footer_input_phone picker-view" style="text-align:right;" range="{{education}}" bindchange="bindEducationChange">
<view class="picker-block">
<block wx:if="{{educationIndex == 0}}" >
<view class="picker-if">
请选择
</view>
</block>
<block wx:else>
<!-- {{education[educationIndex]}} -->
{{education[educationIndex]}}
</block>
</view>
</picker>
</mp-cell>
<mp-cell link="true"
bindtap="onTapItem" data-type="userProfessionalTitle"
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>
</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>
</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>
</mp-cell>
</view>
<view class="btnView" style="z-index:100;">
<e-ibutton title="保存" bind:onTap="submit"/>
</view> </view>
</mp-cells> </mp-cells>
</view> </view>
<van-dialog
use-slot
title="编辑"
show="{{ show }}"
show-cancel-button
confirm-button-open-type="getUserInfo"
bind:close="onClose"
bind:getuserinfo="getUserInfo"
bind:confirm="vantConfirm"
>
<input placeholder="请输入修改后的内容" value="{{value}}" bindinput="tempData" class="diag_input"></input>
</van-dialog>

37
pages/user/myInfo/index.wxss

@ -1,4 +1,5 @@
/* pages/user/myInfo/index.wxss */ /* pages/user/myInfo/index.wxss */
@import '../../../style/font.wxss';
.container { .container {
background-color: #FAFAFA; background-color: #FAFAFA;
height: 100vh; height: 100vh;
@ -6,6 +7,10 @@
.page_hd { .page_hd {
border-bottom: 7px solid #f7f7f7; border-bottom: 7px solid #f7f7f7;
} }
/* btnView是position:fix,所以为防止遮挡,盒子下边框margin-bottom为100px */
.cellAll{
margin-bottom: 100px;
}
.page_hd .weui-cells:before { .page_hd .weui-cells:before {
border-top: 0px solid white; border-top: 0px solid white;
} }
@ -28,7 +33,7 @@
.user_logo { .user_logo {
width: 60px; width: 60px;
height: 60px; height: 60px;
border-radius: 5px; border-radius: 50%;
} }
.user_name { .user_name {
width: 400rpx; width: 400rpx;
@ -70,12 +75,14 @@
.footer_input_phone{ .footer_input_phone{
padding: 0 5px; padding: 0 5px;
font-size: 14px; font-size: 14px;
border: 1px solid #AAAAAA; /* border: 1px solid #AAAAAA; */
border-radius: 4px;
height: 30px; height: 30px;
text-align: left; text-align: left;
color: #3B3B3B; color: #3B3B3B;
background-color: #f7f7f7; }
.select-mark{
width:20px;
/* border:1px solid black; */
} }
.msg_footer{ .msg_footer{
font-size: 14px; font-size: 14px;
@ -87,4 +94,26 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
background-color: white;
}
.picker-view{
display: flex;
/*控制元素在主轴的对齐方式*/
justify-content: center;
/*控制默认的一行的对齐方式*/
align-items: center;
/* margin:0 0 0 50px; */
} }
.picker-if{
color:#888888;
}
.picker-block{
margin:0 0 0 100px;
}
.diag_input{
margin:20px;
}

2
pages/user/myWhistle/index.js

@ -114,6 +114,8 @@ Page({
return; return;
} }
if (e.currentTarget.dataset.id) { if (e.currentTarget.dataset.id) {
wx.navigateTo({ wx.navigateTo({
url: '../myWhistle/whistleDetail/index?id=' + e.currentTarget.dataset.id url: '../myWhistle/whistleDetail/index?id=' + e.currentTarget.dataset.id
}) })

5
pages/user/myWhistle/whistleDetail/index.js

@ -22,18 +22,13 @@ Page({
detail:res.result, detail:res.result,
img:img img:img
}) })
}); });
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function () {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */

Loading…
Cancel
Save