Commit 422ec1b4 by User

本地平台运行修改

parent 3faf04c4
# backend service base url, prod environment
VITE_SERVICE_BASE_URL=''
VITE_SERVICE_BASE_URL='http://localhost:80'
# other backend service base url, prod environment
VITE_OTHER_SERVICE_BASE_URL= `{
......
# backend service base url, test environment
VITE_SERVICE_BASE_URL=''
VITE_SERVICE_BASE_URL='http://localhost:80'
# other backend service base url, test environment
VITE_OTHER_SERVICE_BASE_URL= `{
......
......@@ -5,7 +5,7 @@ import { useRouterPush } from '@/hooks/common/router';
defineOptions({ name: 'ExceptionBase' });
type ExceptionType = '403' | '404' | '500';
type ExceptionType = '401' | '403' | '404' | '500';
interface Props {
/**
......@@ -23,6 +23,7 @@ const props = defineProps<Props>();
const { routerPushByKey } = useRouterPush();
const iconMap: Record<ExceptionType, string> = {
'401': '401',
'403': 'no-permission',
'404': 'not-found',
'500': 'service-error'
......
......@@ -133,8 +133,8 @@ function getSiderCollapsedWidth() {
<GlobalSider />
</template>
<GlobalMenu />
<GlobalContent style="display: none;" />
<div id="extjs-root" style="width: 100%; height: 100%"></div>
<GlobalContent />
<!-- <div id="extjs-root" style="width: 100%; height: 100%"></div> -->
<ThemeDrawer />
<template #footer>
<GlobalFooter />
......
......@@ -5,8 +5,8 @@ defineOptions({
name: 'GlobalLogo'
});
const DisplayName = window.uiGlobalConfig.DisplayName;
const Icon = window.uiGlobalConfig.Icon;
const DisplayName = '本地平台';
const Icon = 'window.uiGlobalConfig.Icon';
interface Props {
/** Whether to show the title */
......
......@@ -16,7 +16,7 @@ import GlobalLogo from '../../global-logo/index.vue';
defineOptions({
name: 'VerticalMenuMix'
});
const DisplayName = window.uiGlobalConfig.DisplayName;
const DisplayName = 'window.uiGlobalConfig.DisplayName';
const route = useRoute();
const appStore = useAppStore();
const themeStore = useThemeStore();
......
......@@ -18,7 +18,7 @@ const isMixLayoutMode = computed(() => layoutMode.value.includes('mix'));
const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wrapper');
const DisplayName = window.uiGlobalConfig.DisplayName;
const DisplayName = 'window.uiGlobalConfig.DisplayName';
</script>
<template>
......
......@@ -9,7 +9,7 @@ export function setupLoading() {
const { r, g, b } = getRgb(themeColor);
// const DisplayName = '123';
const DisplayName = window.uiGlobalConfig.DisplayName;
const DisplayName = 'window.uiGlobalConfig.DisplayName';
const primaryColor = `--primary-color: ${r} ${g} ${b}`;
const loadingClasses = [
......
......@@ -20,5 +20,9 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
500: () => import("@/views/_builtin/500/index.vue"),
"iframe-page": () => import("@/views/_builtin/iframe-page/[url].vue"),
login: () => import("@/views/_builtin/login/index.vue"),
test: () => import("@/views/_builtin/test/index.vue"),
test_test1: () => import("@/views/_builtin/test/test1/index.vue"),
test_test2: () => import("@/views/_builtin/test/test2/index.vue"),
test_test3: () => import("@/views/_builtin/test/test3/index.vue"),
home: () => import("@/views/home/index.vue"),
};
......@@ -73,5 +73,43 @@ export const generatedRoutes: GeneratedRoute[] = [
constant: true,
hideInMenu: true
}
},
{
name: 'test',
path: '/test',
component: 'layout.base',
meta: {
title: 'test',
i18nKey: 'route.test'
},
children: [
{
name: 'test_test1',
path: '/test/test1',
component: 'view.test_test1',
meta: {
title: 'test_test1',
i18nKey: 'route.test_test1'
}
},
{
name: 'test_test2',
path: '/test/test2',
component: 'view.test_test2',
meta: {
title: 'test_test2',
i18nKey: 'route.test_test2'
}
},
{
name: 'test_test3',
path: '/test/test3',
component: 'view.test_test3',
meta: {
title: 'test_test3',
i18nKey: 'route.test_test3'
}
}
]
}
];
......@@ -181,7 +181,11 @@ const routeMap: RouteMap = {
"500": "/500",
"home": "/home",
"iframe-page": "/iframe-page/:url",
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?"
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?",
"test": "/test",
"test_test1": "/test/test1",
"test_test2": "/test/test2",
"test_test3": "/test/test3"
};
/**
......
......@@ -13,49 +13,103 @@ import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
* @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route
*/
const customRoutes: CustomRoute[] = [
// {
// name: 'exception',
// path: '/exception',
// component: 'layout.base',
// meta: {
// title: 'exception',
// i18nKey: 'route.exception',
// icon: 'ant-design:exception-outlined',
// order: 7
// },
// children: [
// {
// name: 'exception_403',
// path: '/exception/403',
// component: 'view.403',
// meta: {
// title: 'exception_403',
// i18nKey: 'route.exception_403',
// icon: 'ic:baseline-block'
// }
// },
// {
// name: 'exception_404',
// path: '/exception/404',
// component: 'view.404',
// meta: {
// title: 'exception_404',
// i18nKey: 'route.exception_404',
// icon: 'ic:baseline-web-asset-off'
// }
// },
// {
// name: 'exception_500',
// path: '/exception/500',
// component: 'view.500',
// meta: {
// title: 'exception_500',
// i18nKey: 'route.exception_500',
// icon: 'ic:baseline-wifi-off'
// }
// },
// ]
// }
{
name: 'exception',
path: '/exception',
component: 'layout.base',
meta: {
title: 'exception',
i18nKey: 'route.exception',
icon: 'ant-design:exception-outlined',
order: 7
},
children: [
{
name: 'exception_403',
path: '/exception/403',
component: 'view.403',
meta: {
title: 'exception_403',
i18nKey: 'route.exception_403',
icon: 'ic:baseline-block'
}
},
{
name: 'exception_404',
path: '/exception/404',
component: 'view.404',
meta: {
title: 'exception_404',
i18nKey: 'route.exception_404',
icon: 'ic:baseline-web-asset-off'
}
},
{
name: 'exception_500',
path: '/exception/500',
component: 'view.500',
meta: {
title: 'exception_500',
i18nKey: 'route.exception_500',
icon: 'ic:baseline-wifi-off'
}
}
]
},
{
name: 'test' as any,
path: '/test' as any,
component: 'layout.base',
meta: {
title: '测试页面',
i18nKey: 'route.test' as any,
icon: 'mdi:test-tube',
order: 8
},
children: [
{
name: 'test_page' as any,
path: '/test/page' as any,
component: 'view._builtin.test' as any,
meta: {
title: '测试页面',
i18nKey: 'route.test_page' as any,
icon: 'mdi:test-tube-empty'
}
},
{
name: 'test_page1' as any,
path: '/test/test1' as any,
component: 'view._builtin.test.test1' as any,
meta: {
title: '测试页面1',
i18nKey: 'route.test_page1' as any,
icon: 'mdi:numeric-1-box'
}
},
{
name: 'test_page2' as any,
path: '/test/test2' as any,
component: 'view._builtin.test.test2' as any,
meta: {
title: '测试页面2',
i18nKey: 'route.test_page2' as any,
icon: 'mdi:numeric-2-box'
}
},
{
name: 'test_page3' as any,
path: '/test/test3' as any,
component: 'view._builtin.test.test3' as any,
meta: {
title: '测试页面3',
i18nKey: 'route.test_page3' as any,
icon: 'mdi:numeric-3-box'
}
}
]
}
// 以下是iframe-page的示例
// {
// name: 'document',
// path: '/document',
......@@ -72,7 +126,9 @@ const customRoutes: CustomRoute[] = [
// path: '/document/antd',
// component: 'view.iframe-page',
// props: {
// url: 'https://antdv.com/components/overview-cn'
// url: 'https://antdv.com/components/overview-cn',
// kvid: 'A0B25952-82B6-4A1E-B567-4BCDF9463Fs9A1',
// type: 'iframe'
// },
// meta: {
// title: 'document_antd',
......@@ -178,7 +234,7 @@ const customRoutes: CustomRoute[] = [
// icon: 'logos:vue'
// }
// }
// ]
// ]
// }
];
/**
......@@ -186,86 +242,85 @@ const customRoutes: CustomRoute[] = [
*
* @param MenuThree MenuThree
*/
// 以下是获取菜单的示例
// ${window.uiGlobalConfig.InternalCode}
// const { data: menus } = await getRootMenu(`/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=dashboard`);
const { data: menus } = await getRootMenu(
`/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=${window.uiGlobalConfig.InternalCode}`
);
// const rootMenu =getRootMenu('/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=Dashboard');
// // const { data: menus } = await getRootMenu(
// // `/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=${window.uiGlobalConfig.InternalCode}`
// // );
const MenuThree = await getMenuThree(menus?.MenusMain?.Results);
const MenuRoot = menus?.MenuRoot;
// console.log(MenuRoot);
// 存储 MenuRoot 到 store
// const MenuThree = await getMenuThree(menus?.MenusMain?.Results);
// const MenuRoot = menus?.MenuRoot;
// // console.log(MenuRoot);
// // 存储 MenuRoot 到 store
if (MenuRoot) {
setTimeout(() => {
const routeStore = useRouteStore();
routeStore.setMenuRoot(MenuRoot);
}, 1000);
}
// if (MenuRoot) {
// setTimeout(() => {
// const routeStore = useRouteStore();
// routeStore.setMenuRoot(MenuRoot);
// }, 1000);
// }
const MenuThree2 = generateRoutes(MenuThree);
if (MenuThree2.length > 0) {
for (let i = 0; i < MenuThree2.length; i++) {
customRoutes.push(MenuThree2[i]);
}
}
function getMenuThree(data: any) {
const cloneData = JSON.parse(JSON.stringify(data)); // 对源数据深度克隆
return cloneData.filter((father: { Kvid: any; children: any; ParentKvid: undefined }) => {
// eslint-disable-next-line eqeqeq
const branchArr = cloneData.filter((child: { ParentKvid: any }) => father.Kvid == child.ParentKvid);
// eslint-disable-next-line no-unused-expressions
branchArr.length > 0 ? (father.children = branchArr) : '';
// eslint-disable-next-line eqeqeq
return father.ParentKvid == undefined;
});
}
function generateRoutes(data: any[]) {
return data.map(item => {
const route: any = {
name: item.Type === 'System' ? `${item.Type}` : item.Kvid,
path: item.Type === 'System' ? `/${item.Type}` : `/${item.Kvid}`,
component: 'layout.base',
meta: {
title: item.DisplayName,
icon: 'mdi:file-document-multiple-outline',
order: item.SortId,
keepAlive: true
},
children: []
};
// const MenuThree2 = generateRoutes(MenuThree);
// if (MenuThree2.length > 0) {
// for (let i = 0; i < MenuThree2.length; i++) {
// customRoutes.push(MenuThree2[i]);
// }
// }
// function getMenuThree(data: any) {
// const cloneData = JSON.parse(JSON.stringify(data)); // 对源数据深度克隆
// return cloneData.filter((father: { Kvid: any; children: any; ParentKvid: undefined }) => {
// const branchArr = cloneData.filter((child: { ParentKvid: any }) => father.Kvid === child.ParentKvid);
// // eslint-disable-next-line no-unused-expressions
// branchArr.length > 0 ? (father.children = branchArr) : '';
// // eslint-disable-next-line eqeqeq
// return father.ParentKvid == undefined;
// });
// }
// function generateRoutes(data: any[]) {
// return data.map(item => {
// const route: any = {
// name: item.Type === 'System' ? `${item.Type}` : item.Kvid,
// path: item.Type === 'System' ? `/${item.Type}` : `/${item.Kvid}`,
// component: 'layout.base',
// meta: {
// title: item.DisplayName,
// icon: 'mdi:file-document-multiple-outline',
// order: item.SortId,
// keepAlive: true
// },
// children: []
// };
if (item.children && item.children.length > 0) {
route.children = item.children.map(
(child: { Remark: string; Type: string; Kvid: any; DisplayName: any; Icon: any; SortId: any }) => {
const sanitizedRemark =
child.Remark && child.Remark.startsWith('/') ? child.Remark.replace(/^\//, '') : child.Remark;
return {
name: child.Type === 'System' ? `${item.Type}_${sanitizedRemark}` : `${item.Kvid}_${child.Kvid}`,
path: child.Type === 'System' ? `/${item.Type}/${sanitizedRemark}` : `/${item.Kvid}/${child.Kvid}`,
component: 'view.iframe-page',
props: {
url: child.Type === 'System' ? sanitizedRemark : '',
kvid: child.Kvid,
type: child.Type
},
meta: {
title: child.DisplayName,
icon: child.Icon,
order: child.SortId,
keepAlive: true,
type: 'iframe'
}
};
}
);
}
// if (item.children && item.children.length > 0) {
// route.children = item.children.map(
// (child: { Remark: string; Type: string; Kvid: any; DisplayName: any; Icon: any; SortId: any }) => {
// const sanitizedRemark =
// child.Remark && child.Remark.startsWith('/') ? child.Remark.replace(/^\//, '') : child.Remark;
// return {
// name: child.Type === 'System' ? `${item.Type}_${sanitizedRemark}` : `${item.Kvid}_${child.Kvid}`,
// path: child.Type === 'System' ? `/${item.Type}/${sanitizedRemark}` : `/${item.Kvid}/${child.Kvid}`,
// component: 'view.iframe-page',
// props: {
// url: child.Type === 'System' ? sanitizedRemark : '',
// kvid: child.Kvid,
// type: child.Type
// },
// meta: {
// title: child.DisplayName,
// icon: child.Icon,
// order: child.SortId,
// keepAlive: true,
// type: 'iframe'
// }
// };
// }
// );
// }
return route;
});
}
// return route;
// });
// }
export function createStaticRoutes() {
const constantRoutes: ElegantRoute[] = [];
......
......@@ -36,6 +36,10 @@ declare module "@elegant-router/types" {
"home": "/home";
"iframe-page": "/iframe-page/:url";
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?";
"test": "/test";
"test_test1": "/test/test1";
"test_test2": "/test/test2";
"test_test3": "/test/test3";
};
/**
......@@ -86,6 +90,7 @@ declare module "@elegant-router/types" {
| "home"
| "iframe-page"
| "login"
| "test"
>;
/**
......@@ -109,6 +114,10 @@ declare module "@elegant-router/types" {
| "500"
| "iframe-page"
| "login"
| "test"
| "test_test1"
| "test_test2"
| "test_test3"
| "home"
>;
......
......@@ -15,7 +15,7 @@ declare global {
uiGlobalConfig: {
InternalCode: string;
[key: string]: any;
}
};
}
interface ViewTransition {
......
......@@ -174,7 +174,9 @@ const handleMenuAccess = async () => {
extTag.value = handler;
}
} else {
hasError.value = true;
// hasError.value = true;
selectTag.value = `${url}`;
console.log(selectTag.value);
}
} catch (error) {
console.error('Menu access error:', error);
......
......@@ -3,7 +3,7 @@ import { computed } from 'vue';
import type { Component } from 'vue';
import { getPaletteColorByNumber, mixColor } from '@sa/color';
import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app';
// import { useAppStore } from '@/store/modules/app';
import { useThemeStore } from '@/store/modules/theme';
import { loginModuleRecord } from '@/constants/app';
import PwdLogin from './modules/pwd-login.vue';
......@@ -19,10 +19,10 @@ interface Props {
const props = defineProps<Props>();
const appStore = useAppStore();
// const appStore = useAppStore();
const themeStore = useThemeStore();
const DisplayName = window.uiGlobalConfig.DisplayName;
const Icon = window.uiGlobalConfig.Icon;
const DisplayName = 'window.uiGlobalConfig.DisplayName';
const Icon = 'window.uiGlobalConfig.Icon';
interface LoginModule {
label: string;
component: Component;
......
<script setup lang="ts">
// 测试页面组件
</script>
<template>
<div class="h-full wh-full flex-col flex-center">
<div class="text-primary text-32px font-bold mb-24px">测试页面</div>
<div class="text-16px mb-12px">这是一个用于测试的页面组件</div>
<div class="text-14px text-gray-400">您可以在这里添加任何需要测试的内容</div>
</div>
</template>
<style scoped></style>
<script setup lang="ts">
// 测试页面1组件
</script>
<template>
<div class="h-full wh-full flex-col flex-center">
<div class="text-primary text-32px font-bold mb-24px">测试页面12</div>
<div class="text-16px mb-12px">这是测试页面1</div>
<div class="text-14px text-gray-400">测试子菜单项是否能正常展示</div>
</div>
</template>
<style scoped></style>
<script setup lang="ts">
// 测试页面2组件
</script>
<template>
<div class="h-full wh-full flex-col flex-center">
<div class="text-primary text-32px font-bold mb-24px">测试页面2</div>
<div class="text-16px mb-12px">这是测试页面2</div>
<div class="text-14px text-gray-400">测试子菜单项是否能正常展示</div>
</div>
</template>
<style scoped></style>
<script setup lang="ts">
// 测试页面3组件
</script>
<template>
<div class="h-full wh-full flex-col flex-center">
<div class="text-primary text-32px font-bold mb-24px">测试页面3</div>
<div class="text-16px mb-12px">这是测试页面3</div>
<div class="text-14px text-gray-400">测试子菜单项是否能正常展示</div>
</div>
</template>
<style scoped></style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment