|
@@ -6,7 +6,7 @@ import { logout } from '@/api/common/index'
|
|
import { getUserInfo } from '@/api/personal/user'
|
|
import { getUserInfo } from '@/api/personal/user'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import { timesTampChange } from '@/utils/date'
|
|
import { timesTampChange } from '@/utils/date'
|
|
-import { getDictName } from '@/utils/getText'
|
|
|
|
|
|
+import { getBaseInfoDictOfName } from '@/utils/getText'
|
|
|
|
|
|
|
|
|
|
export const useUserStore = defineStore('user',
|
|
export const useUserStore = defineStore('user',
|
|
@@ -64,6 +64,7 @@ export const useUserStore = defineStore('user',
|
|
const data = await getBaseInfo({ userId: userId || accountInfo.userId })
|
|
const data = await getBaseInfo({ userId: userId || accountInfo.userId })
|
|
// baseInfo = data
|
|
// baseInfo = data
|
|
baseInfo = await getFieldText(data)
|
|
baseInfo = await getFieldText(data)
|
|
|
|
+ console.log('baseInfo->', baseInfo)
|
|
localStorage.setItem('baseInfo', JSON.stringify(baseInfo))
|
|
localStorage.setItem('baseInfo', JSON.stringify(baseInfo))
|
|
} catch (error) {
|
|
} catch (error) {
|
|
Snackbar.error(error.msg)
|
|
Snackbar.error(error.msg)
|
|
@@ -71,17 +72,39 @@ export const useUserStore = defineStore('user',
|
|
}
|
|
}
|
|
// 字典对应中文
|
|
// 字典对应中文
|
|
const getFieldText = async (data) => {
|
|
const getFieldText = async (data) => {
|
|
- if (data.areaId && data.areaId !== 0) await getDictName(data, data.areaId, 'areaName') // 现居住地text
|
|
|
|
|
|
+ if (data.areaId && data.areaId !== 0) await getBaseInfoDictOfName(0, data, data.areaId, 'areaName') // 现居住地text
|
|
if (data.birthday && data.birthday !== 0) data.birthdayText = timesTampChange(data.birthday).slice(0, 10) // 出生日期
|
|
if (data.birthday && data.birthday !== 0) data.birthdayText = timesTampChange(data.birthday).slice(0, 10) // 出生日期
|
|
- if (data.eduType && data.eduType !== 0) data.eduTypeText = '硕士' // 学历
|
|
|
|
- if (data.expType && data.expType !== 0) data.expTypeText = '1-3年' // 工作经验
|
|
|
|
- if (data.sex && data.sex !== 0) data.sexTypeText = data.sex === '1' ? '男' : '女' // 性别
|
|
|
|
- if (data.maritalStatus && data.maritalStatus !== 0) data.maritalText = '未婚' // 婚姻状况
|
|
|
|
- if (data.jobStatus && data.jobStatus !== 0) data.jobStatusText = '离职-随时到岗' // 求职状态
|
|
|
|
- if (data.jobType && data.jobType !== 0) data.jobTypeText = '全职' // 求职类型
|
|
|
|
|
|
+ if (data.eduType && data.eduType !== 0) await getBaseInfoDictOfName(1, data, data.eduType, 'eduTypeText') // 学历
|
|
|
|
+ if (data.expType && data.expType !== 0) await getBaseInfoDictOfName(2, data, data.expType, 'expTypeText') // 工作经验
|
|
|
|
+ if (data.sex && data.sex !== 0) await getBaseInfoDictOfName(3, data, data.sex, 'sexTypeText') // 性别
|
|
|
|
+ if (data.maritalStatus && data.maritalStatus !== 0) await getMaritalText(data, data.maritalStatus) // 婚姻状况
|
|
|
|
+ if (data.jobStatus && data.jobStatus !== 0) await getJobStatusText(data, data.jobStatus) // 求职状态
|
|
|
|
+ if (data.jobType && data.jobType !== 0) await getBaseInfoDictOfName(4, data, data.jobType, 'jobTypeText') // 求职类型
|
|
if (data.firstWorkTime && data.firstWorkTime !== 0) data.firstWorkTimeText = timesTampChange(data.firstWorkTime).slice(0, 10) // 首次工作时间
|
|
if (data.firstWorkTime && data.firstWorkTime !== 0) data.firstWorkTimeText = timesTampChange(data.firstWorkTime).slice(0, 10) // 首次工作时间
|
|
return data
|
|
return data
|
|
}
|
|
}
|
|
|
|
+ const getMaritalText = async (data, value) => { // 字典未加上,暂时的
|
|
|
|
+ const items = [
|
|
|
|
+ { label: '未婚', value: '0' },
|
|
|
|
+ { label: '已婚', value: '1' },
|
|
|
|
+ { label: '离异', value: '2' },
|
|
|
|
+ { label: '保密', value: '3' }
|
|
|
|
+ ]
|
|
|
|
+ const obj = items.find(e => e.value === value)
|
|
|
|
+ const str = obj ? obj.label : '暂无'
|
|
|
|
+ data.maritalText = str
|
|
|
|
+ }
|
|
|
|
+ const getJobStatusText = async (data, value) => { // 字典未加上,暂时的
|
|
|
|
+ const items = [
|
|
|
|
+ { label: '离职-随时到岗', value: '0' },
|
|
|
|
+ { label: '在职-月内到岗', value: '1' },
|
|
|
|
+ { label: '在职-考虑机会', value: '2' },
|
|
|
|
+ { label: '在职-暂不考虑', value: '3' }
|
|
|
|
+ ]
|
|
|
|
+ const obj = items.find(e => e.value === value)
|
|
|
|
+ const str = obj ? obj.label : '暂无'
|
|
|
|
+ data.jobStatusText = str
|
|
|
|
+ }
|
|
|
|
|
|
// 退出登录
|
|
// 退出登录
|
|
const userLogout = async () => {
|
|
const userLogout = async () => {
|