xiaobo 1 month ago
parent
commit
e837e6c514
4 changed files with 154 additions and 42 deletions
  1. +12
    -0
      api/model/info.js
  2. +1
    -1
      pages/index/center.vue
  3. +83
    -24
      pages_my/user-info.vue
  4. +58
    -17
      pages_my/user-msg.vue

+ 12
- 0
api/model/info.js View File

@ -119,6 +119,18 @@ const api = {
auth : true, auth : true,
showLoading : true, showLoading : true,
}, },
// 获取国籍
nationalityPageList: {
url: '/info_common/getNationalityPageList',
method: 'GET',
auth: false,
},
// 获取学院
labelPageList: {
url: '/info_common/getLabelPageList',
method: 'GET',
auth: false,
},
} }
export default api export default api

+ 1
- 1
pages/index/center.vue View File

@ -16,7 +16,7 @@
{{isLogin ? userInfo.phone : ''}} {{isLogin ? userInfo.phone : ''}}
</view> </view>
</view> </view>
<view class="setting" @click="jump({url:'/pages_my/user-msg'})">
<view class="setting" @click="toInfo">
<uv-icon name="edit-pen" size="50rpx" color="#fff"></uv-icon> <uv-icon name="edit-pen" size="50rpx" color="#fff"></uv-icon>
</view> </view>
</view> </view>


+ 83
- 24
pages_my/user-info.vue View File

