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. 143
      pages/user/myInfo/index.js
  7. 3
      pages/user/myInfo/index.json
  8. 173
      pages/user/myInfo/index.wxml
  9. 39
      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,
realName: data.nickName,
phone: data.phone,
departId:data.street,
age:data.age,
gender:data.genderIndex,
company: data.company,
position: data.position
position: data.position,
education:data.educationIndex,
title:data.professionalTitle,
designation:data.talentTitle,
honor:data.prize
},
success: success
}

53
pages/topics/talents/index.js

@ -136,14 +136,6 @@ Component({
},
submit() {
// if (this.data.messageTitle === '') {
// wx.showModal({
// title: '提示',
// content: '请输入标题',
// showCancel: false
// })
// return
// }
if (this.data.messageDetail === ''){
wx.showModal({
title: '提示',
@ -161,33 +153,16 @@ Component({
})
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=>{
const id = res.result;
console.log("得到id值");
console.log(id);
if(res.code === 200){
this.setData({
messageDetail: '',
streetID:'',
files:[],
},()=>{
// wx.showToast({
// title: res.message,
// icon: 'none'
// })
wx.showModal({
title: '提交成功',
content: '问题已收到,我们会尽快给您答复的!',
@ -196,22 +171,24 @@ Component({
success (res) {
if (res.confirm) {
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) {
console.log('用户点击知道了')
}
}
})
})
}
})

19
pages/topics/talents/index.wxml

@ -1,23 +1,5 @@
<!--pages/topics/common/message/index.wxml-->
<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>
<!-- 请描述您的问题加上传图片 -->
@ -28,7 +10,6 @@
</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>
</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';
.container{
padding: 0px 20px;
@ -77,6 +77,8 @@
}
.select-view{
display: flex;
/* btnView是position:fix,所以为防止遮挡,设置街道选择盒子下边框margin-bottom为100px */
margin-bottom: 100px;
}
.select-mark{
width:15px;

9
pages/user/index.js

@ -27,6 +27,8 @@ Page({
},
onShow: function () {
if (store.hasBindUserInfo()) {
console.log("onshow");
this.getUserInfo()
this.setData({
isAuth: true
@ -44,6 +46,8 @@ Page({
// 获取用户信息
getUserInfo () {
userModel.getUserInfo(res => {
console.log("getUserInfo");
console.log(res)
let nickName = res.result.nickName
let avatarUrl = res.result.avatarUrl
@ -100,11 +104,12 @@ Page({
// cell点击
onTapItem (e) {
const { type } = e.currentTarget.dataset
//console.log(type)
console.log(type)
if(this.data.isAuth){
if (type === 'myInfo') {
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 {
wx.navigateTo({

143
pages/user/myInfo/index.js

@ -13,13 +13,99 @@ Page({
nickName: String,
phone: 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) {
console.log("index.js");
console.log(options)
this.setData({
avatarUrl: options.userIcon,
@ -27,18 +113,34 @@ Page({
phone: options.userPhone || '',
company: options.company || '',
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) {
const { type } = e.currentTarget.dataset
this.setData({
type:type
})
console.log(type)
//如果等于userIcon调用upload方法更新头像
if(type === 'userIcon'){
this.upload()
}
}else{
this.setData({
show:true
})
}
},
upload(){
let that = this
let that = this
wx.chooseImage({
success(res) {
wx.showLoading()
@ -89,13 +191,38 @@ Page({
// 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(){
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 || ''
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({
title: '修改成功',

3
pages/user/myInfo/index.json

@ -3,6 +3,7 @@
"usingComponents": {
"e-ibutton": "/components/image-button/index",
"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-->
<view class="container">
<mp-cells ext-class="page_bd">
<mp-cell
bindtap="onTapItem" data-type="userIcon"
title="头像"
link="true"
ext-class="cell-item">
<image slot="footer" class="user_logo" src="{{avatarUrl}}" />
</mp-cell>
<mp-cell
bindtap="onTapItem" data-type="userName"
title="名字"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{nikeName}}</view> -->
<input slot="footer" class="footer_input_phone" maxlength="120" bindinput="bindNickNameInput" value="{{nickName}}" disabled></input>
</mp-cell>
<mp-cell
bindtap="onTapItem" data-type="userPhone"
title="手机号"
ext-class="cell-item">
<!-- <view slot="footer" class="msg_footer" >{{phone}}</view> -->
<input slot="footer" class="footer_input_phone" maxlength="45" bindinput="bindPhoneInput" value="{{phone}}" disabled></input>
</mp-cell>
<mp-cell
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" maxlength="45" bindinput="bindCompanyInput" value="{{company}}" disabled></input>
</mp-cell>
<mp-cell
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" maxlength="45" bindinput="bindPositionInput" value="{{position}}" disabled></input>
</mp-cell>
<view class="btnView">
<e-ibutton title="提交" bind:onTap="submit"/>
<mp-cells ext-class="page_bd" >
<view class="cellAll">
<mp-cell
bindtap="onTapItem" data-type="userIcon"
title="头像"
link="true"
ext-class="cell-item">
<image slot="footer" class="user_logo" src="{{avatarUrl}}" />
</mp-cell>
<mp-cell link="true"
data-type="userName"
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>
</mp-cell>
<mp-cell link="true"
data-type="userPhone"
title="手机号" bindtap="onTapItem"
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>
</mp-cell>
<!-- 新加的 所在街道 年龄 性别 -->
<mp-cell link="true"
data-type="userStreet"
title="所在街道" bindtap="onTapItem"
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="bindStreetInput" value="{{street}}" disabled placeholder=""></input>
</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>
</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>
</mp-cells>
</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>

39
pages/user/myInfo/index.wxss

@ -1,4 +1,5 @@
/* pages/user/myInfo/index.wxss */
@import '../../../style/font.wxss';
.container {
background-color: #FAFAFA;
height: 100vh;
@ -6,6 +7,10 @@
.page_hd {
border-bottom: 7px solid #f7f7f7;
}
/* btnView是position:fix,所以为防止遮挡,盒子下边框margin-bottom为100px */
.cellAll{
margin-bottom: 100px;
}
.page_hd .weui-cells:before {
border-top: 0px solid white;
}
@ -28,7 +33,7 @@
.user_logo {
width: 60px;
height: 60px;
border-radius: 5px;
border-radius: 50%;
}
.user_name {
width: 400rpx;
@ -70,12 +75,14 @@
.footer_input_phone{
padding: 0 5px;
font-size: 14px;
border: 1px solid #AAAAAA;
border-radius: 4px;
/* border: 1px solid #AAAAAA; */
height: 30px;
text-align: left;
color: #3B3B3B;
background-color: #f7f7f7;
}
.select-mark{
width:20px;
/* border:1px solid black; */
}
.msg_footer{
font-size: 14px;
@ -87,4 +94,26 @@
bottom: 0;
left: 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;
}
if (e.currentTarget.dataset.id) {
wx.navigateTo({
url: '../myWhistle/whistleDetail/index?id=' + e.currentTarget.dataset.id
})

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

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

Loading…
Cancel
Save