|
@@ -37,12 +37,12 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="d-flex" style="height: 50px;">
|
|
|
- <div class="btns d-flex align-center" v-if="!getToken() && showLoginBtn">
|
|
|
+ <div class="btns d-flex align-center" v-if="!isLogin && showLoginBtn">
|
|
|
<v-btn color="primary" style="color: #fff !important; background-color: #00897B;" @click="handleLogin">{{ $t('login.loginOrRegister') }}</v-btn>
|
|
|
</div>
|
|
|
|
|
|
<!-- 头像用户名 -->
|
|
|
- <div class="d-flex align-center color-333" v-if="getToken()">
|
|
|
+ <div class="d-flex align-center color-333" v-if="isLogin">
|
|
|
<span class="cursor-pointer mr-5 commonHover" @click="handleSwitch">我要招聘</span>
|
|
|
<span class="cursor-pointer commonHover" @click="router.push({ path: paths[6] })">
|
|
|
<span>
|
|
@@ -124,7 +124,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { computed, onMounted, ref } from 'vue'
|
|
|
-import { getToken } from '@/utils/auth'
|
|
|
+import { getToken, getRefreshToken } from '@/utils/auth'
|
|
|
import { useUserStore } from '@/store/user'
|
|
|
// import { useLocaleStore } from '@/store/locale'
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
@@ -135,6 +135,7 @@ import { getUserBindEnterpriseList, getUserRegisterEnterpriseApply } from '@/api
|
|
|
import MessageNotification from '../message.vue'
|
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
|
import defineListPage from '@/views/entrances/navBar/components/defineListPage'
|
|
|
+import { update } from 'lodash'
|
|
|
|
|
|
defineOptions({ name: 'personal-navbar' })
|
|
|
|
|
@@ -281,11 +282,20 @@ let baseInfo = ref(JSON.parse(localStorage.getItem('baseInfo')) || {}) // 人才
|
|
|
let userInfo = ref(JSON.parse(localStorage.getItem('userInfo')) || {})
|
|
|
let userAccount = ref(JSON.parse(localStorage.getItem('userAccount')) || {}) // 账户信息
|
|
|
|
|
|
+const isLogin = ref(Boolean(getRefreshToken(2)))
|
|
|
+const updatePage = () => {
|
|
|
+ baseInfo.value = JSON.parse(localStorage.getItem('baseInfo')) || {}
|
|
|
+ userInfo.value = JSON.parse(localStorage.getItem('userInfo')) || {}
|
|
|
+ userAccount.value = JSON.parse(localStorage.getItem('userAccount')) || {}
|
|
|
+ isLogin.value = Boolean(getRefreshToken(2))
|
|
|
+}
|
|
|
+
|
|
|
userStore.$subscribe((mutation, state) => {
|
|
|
if (Object.keys(state.baseInfo).length) baseInfo.value = state.baseInfo
|
|
|
if (state.userInfo && Object.keys(state.userInfo).length) userInfo.value = state?.userInfo
|
|
|
if (Object.keys(state.userAccount).length) userAccount.value = state.userAccount
|
|
|
if (state.token) showBall.value = true
|
|
|
+ updatePage()
|
|
|
})
|
|
|
|
|
|
const handleLogin = () => {
|