chore: format code
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { UserApiType } from '@/apis/types';
|
||||
import type { UserInfo } from '@vben/types';
|
||||
|
||||
import type { UserApiType } from '@/apis/types';
|
||||
|
||||
import { request } from '@/forward';
|
||||
|
||||
/**
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<script lang="ts" setup>
|
||||
import 'dayjs/locale/zh-cn';
|
||||
|
||||
import { preferences, usePreferences } from '@vben-core/preferences';
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { GlobalProvider } from '@vben/common-ui';
|
||||
import { preferences, usePreferences } from '@vben-core/preferences';
|
||||
|
||||
import { ConfigProvider, theme } from 'ant-design-vue';
|
||||
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
||||
import dayjs from 'dayjs';
|
||||
import { computed } from 'vue';
|
||||
|
||||
import 'dayjs/locale/zh-cn';
|
||||
|
||||
defineOptions({ name: 'App' });
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import '@vben/styles';
|
||||
import { createApp } from 'vue';
|
||||
|
||||
import { setupI18n } from '@vben/locales';
|
||||
import '@vben/styles';
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
|
||||
import { setupStore } from '@/store';
|
||||
import { setupI18n } from '@vben/locales';
|
||||
import { createApp } from 'vue';
|
||||
|
||||
import App from './app.vue';
|
||||
import { router } from './router';
|
||||
|
@@ -1,16 +1,16 @@
|
||||
<script lang="ts" setup>
|
||||
import type { NotificationItem } from '@vben/common-ui';
|
||||
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
import { useAccessStore } from '@vben-core/stores';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { Notification, UserDropdown } from '@vben/common-ui';
|
||||
import { IcRoundCreditScore, MdiDriveDocument, MdiGithub } from '@vben/icons';
|
||||
import { BasicLayout } from '@vben/layouts';
|
||||
import { $t } from '@vben/locales';
|
||||
import { openWindow } from '@vben/utils';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
import { useAccessStore } from '@vben-core/stores';
|
||||
|
||||
// https://avatar.vercel.sh/vercel.svg?text=Vaa
|
||||
// https://avatar.vercel.sh/1
|
||||
|
@@ -1,11 +1,12 @@
|
||||
import { generatorMenus, generatorRoutes } from '@vben-core/helpers';
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
import { useAccessStore } from '@vben-core/stores';
|
||||
import type { RouteLocationNormalized, Router } from 'vue-router';
|
||||
|
||||
import { LOGIN_PATH } from '@vben/constants';
|
||||
import { $t } from '@vben/locales';
|
||||
import { startProgress, stopProgress } from '@vben/utils';
|
||||
import { generatorMenus, generatorRoutes } from '@vben-core/helpers';
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
import { useAccessStore } from '@vben-core/stores';
|
||||
|
||||
import { useTitle } from '@vueuse/core';
|
||||
|
||||
import { dynamicRoutes } from '@/router/routes';
|
||||
@@ -81,15 +82,16 @@ function setupAccessGuard(router: Router) {
|
||||
// 生成路由表
|
||||
// 当前登录用户拥有的角色标识列表
|
||||
const userRoles = accessStore.getUserRoles;
|
||||
const routes = await generatorRoutes(dynamicRoutes, userRoles);
|
||||
const accessibleRoutes = await generatorRoutes(dynamicRoutes, userRoles);
|
||||
// 动态添加到router实例内
|
||||
routes.forEach((route) => router.addRoute(route));
|
||||
accessibleRoutes.forEach((route) => router.addRoute(route));
|
||||
|
||||
const menus = await generatorMenus(routes, router);
|
||||
// 生成菜单
|
||||
const menus = await generatorMenus(accessibleRoutes, router);
|
||||
|
||||
// 保存菜单信息和路由信息
|
||||
accessStore.setAccessMenus(menus);
|
||||
accessStore.setAccessRoutes(routes);
|
||||
accessStore.setAccessRoutes(accessibleRoutes);
|
||||
const redirectPath = (from.query.redirect ?? to.path) as string;
|
||||
|
||||
return {
|
||||
|
@@ -1,8 +1,9 @@
|
||||
import type { RouteRecordName, RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { traverseTreeValues } from '@vben/utils';
|
||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
||||
|
||||
import { traverseTreeValues } from '@vben/utils';
|
||||
|
||||
import { createRouterGuard } from './guard';
|
||||
import { routes } from './routes';
|
||||
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { AuthPageLayoutType } from '@/layouts';
|
||||
import { Fallback } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
import { AuthPageLayoutType } from '@/layouts';
|
||||
|
||||
import Login from '@/views/_essential/authentication/login.vue';
|
||||
|
||||
/** 基本路由,这些路由是必须存在的 */
|
||||
const essentialRoutes: RouteRecordRaw[] = [
|
||||
const essentialsRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
component: AuthPageLayoutType,
|
||||
meta: {
|
||||
@@ -69,7 +69,7 @@ const essentialRoutes: RouteRecordRaw[] = [
|
||||
},
|
||||
// 错误页
|
||||
{
|
||||
component: Fallback,
|
||||
component: () => import('@/views/_essential/fallback/not-found.vue'),
|
||||
meta: {
|
||||
hideInBreadcrumb: true,
|
||||
hideInMenu: true,
|
||||
@@ -82,4 +82,4 @@ const essentialRoutes: RouteRecordRaw[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export { essentialRoutes };
|
||||
export { essentialsRoutes };
|
@@ -1,8 +1,9 @@
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { BasicLayout, IFrameView } from '@/layouts';
|
||||
import { VBEN_GITHUB_URL } from '@vben/constants';
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
|
||||
import { BasicLayout, IFrameView } from '@/layouts';
|
||||
import { $t } from '@vben/locales/helper';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import { mergeRouteModules } from '@vben-core/helpers';
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { essentialRoutes } from './_essential';
|
||||
import { mergeRouteModules } from '@vben-core/helpers';
|
||||
|
||||
import { essentialsRoutes } from './_essentials';
|
||||
|
||||
const dynamicRouteFiles = import.meta.glob('./dynamic/**/*.ts', {
|
||||
eager: true,
|
||||
@@ -23,6 +24,6 @@ const staticRoutes: RouteRecordRaw[] = mergeRouteModules(staticRouteFiles);
|
||||
const externalRoutes: RouteRecordRaw[] = mergeRouteModules(externalRouteFiles);
|
||||
|
||||
/** 路由列表,由基本路由+静态路由组成 */
|
||||
const routes: RouteRecordRaw[] = [...essentialRoutes, ...staticRoutes];
|
||||
const routes: RouteRecordRaw[] = [...essentialsRoutes, ...staticRoutes];
|
||||
|
||||
export { dynamicRoutes, externalRoutes, routes };
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import type { InitStoreOptions } from '@vben-core/stores';
|
||||
|
||||
import { initStore } from '@vben-core/stores';
|
||||
|
||||
import type { App } from 'vue';
|
||||
|
||||
import { initStore } from '@vben-core/stores';
|
||||
|
||||
/**
|
||||
* @zh_CN 初始化pinia
|
||||
* @param app vue app 实例
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<script lang="ts" setup>
|
||||
import type { LoginCodeParams } from '@vben/common-ui';
|
||||
|
||||
import { AuthenticationCodeLogin } from '@vben/common-ui';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { AuthenticationCodeLogin } from '@vben/common-ui';
|
||||
|
||||
defineOptions({ name: 'CodeLogin' });
|
||||
|
||||
const loading = ref(false);
|
||||
|
@@ -1,7 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import { AuthenticationForgetPassword } from '@vben/common-ui';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { AuthenticationForgetPassword } from '@vben/common-ui';
|
||||
|
||||
defineOptions({ name: 'ForgetPassword' });
|
||||
|
||||
const loading = ref(false);
|
||||
|
@@ -1,15 +1,16 @@
|
||||
<script lang="ts" setup>
|
||||
import type { LoginAndRegisterParams } from '@vben/common-ui';
|
||||
|
||||
import { computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { AuthenticationLogin } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { useRequest } from '@vben-core/request';
|
||||
import { useAccessStore } from '@vben-core/stores';
|
||||
|
||||
import { getUserInfo, userLogin } from '@/apis';
|
||||
import { AuthenticationLogin } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { notification } from 'ant-design-vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
defineOptions({ name: 'Login' });
|
||||
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<script lang="ts" setup>
|
||||
import type { LoginAndRegisterParams } from '@vben/common-ui';
|
||||
|
||||
import { AuthenticationRegister } from '@vben/common-ui';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { AuthenticationRegister } from '@vben/common-ui';
|
||||
|
||||
defineOptions({ name: 'Register' });
|
||||
|
||||
const loading = ref(false);
|
||||
|
@@ -0,0 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { Fallback } from '@vben/common-ui';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Fallback />
|
||||
</template>
|
Reference in New Issue
Block a user