feat: 首页架构

This commit is contained in:
MTrun
2021-12-18 16:36:43 +08:00
parent 44667a89f0
commit 90e45f6c23
31 changed files with 548 additions and 62 deletions
+45 -13
View File
@@ -1,18 +1,7 @@
import { ResultEnum } from '@/enums/httpEnum'
import { ErrorPageNameMap } from '@/enums/pageEnum'
import { ErrorPageNameMap, PageEnum } from '@/enums/pageEnum'
import router from '@/router'
/**
* * 错误页重定向
* @param icon
* @returns
*/
export const redirectErrorPage = (code: ResultEnum) => {
if (!code) return false
const pageName = ErrorPageNameMap.get(code)
if (!pageName) return false
routerTurnByName(pageName)
}
import { docPath, giteeSourceCodePath } from '@/settings/pathConst'
/**
* * 根据名字跳转路由
@@ -29,3 +18,46 @@ export const routerTurnByName = (pageName: string, isReplace?: boolean) => {
name: pageName
})
}
/**
* * 错误页重定向
* @param icon
* @returns
*/
export const redirectErrorPage = (code: ResultEnum) => {
if (!code) return false
const pageName = ErrorPageNameMap.get(code)
if (!pageName) return false
routerTurnByName(pageName)
}
/**
* * 退出
*/
export const logout = () => {
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
}
/**
* * 打开项目文档
* @param url
*/
export const openDoc = () => {
window.open(docPath, 'blank')
}
/**
* * 打开码云仓库地址
* @param url
*/
export const openGiteeSourceCode = () => {
window.open(giteeSourceCodePath, 'blank')
}
/**
* * 新开页面
* @param url
*/
export const openNewWindow = (url: string) => {
window.open(url, 'blank')
}