|
@@ -123,6 +123,7 @@ import { uploadFile } from '@/api/common'
|
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
import portrait from './portrait.vue'
|
|
|
+import { checkEmail } from '@/utils/validate'
|
|
|
import { ref } from 'vue';
|
|
|
defineOptions({name: 'resume-components-basicInfo'})
|
|
|
const emit = defineEmits(['complete'])
|
|
@@ -132,6 +133,7 @@ const userStore = useUserStore()
|
|
|
const CtFormRef = ref()
|
|
|
const isEdit = ref(false)
|
|
|
const showIcon = ref(false)
|
|
|
+let completeStatus = false
|
|
|
const overlay = ref(false) // 加载中
|
|
|
let baseInfo = ref({})
|
|
|
let userInfo = ref({})
|
|
@@ -140,6 +142,10 @@ const getBasicInfo = () => { // 获取基础信息
|
|
|
if (!key || !Object.keys(key).length) return
|
|
|
baseInfo.value = JSON.parse(key) // 人才信息
|
|
|
userInfo.value = JSON.parse(localStorage.getItem('userInfo'))
|
|
|
+ if (baseInfo.value && Object.keys(baseInfo.value).length) {
|
|
|
+ completeStatus = true
|
|
|
+ emit('complete', { status: completeStatus, id: 'basicInfo' })
|
|
|
+ }
|
|
|
}
|
|
|
getBasicInfo()
|
|
|
|
|
@@ -252,7 +258,16 @@ const items = ref({
|
|
|
label: '常用邮箱 *',
|
|
|
col: 6,
|
|
|
outlined: true,
|
|
|
- rules: [v => !!v || '请输入常用邮箱']
|
|
|
+ rules: [
|
|
|
+ value => {
|
|
|
+ if (value) return true
|
|
|
+ return '请输入常用邮箱'
|
|
|
+ },
|
|
|
+ value => {
|
|
|
+ if (checkEmail(value)) return true
|
|
|
+ return '请输入正确的电子邮箱'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
type: 'autocomplete',
|
|
@@ -411,10 +426,9 @@ const handleSave = async () => {
|
|
|
await saveResumeBasicInfo(obj)
|
|
|
Snackbar.success(t('common.saveMsg'))
|
|
|
isEdit.value = false
|
|
|
- // 获取当前登录账户信息
|
|
|
- // if (baseInfo.value.userId) await userStore.getUserBaseInfos(baseInfo.value.userId)
|
|
|
await userStore.getUserBaseInfos(baseInfo.value.userId || null)
|
|
|
getBasicInfo()
|
|
|
+
|
|
|
// 清除户籍地:省
|
|
|
if (clearRegProvinceId) items.value.options.forEach(e => { if (e.key === 'regProvinceId') e.value = null })
|
|
|
}
|
|
@@ -448,18 +462,14 @@ const deal = async (id, cityKey, provinceKey) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-let completeStatus = false
|
|
|
items.value.options.forEach((e, index) => {
|
|
|
if ((index + 2) % 2 === 0) e.flexStyle = 'mr-3'
|
|
|
if (e.dictTypeName) getDictData(e.dictTypeName) // 查字典set options
|
|
|
- // formItems回显
|
|
|
const infoExist = baseInfo.value && Object.keys(baseInfo.value).length
|
|
|
- if (infoExist) completeStatus = true
|
|
|
if (infoExist && baseInfo.value[e.key]) e.value = baseInfo.value[e.key]
|
|
|
// 日期相关
|
|
|
if (e.type === 'datepicker') e.value = timesTampChange(e.value, 'Y-M-D')
|
|
|
// 所在城市回显
|
|
|
- // if (infoExist && e.nameKey) e[e.nameKey] = baseInfo.value[e.nameKey]
|
|
|
if (infoExist && e.key === 'areaId' && baseInfo.value[e.key]) {
|
|
|
const id = baseInfo.value[e.key]
|
|
|
deal(id, e.key, 'workAreaProvinceId')
|
|
@@ -471,7 +481,6 @@ items.value.options.forEach((e, index) => {
|
|
|
if (e.value === undefined || e.value === null || e.value === '') completeStatus = false
|
|
|
})
|
|
|
// 完成度展示
|
|
|
-emit('complete', { status: completeStatus, id: 'basicInfo' })
|
|
|
|
|
|
const provinceChange = (value, val, obj) => {
|
|
|
let cityKey
|
|
@@ -486,11 +495,7 @@ const provinceChange = (value, val, obj) => {
|
|
|
getDict('areaTreeData', null, 'areaTreeData').then(({ data }) => {
|
|
|
data = data?.length && data || []
|
|
|
if (!data?.length) return console.error('areaTreeData获取失败!')
|
|
|
- //
|
|
|
- // const china = data.find(e => e.id === '1')
|
|
|
- // const chinaTreeData = china?.children?.length ? china.children : []
|
|
|
const chinaTreeData = data
|
|
|
- //
|
|
|
if (!chinaTreeData?.length) return console.error('chinaTreeData获取失败!')
|
|
|
const workAreaProvince = items.value.options.find(e => e.key === 'workAreaProvinceId')
|
|
|
const regAreaProvince = items.value.options.find(e => e.key === 'regProvinceId')
|