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
+2 -2
View File
@@ -1,4 +1,4 @@
import { h } from 'vue'
import { h, DefineComponent } from 'vue'
import { NIcon } from 'naive-ui'
/**
@@ -14,7 +14,7 @@ export function getUUID(randomLength: number) {
/**
* * render 图标
*/
export const renderIcon = (icon: typeof NIcon) => {
export const renderIcon = (icon: any) => {
return () => h(NIcon, null, { default: () => h(icon) })
}
+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')
}
+5
View File
@@ -1,5 +1,10 @@
import { useDesignStore } from '@/store/modules/designStore/designStore'
/**
* * 修改主题色
* @param themeName 主题名称
* @returns
*/
export const setHtmlTheme = (themeName?: string) => {
const e = window.document.documentElement
if (themeName) {