Bladeren bron

个人端基本信息编辑刷新

Xiao_123 10 maanden geleden
bovenliggende
commit
90185dcb37

+ 3 - 3
src/store/user.js

@@ -25,7 +25,7 @@ export const useUserStore = defineStore('user',
   {
     state: () => ({
       // loginType: null, // 登录类型 // 330为企业登录
-      accountInfo: {}, // 登录返回的信息
+      accountInfo: localStorage.getItem('accountInfo') ? JSON.parse(localStorage.getItem('accountInfo')) : {}, // 登录返回的信息
       userInfo: localStorage.getItem('userInfo') ? JSON.parse(localStorage.getItem('userInfo')) : {}, // 当前登录账号信息
       baseInfo: localStorage.getItem('baseInfo') ? JSON.parse(localStorage.getItem('baseInfo')) : {}, // 人才信息
       userAccount: {}, // 用户账户信息
@@ -102,11 +102,11 @@ export const useUserStore = defineStore('user',
           const api = this.loginType ? null : getBaseInfo
           if (!api) return
           const data = await api({ userId: userId || this.accountInfo.userId })
-          if (!data) return localStorage.setItem('baseInfo', JSON.stringify('{}'))
+          // if (!data) return localStorage.setItem('baseInfo', JSON.stringify('{}'))
+          if (!data) return
           this.baseInfo = await this.getFieldText(data)
           localStorage.setItem('baseInfo', JSON.stringify(this.baseInfo))
         } catch (error) {
-          console.log(error, 'error')
           Snackbar.error(error)
         }
       },

+ 1 - 1
src/views/recruit/enterprise/informationManagement/informationSettingsComponents/enterpriseAlbum.vue

@@ -53,7 +53,7 @@ const imgList = ref([])
 
 const getInfo = async () => {
   const data = await getEnterpriseBaseInfo()
-  if (!data) return
+  if (!data || !data.albumList) return
   imgList.value = data.albumList
 }
 getInfo()

+ 6 - 20
src/views/recruit/personal/remuse/components/basicInfo.vue

@@ -117,8 +117,6 @@
 <script setup>
 import CtForm from '@/components/CtForm'
 import Snackbar from '@/plugins/snackbar'
-// import areaType from '@/components/AreaSelect'
-// import textUI from '@/components/FormUI/TextInput'
 import { getDict } from '@/hooks/web/useDictionaries'
 import { cityToProvince } from '@/utils/areaDeal'
 import { getTimeStamp, timesTampChange } from '@/utils/date'
@@ -137,7 +135,9 @@ const isExpand = ref(false)
 const welfareList = ref(['响应', '改变', '诚信', '进取精神', '信任', '卓越'])
 let baseInfo = ref({})
 const getBasicInfo = () => { // 获取基础信息
-  baseInfo.value = JSON.parse(localStorage.getItem('baseInfo')) || {} // 人才信息
+  const key = localStorage.getItem('baseInfo')
+  if (!key) return
+  baseInfo.value = JSON.parse(key) // 人才信息
 }
 getBasicInfo()
 
@@ -364,24 +364,11 @@ const handleSave = async () => {
   Snackbar.success(t('common.saveMsg'))
   isEdit.value = false
   // 获取当前登录账户信息
-  if (baseInfo.value.userId) await userStore.getUserBaseInfos(baseInfo.value.userId)
-  await getBasicInfo()
+  // if (baseInfo.value.userId) await userStore.getUserBaseInfos(baseInfo.value.userId)
+  await userStore.getUserBaseInfos(baseInfo.value.userId || null)
+  getBasicInfo()
 }
 
-// 城市
-// const setValue = (key, id, name) => {
-//   const item =  items.value.options.find(e => e.key === key)
-//   if (item) {
-//     item.value = id
-//     item[item.nameKey] = name
-//   }
-// }
-// const handleArea = (list, name) => {
-//   if (!list.length) return
-//   const id = list[0]
-//   setValue('areaId', id, name)
-// }
-
 // 获取字典内容
 const getDictData = async (dictTypeName) => {
   const item = items.value.options.find(e => e.dictTypeName === dictTypeName)
@@ -399,7 +386,6 @@ const deal = async () => {
       const city = items.value.options.find(pv => pv.key === 'areaId')
       if (city) city.items = dealReturnObj.cityList || []
       province.value = dealReturnObj.pid || ''
-      console.log(dealReturnObj, 'dealReturnObj', province)
     }
   }
 }

+ 1 - 0
src/views/recruit/personal/remuse/components/selfEvaluation.vue

@@ -41,6 +41,7 @@ const useStore = useUserStore()
 const getData = async () => {
   await useStore.getUserBaseInfos(JSON.parse(localStorage.getItem('userInfo')).id)
   const baseInfo = JSON.parse(localStorage.getItem('baseInfo'))
+  if (!baseInfo) return
   advantage.value = baseInfo.advantage
 }
 getData()