Browse Source

个人layout获取基本信息

Xiao_123 4 months ago
parent
commit
21e45a6bd5

+ 14 - 3
src/layout/index.vue

@@ -17,13 +17,14 @@
 
 <script setup>
 defineOptions({ name: 'personal-layout-index' })
-import { onMounted } from 'vue'
+import { onMounted, watch } from 'vue'
 import NavBar from './personal/navBar.vue'
 import Footers from './personal/footer.vue'
 import Slider from './personal/slider.vue'
 import { useSharedState } from '@/store/sharedState'
-import { useRouter } from 'vue-router'
+import { useRouter, useRoute } from 'vue-router'
 import { useMallStore } from '@/store/mall'
+import { useUserStore } from '@/store/user'
 
 // 不展示侧边栏名单
 const whiteList = ['/login', '/privacyPolicy', '/userAgreement', '/register', '/recruit/personal/advertisement/introduce']
@@ -38,8 +39,9 @@ const footerWhiteList = [
   '/recruit/personal/resume/analysis',
   '/mall/pointExchange/records'
 ]
+const route = useRoute()
 const router = useRouter()
-
+const user = useUserStore()
 const sharedState = useSharedState()
 
 const layoutClick = () => {
@@ -49,6 +51,15 @@ const layoutClick = () => {
 onMounted(async () => {
   await useMallStore().getMallDiyTemplate()
 })
+
+watch(
+  () => route.matched,
+  async () => {
+    await user.getUserAccountInfo()
+  },
+  { immediate: true },
+  { deep: true }
+)
 </script>
 
 <style lang="scss" scoped>

+ 0 - 5
src/views/publicRecruitment/index.vue

@@ -3,15 +3,11 @@
   <div class="py-3" :class="customClass">
     <v-tabs v-model="tab" align-tabs="start" color="primary" bg-color="#fff" @update:model-value="getPositionList">
       <v-tab :value="1">{{ $t('publicRecruitment.myRecommendation') }}</v-tab>
-      <!-- <v-tab :value="2">{{ $t('publicRecruitment.withdrawalRecords') }}</v-tab> -->
     </v-tabs>
     <div class="mt-3">
       <div v-if="tab === 1">
         <myRecommendation></myRecommendation>
       </div>
-      <!-- <div v-if="tab === 2" class="pa-3 white-bgc" style="border-radius: 5px;">
-        <myRegistration></myRegistration>
-      </div> -->
     </div>
   </div>
 </template>
@@ -20,7 +16,6 @@
 defineOptions({name: 'personal-myPublicRecruitment-index'})
 import { ref } from 'vue'
 import myRecommendation from './myRecommendation.vue'
-// import myRegistration from './myRegistration.vue'
 
 defineProps({
   customClass: {

+ 0 - 9
src/views/publicRecruitment/myRecommendation.vue

@@ -26,7 +26,6 @@
 defineOptions({name: 'defineOptions-name'})
 import { ref } from 'vue'
 import { getDict } from '@/hooks/web/useDictionaries'
-import { useUserStore } from '@/store/user'
 import { 
   getHireJobCvRelCount, 
   getHireJobCvRelPage
@@ -35,14 +34,6 @@ import TablePage from './components/table.vue'
 // import bountyDisplay from './components/bountyDisplay.vue'
 
 const active = ref(0)
-
-// 更新账户信息
-const store = useUserStore()
-const updateAccountInfo = async () => {
-  await store.getUserAccountInfo()
-}
-updateAccountInfo()
-
 // 数据统计
 const statisticsList = ref([])
 const getData = async () => {

+ 0 - 9
src/views/recruit/personal/PersonalCenter/index.vue

@@ -50,11 +50,8 @@
 defineOptions({ name: 'person-center'})
 import { computed } from 'vue'
 import { getCurrentLocaleLang } from '@/utils/lang.js'
-import { useUserStore } from '@/store/user'
 import personCenterRoute from '@/router/modules/components/recruit/personCenter'
 
-const userStore = useUserStore()
-
 // 左侧菜单列表
 const list = computed(() => {
   return getList(personCenterRoute[0].children[0].children)
@@ -79,12 +76,6 @@ const getList = (arr, obj = []) => {
   })
   return obj
 } 
-
-// 更新账户信息
-const updateAccountInfo = async () => {
-  await userStore.getUserAccountInfo()
-}
-updateAccountInfo()
 </script>
 
 <style scoped lang="scss">