diff --git a/app.json b/app.json index 34e5891..e14dc3b 100644 --- a/app.json +++ b/app.json @@ -17,6 +17,7 @@ "pages/user/myMessage/index", "pages/user/myTopics/index", "pages/user/myInfo/index", + "pages/user/myInfo/register/index", "pages/topics/interactive/submitTopic/index", "pages/topics/interactive/topicArticle/index", "pages/billboards/park/park-category/index", diff --git a/models/auth.js b/models/auth.js index 9b67d90..d65fe7f 100644 --- a/models/auth.js +++ b/models/auth.js @@ -2,7 +2,7 @@ import { HTTP, Method, HTTPConst } from '../utils/http.js' const AuthConst = { check_register_url: '/api/miniuser/isRegister', - mobile_code_url: '/api/miniuser/getSmsCode', // 获取验证码 + mobile_code_url: '/api/miniuser/getSmsCode1', // 获取验证码 verify_update_phone_url: '/api/miniuser/updateMiniUser' // mobile 验证 } class AuthModel extends HTTP { diff --git a/models/user.js b/models/user.js index 0ab5168..62c9845 100644 --- a/models/user.js +++ b/models/user.js @@ -14,7 +14,9 @@ const UserConst = { user_myWhistle_url:'/api/whistle/getMyWhistleList',// 我的吹哨 user_whistleDetail_url:'/api/whistle/getWhistleById', // 吹哨详情 - user_saveWhistleComment_url:'/api/whistle/saveComment' // 吹哨评价 + user_saveWhistleComment_url:'/api/whistle/saveComment' ,// 吹哨评价 + user_updatePhone_url:'/api/miniuser/updatephone',//更新电话号码 + } class UserModel extends HTTP { constructor () { @@ -40,8 +42,8 @@ class UserModel extends HTTP { isRegister: 2, //1.注册 2.修改用户信息 avatar: data.avatarUrl, realName: data.nickName, - phone: data.phone, - departId:data.street, + // phone: data.phone,//注释此行,submit无法更新phone + departId:data.streetsIndex, age:data.age, gender:data.genderIndex, company: data.company, @@ -211,6 +213,19 @@ class UserModel extends HTTP { } this.request(params) } + //更新电话号码 + updatephone(phone,code,success){ + let params = { + url:UserConst.user_updatePhone_url, + method: Method.POST, + data: { + phone:phone, + code:code, + }, + success: success + } + this.request(params) + } } export { UserModel } \ No newline at end of file diff --git a/pages/user/index.js b/pages/user/index.js index fd3d48d..811a010 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -108,6 +108,9 @@ Page({ if(this.data.isAuth){ if (type === 'myInfo') { + console.log('进入个人信息页面'); + console.log(this.data.userInfo); + 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 || ''}&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 || ''}`, }) diff --git a/pages/user/myInfo/index.js b/pages/user/myInfo/index.js index e0e736f..89005bd 100644 --- a/pages/user/myInfo/index.js +++ b/pages/user/myInfo/index.js @@ -2,6 +2,9 @@ import { store } from '../../../utils/store.js' import { config } from '../../../config.js' import { UserModel } from '../../../models/user.js' +import { TopicModel } from '../../../models/topic.js' + +let topicModel = new TopicModel() let userModel = new UserModel() Page({ @@ -14,7 +17,8 @@ Page({ phone: String, company: String, position: String, - street:String, + streets:[], + streetsIndex:Number, age:String, gender:['','男','女'], genderIndex:Number, @@ -31,37 +35,26 @@ Page({ }, 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({ @@ -105,15 +98,13 @@ Page({ }, onLoad: function (options) { - console.log("index.js"); - console.log(options) this.setData({ avatarUrl: options.userIcon, nickName: options.userName, phone: options.userPhone || '', company: options.company || '', position: options.position || '', - street:options.street || '', + streetsIndex:options.street || '', age:options.age || '', genderIndex:options.genderIndex || '', educationIndex:options.education || '', @@ -121,15 +112,28 @@ Page({ talentTitle:options.talentTitle || '', prize:options.prize || '', }) + topicModel.getStreetList(res=>{ + var resultss = res.result + var streett = [] + resultss.forEach((value,index)=>{ + streett[index] = value.departName + }) + streett.unshift('') + // console.log(streett) + this.setData({ + streets: streett + }) + // console.log("查看data里streets的值"); + // console.log(this.data.streetsIndex); + }) }, - //性别和学历有专门的bind方法。此方法修改年龄,工作单位,职务,职称等 + onTapItem(e) { const { type } = e.currentTarget.dataset this.setData({ type:type }) - console.log(type) - //如果等于userIcon调用upload方法更新头像 + if(type === 'userIcon'){ this.upload() }else{ @@ -145,7 +149,7 @@ Page({ success(res) { wx.showLoading() const tempFilePaths = res.tempFilePaths - console.log(res) + // console.log(res) const token = store.readToken() wx.uploadFile({ url: config.api_url + "/api/common/upload", @@ -156,7 +160,7 @@ Page({ }, name: 'files', success(res) { - console.log(res); + // console.log(res); const data = JSON.parse(res.data) const image = { url: config.api_url + '/' + data.result.imgUrl, @@ -192,18 +196,24 @@ Page({ // }) // }, 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); + }, + bindstreetChange:function(e){ + this.setData({ + streetsIndex:e.detail.value + }) + }, + onTapPhone:function(){ + wx.navigateTo({ + url:'../myInfo/register/index' + }) }, submit(){ console.log("submit"); @@ -214,12 +224,12 @@ Page({ nickName: this.data.nickName, avatarUrl: this.data.avatarUrl, phone: this.data.phone || '', - departId:this.data.street, + departId:this.data.streetsIndex, age:this.data.age, - gender:this.data.genderIndex,// + gender:this.data.genderIndex, company:this.data.company, position:this.data.position, - education:this.data.educationIndex,// + education:this.data.educationIndex, title:this.data.professionalTitle, designation:this.data.talentTitle, honor:this.data.prize diff --git a/pages/user/myInfo/index.wxml b/pages/user/myInfo/index.wxml index 88a7567..e0379e0 100644 --- a/pages/user/myInfo/index.wxml +++ b/pages/user/myInfo/index.wxml @@ -16,20 +16,39 @@ + + + + + + + + - + + + + + 请选择 + + + + {{streets[streetsIndex]}} + + +