feat: 新增登录接口请求

This commit is contained in:
奔跑的面条
2022-05-20 16:12:27 +08:00
parent 55159be0dc
commit 5f5731f813
16 changed files with 144 additions and 65 deletions
+6
View File
@@ -0,0 +1,6 @@
/**
* * 请求失败统一处理
*/
export const httpErrorHandle = () => {
window['$message'].error('请求失败,请稍后重试!')
}
+1
View File
@@ -7,3 +7,4 @@ export * from '@/utils/plugin'
export * from '@/utils/componets'
export * from '@/utils/type'
export * from '@/utils/file'
export * from '@/utils/http'
+4 -5
View File
@@ -2,7 +2,7 @@ import { useRoute } from 'vue-router'
import { ResultEnum } from '@/enums/httpEnum'
import { ErrorPageNameMap, PageEnum } from '@/enums/pageEnum'
import { docPath, giteeSourceCodePath } from '@/settings/pathConst'
import { cryptoDecode } from './crypto'
import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d'
import { StorageEnum } from '@/enums/storageEnum'
import { clearLocalStorage, getLocalStorage } from './storage'
import router from '@/router'
@@ -104,7 +104,7 @@ export const reloadRoutePage = () => {
* * 退出
*/
export const logout = () => {
clearLocalStorage(StorageEnum.GO_LOGIN_INFO_STORE)
clearLocalStorage(StorageEnum.GO_SYSTEM_STORE)
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
}
@@ -167,10 +167,9 @@ export const goHome = () => {
*/
export const loginCheck = () => {
try {
const info = getLocalStorage(StorageEnum.GO_LOGIN_INFO_STORE)
const info = getLocalStorage(StorageEnum.GO_SYSTEM_STORE)
if (!info) return false
const decodeInfo = cryptoDecode(info)
if (decodeInfo) {
if (info[SystemStoreEnum.USER_INFO][SystemStoreUserInfoEnum.USER_TOKEN]) {
return true
}
return false