|
|
@ -4,7 +4,7 @@ |
|
|
|
<div class="user"> |
|
|
|
<img src="@/assets/images/index/nan.png" alt="" /> |
|
|
|
<span v-if="resiDetailObj.baseInfoDto"> |
|
|
|
{{ resiDetailObj.baseInfoDto.name }}({{ age }}岁)</span |
|
|
|
{{ resiDetailObj.baseInfoDto.name }}({{ resiDetailObj.baseInfoDto.age }}岁)</span |
|
|
|
> |
|
|
|
<span v-else> -- </span> |
|
|
|
</div> |
|
|
@ -669,7 +669,6 @@ export default { |
|
|
|
active: 0, |
|
|
|
menuList: [], |
|
|
|
score: null, |
|
|
|
age: null, |
|
|
|
|
|
|
|
nationalityList: [], //国籍字典 |
|
|
|
marriageArr: [], //婚姻状况字典 |
|
|
@ -1129,26 +1128,6 @@ export default { |
|
|
|
console.log(error); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 计算年龄 |
|
|
|
calculateAge(birthdayTimestamp) { |
|
|
|
// 获取当前日期 |
|
|
|
const currentDate = new Date(); |
|
|
|
// 将生日时间戳转换为日期对象 |
|
|
|
const birthdayDate = new Date(birthdayTimestamp); |
|
|
|
// 计算年龄 |
|
|
|
let age = currentDate.getFullYear() - birthdayDate.getFullYear(); |
|
|
|
// 检查是否已经过了生日 |
|
|
|
const currentMonth = currentDate.getMonth(); |
|
|
|
const birthMonth = birthdayDate.getMonth(); |
|
|
|
if ( |
|
|
|
currentMonth < birthMonth || |
|
|
|
(currentMonth === birthMonth && |
|
|
|
currentDate.getDate() < birthdayDate.getDate()) |
|
|
|
) { |
|
|
|
age--; |
|
|
|
} |
|
|
|
return age; |
|
|
|
}, |
|
|
|
async getNationalityList() { |
|
|
|
try { |
|
|
|
const { data } = await this.$http.post("sys/dict/data/dictlist", { |
|
|
@ -1244,10 +1223,6 @@ export default { |
|
|
|
); |
|
|
|
|
|
|
|
this.score = res.data.data.integrityData.score; |
|
|
|
const birthdayTimestamp = Date.parse( |
|
|
|
res.data.data.baseInfoDto.birthday |
|
|
|
); |
|
|
|
this.age = this.calculateAge(birthdayTimestamp); |
|
|
|
} else if (res.data.code >= 8000) { |
|
|
|
this.resiDetailObj = {}; |
|
|
|
this.$message.error(res.data.msg); |
|
|
|