fix Bug Features CHANGELOG.ms

This commit is contained in:
Ah jung
2021-07-19 16:42:11 +08:00
parent 46dc7eb69e
commit b689fabfdd
148 changed files with 5829 additions and 4268 deletions

View File

@@ -3,43 +3,43 @@ import { ErrorPage, RedirectName, Layout } from '@/router/constant';
// 404 on a page
export const ErrorPageRoute: AppRouteRecordRaw = {
path: '/:path(.*)*',
name: 'ErrorPage',
component: Layout,
meta: {
title: 'ErrorPage',
hideBreadcrumb: true,
},
children: [
{
path: '/:path(.*)*',
name: 'ErrorPage',
component: ErrorPage,
meta: {
path: '/:path(.*)*',
name: 'ErrorPage',
component: Layout,
meta: {
title: 'ErrorPage',
hideBreadcrumb: true,
},
},
],
children: [
{
path: '/:path(.*)*',
name: 'ErrorPage',
component: ErrorPage,
meta: {
title: 'ErrorPage',
hideBreadcrumb: true,
},
},
],
};
export const RedirectRoute: AppRouteRecordRaw = {
path: '/redirect',
name: RedirectName,
component: Layout,
meta: {
title: RedirectName,
hideBreadcrumb: true,
},
children: [
{
path: '/redirect/:path(.*)',
name: RedirectName,
component: () => import('@/views/redirect/index.vue'),
meta: {
path: '/redirect',
name: RedirectName,
component: Layout,
meta: {
title: RedirectName,
hideBreadcrumb: true,
},
},
],
children: [
{
path: '/redirect/:path(.*)',
name: RedirectName,
component: () => import('@/views/redirect/index.vue'),
meta: {
title: RedirectName,
hideBreadcrumb: true,
},
},
],
};

View File

@@ -5,13 +5,13 @@ import { DashboardOutlined } from '@vicons/antd'
//前端路由映射表
export const constantRouterComponents = {
'Layout': () => import('@/layout/index.vue'), //布局
'DashboardConsole': () => import('@/views/dashboard/console/console.vue'), // 主控台
'DashboardMonitor': () => import('@/views/dashboard/monitor/monitor.vue'), // 监控页
'DashboardWorkplace': () => import('@/views/dashboard/workplace/workplace.vue'), // 工作台
'Layout': () => import('@/layout/index.vue'), //布局
'DashboardConsole': () => import('@/views/dashboard/console/console.vue'), // 主控台
'DashboardMonitor': () => import('@/views/dashboard/monitor/monitor.vue'), // 监控页
'DashboardWorkplace': () => import('@/views/dashboard/workplace/workplace.vue'), // 工作台
}
//前端路由图标映射表
export const constantRouterIcon = {
'DashboardOutlined': renderIcon(DashboardOutlined)
'DashboardOutlined': renderIcon(DashboardOutlined)
}

View File

@@ -11,34 +11,34 @@ import { RouteRecordRaw } from 'vue-router'
* @param parent
* @returns {*}
*/
export const routerGenerator = (routerMap, parent?):any[] => {
return routerMap.map(item => {
const currentRouter:any = {
// 路由地址 动态拼接生成如 /dashboard/workplace
path: `${ parent && parent.path || '' }/${ item.path }`,
// 路由名称,建议唯一
name: item.name || '',
// 该路由对应页面的 组件
component: constantRouterComponents[item.component],
// meta: 页面标题, 菜单图标, 页面权限(供指令权限用,可去掉)
meta: {
...item.meta,
label: item.meta.title,
icon: constantRouterIcon[item.meta.icon] || null,
permission: item.meta.permission || null
}
}
// 为了防止出现后端返回结果不规范,处理有可能出现拼接出两个 反斜杠
currentRouter.path = currentRouter.path.replace('//', '/')
// 重定向
item.redirect && (currentRouter.redirect = item.redirect)
// 是否有子菜单,并递归处理
if (item.children && item.children.length > 0) {
// Recursion
currentRouter.children = routerGenerator(item.children, currentRouter)
}
return currentRouter
})
export const routerGenerator = (routerMap, parent?): any[] => {
return routerMap.map(item => {
const currentRouter: any = {
// 路由地址 动态拼接生成如 /dashboard/workplace
path: `${ parent && parent.path || '' }/${ item.path }`,
// 路由名称,建议唯一
name: item.name || '',
// 该路由对应页面的 组件
component: constantRouterComponents[item.component],
// meta: 页面标题, 菜单图标, 页面权限(供指令权限用,可去掉)
meta: {
...item.meta,
label: item.meta.title,
icon: constantRouterIcon[item.meta.icon] || null,
permission: item.meta.permission || null
}
}
// 为了防止出现后端返回结果不规范,处理有可能出现拼接出两个 反斜杠
currentRouter.path = currentRouter.path.replace('//', '/')
// 重定向
item.redirect && (currentRouter.redirect = item.redirect)
// 是否有子菜单,并递归处理
if (item.children && item.children.length > 0) {
// Recursion
currentRouter.children = routerGenerator(item.children, currentRouter)
}
return currentRouter
})
}
@@ -48,18 +48,18 @@ export const routerGenerator = (routerMap, parent?):any[] => {
* @returns {Promise<Router>}
*/
export const generatorDynamicRouter = (): Promise<RouteRecordRaw[]> => {
return new Promise((resolve, reject) => {
adminMenus()
.then((result) => {
const routeList = routerGenerator(result)
const asyncRoutesList = [...constantRouter, ...routeList]
asyncRoutesList.forEach(item => {
router.addRoute(item)
})
resolve(asyncRoutesList)
})
.catch((err) => {
reject(err)
})
})
return new Promise((resolve, reject) => {
adminMenus()
.then((result) => {
const routeList = routerGenerator(result)
const asyncRoutesList = [...constantRouter, ...routeList]
asyncRoutesList.forEach(item => {
router.addRoute(item)
})
resolve(asyncRoutesList)
})
.catch((err) => {
reject(err)
})
})
}

View File

@@ -11,33 +11,33 @@ const modules = import.meta.globEager('./modules/**/*.ts');
const routeModuleList: RouteRecordRaw[] = [];
Object.keys(modules).forEach((key) => {
const mod = modules[key].default || {};
const modList = Array.isArray(mod) ? [...mod] : [mod];
routeModuleList.push(...modList);
const mod = modules[key].default || {};
const modList = Array.isArray(mod) ? [...mod] : [mod];
routeModuleList.push(...modList);
});
function sortRoute(a, b) {
return (a.meta.sort || 0) - (b.meta.sort || 0)
return (a.meta.sort || 0) - (b.meta.sort || 0)
}
routeModuleList.sort(sortRoute)
export const RootRoute: RouteRecordRaw = {
path: '/',
name: 'Root',
redirect: PageEnum.BASE_HOME,
meta: {
title: 'Root',
},
path: '/',
name: 'Root',
redirect: PageEnum.BASE_HOME,
meta: {
title: 'Root',
},
};
export const LoginRoute: RouteRecordRaw = {
path: '/login',
name: 'Login',
component: () => import('@/views/login/index.vue'),
meta: {
title: '登录',
},
path: '/login',
name: 'Login',
component: () => import('@/views/login/index.vue'),
meta: {
title: '登录',
},
};
//需要验证权限
@@ -48,16 +48,16 @@ export const asyncRoutes = [ErrorPageRoute, ...routeModuleList];
export const constantRouter = [LoginRoute, RootRoute, RedirectRoute]
const router = createRouter({
history: createWebHashHistory(''),
routes: constantRouter,
strict: true,
scrollBehavior: () => ({ left: 0, top: 0 }),
history: createWebHashHistory(''),
routes: constantRouter,
strict: true,
scrollBehavior: () => ({ left: 0, top: 0 }),
})
export function setupRouter(app: App) {
app.use(router)
// 创建路由守卫
createRouterGuards(router)
app.use(router)
// 创建路由守卫
createRouterGuards(router)
}
export default router

View File

@@ -1,6 +1,6 @@
import { RouteRecordRaw } from 'vue-router'
import { Layout } from '@/router/constant';
import { WalletOutlined } from '@vicons/antd'
import { WalletOutlined } from '@vicons/antd'
import { renderIcon } from '@/utils/index'
@@ -18,27 +18,36 @@ const routeName = 'comp'
*
* */
const routes: Array<RouteRecordRaw> = [
{
path: '/comp',
name: routeName,
redirect: '/comp/console',
component: Layout,
meta: {
title: '组件示例',
icon: renderIcon(WalletOutlined ),
sort: 8
},
children: [
{
path: 'table',
name: `${ routeName }_table`,
{
path: '/comp',
name: routeName,
redirect: '/comp/console',
component: Layout,
meta: {
title: '表格',
title: '组件示例',
icon: renderIcon(WalletOutlined),
sort: 8
},
component: () => import('@/views/comp/table/list.vue')
}
],
}
children: [
{
path: 'table',
name: `${ routeName }_table`,
meta: {
title: '表格',
},
component: () => import('@/views/comp/table/list.vue')
},
{
path: 'upload',
name: `${ routeName }_upload`,
meta: {
title: '上传',
},
component: () => import('@/views/comp/upload/index.vue')
}
],
}
]
export default routes

View File

@@ -16,48 +16,48 @@ const routeName = 'dashboard'
* @param meta.sort 排序越小越排前
* */
const routes: Array<RouteRecordRaw> = [
{
path: '/dashboard',
name: routeName,
redirect: '/dashboard/console',
component: Layout,
meta: {
title: 'Dashboard',
icon: renderIcon(DashboardOutlined),
permission: ['dashboard_console', 'dashboard_console', 'dashboard_workplace'],
sort: 0
},
children: [
{
path: 'console',
name: `${ routeName }_console`,
{
path: '/dashboard',
name: routeName,
redirect: '/dashboard/console',
component: Layout,
meta: {
title: '主控台',
permission: ['dashboard_console']
title: 'Dashboard',
icon: renderIcon(DashboardOutlined),
permission: ['dashboard_console', 'dashboard_console', 'dashboard_workplace'],
sort: 0
},
component: () => import('@/views/dashboard/console/console.vue')
},
// {
// path: 'monitor',
// name: `${ routeName }_monitor`,
// meta: {
// title: '监控页',
// permission: ['dashboard_monitor']
// },
// component: () => import('@/views/dashboard/monitor/monitor.vue')
// },
{
path: 'workplace',
name: `${ routeName }_workplace`,
meta: {
title: '工作台',
keepAlive: true,
permission: ['dashboard_workplace']
},
component: () => import('@/views/dashboard/workplace/workplace.vue')
}
]
}
children: [
{
path: 'console',
name: `${ routeName }_console`,
meta: {
title: '主控台',
permission: ['dashboard_console']
},
component: () => import('@/views/dashboard/console/console.vue')
},
// {
// path: 'monitor',
// name: `${ routeName }_monitor`,
// meta: {
// title: '监控页',
// permission: ['dashboard_monitor']
// },
// component: () => import('@/views/dashboard/monitor/monitor.vue')
// },
{
path: 'workplace',
name: `${ routeName }_workplace`,
meta: {
title: '工作台',
keepAlive: true,
permission: ['dashboard_workplace']
},
component: () => import('@/views/dashboard/workplace/workplace.vue')
}
]
}
]
export default routes

View File

@@ -15,44 +15,44 @@ import { renderIcon } from '@/utils/index'
*
* */
const routes: Array<RouteRecordRaw> = [
{
path: '/form',
name: 'Form',
redirect: '/form/basic-form',
component: Layout,
meta: {
title: '表单页面',
icon: renderIcon(ProfileOutlined),
sort: 1
},
children: [
{
path: 'basic-form',
name: 'form-basic-form',
{
path: '/form',
name: 'Form',
redirect: '/form/basic-form',
component: Layout,
meta: {
title: '基础表单',
title: '表单页面',
icon: renderIcon(ProfileOutlined),
sort: 1
},
component: () => import('@/views/form/basicForm/index.vue')
},
{
path: 'step-form',
name: 'form-step-form',
meta: {
title: '分步表单',
},
component: () => import('@/views/form/stepForm/stepForm.vue')
},
{
path: 'detail',
name: 'form-detail',
meta: {
title: '表单详情',
},
component: () => import('@/views/form/detail/index.vue')
},
children: [
{
path: 'basic-form',
name: 'form-basic-form',
meta: {
title: '基础表单',
},
component: () => import('@/views/form/basicForm/index.vue')
},
{
path: 'step-form',
name: 'form-step-form',
meta: {
title: '分步表单',
},
component: () => import('@/views/form/stepForm/stepForm.vue')
},
{
path: 'detail',
name: 'form-detail',
meta: {
title: '表单详情',
},
component: () => import('@/views/form/detail/index.vue')
},
],
}
],
}
]
export default routes

View File

@@ -1,6 +1,6 @@
import { RouteRecordRaw } from 'vue-router'
import { Layout } from '@/router/constant';
import { CheckCircleOutlined } from '@vicons/antd'
import { CheckCircleOutlined } from '@vicons/antd'
import { renderIcon } from '@/utils/index'
/**

View File

@@ -1,19 +1,37 @@
import type { RouteRecordRaw, RouteMeta } from 'vue-router';
import { defineComponent } from 'vue';
import { RoleEnum } from '@/enums/roleEnum'
export interface Meta {
// 名称
title: string
// 是否忽略权限
ignoreAuth?: boolean
roles?: RoleEnum[]
// 是否不缓存
noKeepAlive?: boolean
// 是否固定在tab上
affix?: boolean
// tab上的图标
icon?: string
// 跳转地址
frameSrc?: string
// 外链跳转地址
externalLink?: string
export type Component<T extends any = any> =
| ReturnType<typeof defineComponent>
| (() => Promise<typeof import('*.vue')>)
| (() => Promise<T>);
// @ts-ignore
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
name: string;
meta: RouteMeta;
component?: Component | string;
components?: Component;
children?: AppRouteRecordRaw[];
props?: Recordable;
fullPath?: string;
}
export interface Meta {
// 名称
title: string
// 是否忽略权限
ignoreAuth?: boolean
roles?: RoleEnum[]
// 是否不缓存
noKeepAlive?: boolean
// 是否固定在tab上
affix?: boolean
// tab上的图标
icon?: string
// 跳转地址
frameSrc?: string
// 外链跳转地址
externalLink?: string
}