@ -4,16 +4,30 @@
<uv-navbar autoBack title="个人资料" leftIconColor="#fff" :bgColor="bgColor" height="100rpx" :titleStyle="{color:'#fff'}"></uv-navbar> <uv-navbar autoBack title="个人资料" leftIconColor="#fff" :bgColor="bgColor" height="100rpx" :titleStyle="{color:'#fff'}"></uv-navbar>
<view class="content"> <view class="content">
<view class="img-box">
<image src="@/static/image/center/3.png" mode=""></image>
<view>点击更换头像</view>
</view>
<button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<view class="img-box">
<image :src="info.headImage" mode=""></image>
<view>点击更换头像</view>
</view>
<!-- <view class="line">
<view class="">
头像
</view>
<view class="">
<image :src="userInfoForm.headImage" v-if="userInfoForm.headImage" style="width: 60rpx;height: 60rpx;"
mode=""></image>
<image src="../static/auth/headImage.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image>
</view>
</view> -->
</button>
<view class="name-box"> <view class="name-box">
<view class="name-val">但愿不过瞻仰</view>
<view class="name-val">{{info.nickName}}</view>
<view class="sex-box"> <view class="sex-box">
<image src="@/static/image/center/nan-icon.png" mode=""></image>
<image v-if="info.sex == '男'" src="@/static/image/center/nan-icon.png" mode=""></image>
<image v-else src="@/static/image/center/nv-icon.png" mode=""></image>
</view> </view>
<view class="age-box">36</view>
<view class="age-box">{{calculateAge}}</view>
<!-- <image src="@/static/image/center/nv-icon.png" mode=""></image> --> <!-- <image src="@/static/image/center/nv-icon.png" mode=""></image> -->
</view> </view>
<view class="form-box"> <view class="form-box">
@ -23,7 +37,7 @@
<view>国籍</view> <view>国籍</view>
</view> </view>
<view class="value-box"> <view class="value-box">
中国
{{info.city}}
</view> </view>
</view> </view>
<view class="form-box-line"> <view class="form-box-line">
@ -32,7 +46,7 @@
<view>学历</view> <view>学历</view>
</view> </view>
<view class="value-box"> <view class="value-box">
本科
{{info.shcool}}
</view> </view>
</view> </view>
<view class="form-box-line"> <view class="form-box-line">
@ -41,7 +55,7 @@
<view>行业</view> <view>行业</view>
</view> </view>
<view class="value-box"> <view class="value-box">
暂无
{{info.workValue}}
</view> </view>
</view> </view>
<view class="form-box-line"> <view class="form-box-line">
@ -50,7 +64,7 @@
<view>电话</view> <view>电话</view>
</view> </view>
<view class="value-box"> <view class="value-box">
123321123
{{info.phone}}
</view> </view>
</view> </view>
<view class="form-box-line"> <view class="form-box-line">
@ -59,22 +73,23 @@
<view>性别</view> <view>性别</view>
</view> </view>
<view class="value-box"> <view class="value-box">
{{info.sex}}
</view> </view>
</view> </view>
</view> </view>
<view class="tips-box"> <view class="tips-box">
<view class="title-box">标签</view> <view class="title-box">标签</view>
<view class="tips-val"> <view class="tips-val">
<view class="tips-item tips-1">单身</view>
<view class="tips-item tips-2">985</view>
<view class="tips-item tips-3">设计师</view>
<view class="tips-item tips-4">行业大牛</view>
<view class="tips-item tips-1" v-for="(val,i) in stateArr" :key="i">{{val}}</view>
<!-- <view class="tips-item tips-2">985</view> -->
<!-- <view class="tips-item tips-3">设计师</view> -->
<!-- <view class="tips-item tips-4">行业大牛</view> -->
</view> </view>
</view> </view>
<view class="about-box"> <view class="about-box">
<uv-divider text="关于我" textSize="28rpx"></uv-divider> <uv-divider text="关于我" textSize="28rpx"></uv-divider>
<view class="about-box-val">我目前居住在上海是一名工程师在一家互联网公司工作虽然工作很忙但我总能找到时间享受我的爱好旅行和摄影每到假期我就</view>
<view class="about-box-val">{{info.details}}</view>
</view> </view>
</view> </view>
<view class="btn-box"> <view class="btn-box">
@ -91,12 +106,7 @@
color:'#FF5858' color:'#FF5858'
}, },
bgColor:'transparent', bgColor:'transparent',
info:{
name:'',
phone:'',
idCard:'',
jianli:''
},
info:{},
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@ -106,12 +116,54 @@
this.bgColor = 'transparent' this.bgColor = 'transparent'
} }
}, },
onShow() {
this.getUserInfo()
},
computed:{
calculateAge() {
let today = new Date();
let birthDate = new Date(this.info.yearDate);
let age = today.getFullYear() - birthDate.getFullYear();
let m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age;
},
stateArr() {
let arr = this.info.state.split(',')
return arr
}
},
methods:{ methods:{
onChooseAvatar(res) {
let self = this
self.$Oss.ossUpload(res.target.avatarUrl)
.then(url => {
self.info.headImage = url
this.$api('updateInfo',this.info, res => {
if (res.code == 200) {
uni.showToast({
title:'保存成功',
icon:'none'
})
}
})
})
},
getUserInfo() {
this.$api('getInfo', res => {
if (res.code == 200) {
this.info = res.result
}
})
},
editClick() { editClick() {
uni.navigateTo({ uni.navigateTo({
url:'/pages_my/user-msg' url:'/pages_my/user-msg'
}) })
}
},
} }
} }
</script> </script>
@ -122,6 +174,13 @@
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.chooseAvatar {
width: 100%;
padding: 0;
margin: 0;
border: none;
background-color: transparent;
}
.head-box { .head-box {
background: url('@/static/image/nav-bg.png') no-repeat; background: url('@/static/image/nav-bg.png') no-repeat;
background-size: 100% 100%; background-size: 100% 100%;


+ 58
- 17
pages_my/user-msg.vue View File

@ -26,20 +26,20 @@
</view> </view>
<view class="form-box-line"> <view class="form-box-line">
<view class="label-box">性别</view> <view class="label-box">性别</view>
<view class="value-box">
<uv-input placeholder="请输入性别" inputAlign="right" v-model="info.sex" border="none" color="#CCCCCC"></uv-input>
<view class="value-box" @click="$refs.sexPicker.open();">
<uv-input placeholder="请选择性别" readonly inputAlign="right" v-model="info.sex" border="none" color="#CCCCCC"></uv-input>
</view> </view>
</view> </view>
<view class="form-box-line"> <view class="form-box-line">
<view class="label-box">国籍</view> <view class="label-box">国籍</view>
<view class="value-box">
<uv-input placeholder="请输入国籍" inputAlign="right" v-model="info.idCard" border="none" color="#CCCCCC"></uv-input>
<view class="value-box" @click="$refs.cityPicker.open()">
<uv-input placeholder="请输入国籍" readonly inputAlign="right" v-model="info.city" border="none" color="#CCCCCC"></uv-input>
</view> </view>
</view> </view>
<view class="form-box-line"> <view class="form-box-line">
<view class="label-box">生日</view> <view class="label-box">生日</view>
<view class="value-box">
<uv-input placeholder="请输入生日" inputAlign="right" v-model="info.yearDate" border="none" color="#CCCCCC"></uv-input>
<view class="value-box" @click="$refs.datetimePicker.open()">
<uv-input placeholder="请输入生日" readonly inputAlign="right" v-model="info.yearDate" border="none" color="#CCCCCC"></uv-input>
</view> </view>
</view> </view>
<view class="form-box-line"> <view class="form-box-line">
@ -51,7 +51,7 @@
<view class="form-box-line"> <view class="form-box-line">
<view class="label-box">个人状态</view> <view class="label-box">个人状态</view>
<view class="value-box"> <view class="value-box">
<uv-input placeholder="请输入个人状态" inputAlign="right" v-model="info.idCard" border="none" color="#CCCCCC"></uv-input>
<uv-input placeholder="请输入个人状态" inputAlign="right" v-model="info.state" border="none" color="#CCCCCC"></uv-input>
</view> </view>
</view> </view>
</view> </view>
@ -60,11 +60,11 @@
<view class="form-box"> <view class="form-box">
<view class="form-title">学历</view> <view class="form-title">学历</view>
<view class="choose-box"> <view class="choose-box">
<view class="choose-item" :class="xueliIndex == i ? 'choose-class' :''" v-for="(item,i) in xueliList" :key="i" @click="xueliIndex = i">{{item}}</view>
<view class="choose-item" :class="info.shcool == item ? 'choose-class' :''" v-for="(item,i) in xueliList" :key="i" @click="info.shcool = item">{{item}}</view>
</view> </view>
<view class="form-title">院校</view> <view class="form-title">院校</view>
<view class="choose-box"> <view class="choose-box">
<view class="choose-item" :class="yuanxiaoIndex == i ? 'choose-class' :''" v-for="(item,i) in yuanxiaoList" :key="i" @click="yuanxiaoIndex = i">{{item}}</view>
<view class="choose-item" :class="info.shcoolType == item.title ? 'choose-class' :''" v-for="(item,i) in yuanxiaoList" :key="i" @click="info.shcoolType = item.title">{{item.title}}</view>
</view> </view>
</view> </view>
@ -73,19 +73,22 @@
<view class="form-box-line"> <view class="form-box-line">
<view class="label-box">行业</view> <view class="label-box">行业</view>
<view class="value-box"> <view class="value-box">
<uv-input placeholder="请输入行业" inputAlign="right" v-model="info.name" border="none" color="#CCCCCC"></uv-input>
<uv-input placeholder="请输入行业" inputAlign="right" v-model="info.workValue" border="none" color="#CCCCCC"></uv-input>
</view> </view>
</view> </view>
</view> </view>
<view class="title-box">关于我</view> <view class="title-box">关于我</view>
<view class="form-box"> <view class="form-box">
<uv-textarea v-model="info.name" :customStyle="{background: 'transparent',border:'none'}" height="380rpx" placeholder="请输入自我介绍..."></uv-textarea>
<uv-textarea v-model="info.details" :customStyle="{background: 'transparent',border:'none'}" height="380rpx" placeholder="请输入自我介绍..."></uv-textarea>
</view> </view>
</view> </view>
<view class="btn-box"> <view class="btn-box">
<uv-button text="保存" @click="saveClick" color="#381615" shape="circle" :customStyle="btnCustomStyle"></uv-button> <uv-button text="保存" @click="saveClick" color="#381615" shape="circle" :customStyle="btnCustomStyle"></uv-button>
</view> </view>
<uv-picker ref="sexPicker" :columns="sexcolumns" @confirm="sexConfirm"></uv-picker>
<uv-picker ref="cityPicker" keyName="country" :columns="citycolumns" @confirm="cityConfirm"></uv-picker>
<uv-datetime-picker ref="datetimePicker" :minDate="0" :maxDate="maxDate" :formatter="formatter" v-model="value" mode="date" @confirm="dateConfirm"></uv-datetime-picker>
</view> </view>
</template> </template>
@ -115,7 +118,13 @@
xueliIndex:0, xueliIndex:0,
yuanxiaoIndex:0, yuanxiaoIndex:0,
xueliList:['本科','硕士','博士','其他'], xueliList:['本科','硕士','博士','其他'],
yuanxiaoList:['985','211','双一流','QS100','QS200','QS600','其他']
yuanxiaoList:[],
sexcolumns:[
['男','女']
],
citycolumns:[],
maxDate:new Date().getTime(),
value: Number(new Date())
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@ -127,14 +136,33 @@
}, },
onLoad() { onLoad() {
this.getUserInfo() this.getUserInfo()
this.getnationalityPageList()
this.getlabelPageList()
}, },
methods:{ methods:{
getlabelPageList() {
this.$api('labelPageList',{pageNo:1,pageSize:999},res=>{
this.yuanxiaoList = res.result.records
})
},
getnationalityPageList() {
this.$api('nationalityPageList',{pageNo:1,pageSize:999},res=>{
this.citycolumns = [res.result.records]
})
},
formatter(type, value) {
if (type === 'year') {
return `${value}`
}
if (type === 'month') {
return `${value}`
}
if (type === 'day') {
return `${value}`
}
return value
},
saveClick() { saveClick() {
this.$api('updateInfo',this.info, res => { this.$api('updateInfo',this.info, res => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({
@ -150,6 +178,19 @@
this.info = res.result this.info = res.result
} }
}) })
},
sexConfirm(val) {
this.info.sex = val.value[0]
},
cityConfirm(val) {
this.info.city = val.value[0].country
},
dateConfirm(val) {
const date = new Date(val.value);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
this.info.yearDate = `${year}-${month}-${day}`;
} }
} }
} }


Loading…
Cancel
Save