|
@@ -56,8 +56,10 @@ export const useUserStore = defineStore('user',
|
|
|
data.account = data.phone
|
|
|
passwordLogin(data).then(res => {
|
|
|
if (data.isEnterprise) { // 企业邮箱登录
|
|
|
- this.changeRole('emailLogin', res)
|
|
|
+ localStorage.setItem('emailLoginInfo', JSON.stringify(res))
|
|
|
+ window.location.href = '/enterpriseVerification'
|
|
|
} else {
|
|
|
+ // 个人手机号登录
|
|
|
setToken(res.accessToken)
|
|
|
setRefreshToken(res.refreshToken)
|
|
|
this.accountInfo = res
|
|
@@ -122,9 +124,9 @@ export const useUserStore = defineStore('user',
|
|
|
localStorage.clear()
|
|
|
},
|
|
|
// 切换为招聘者
|
|
|
- async changeRole (type, res) {
|
|
|
+ async changeRole (res) {
|
|
|
let data
|
|
|
- if (type === 'emailLogin') {
|
|
|
+ if (res?.type === 'emailLogin') {
|
|
|
data = res
|
|
|
} else {
|
|
|
// 先退出个人登录
|
|
@@ -140,9 +142,9 @@ export const useUserStore = defineStore('user',
|
|
|
await this.getEnterpriseInfo()
|
|
|
await this.getEnterpriseUserAccountInfo()
|
|
|
updateEventList(false)
|
|
|
- Snackbar.success('切换成功')
|
|
|
+ Snackbar.success(res?.type === 'emailLogin' ? '登录成功' : '切换成功')
|
|
|
await this.checkEnterpriseBaseInfo() // 校验企业必填信息
|
|
|
- window.location.href = '/enterprise'
|
|
|
+ setTimeout(() => { window.location.href = '/enterprise' }, 1000)
|
|
|
},
|
|
|
// 获取当前登录的企业用户信息
|
|
|
async getEnterpriseInfo () {
|