Commit 422ec1b4 by User

本地平台运行修改

parent 3faf04c4
# backend service base url, prod environment # backend service base url, prod environment
VITE_SERVICE_BASE_URL='' VITE_SERVICE_BASE_URL='http://localhost:80'
# other backend service base url, prod environment # other backend service base url, prod environment
VITE_OTHER_SERVICE_BASE_URL= `{ VITE_OTHER_SERVICE_BASE_URL= `{
......
# backend service base url, test environment # backend service base url, test environment
VITE_SERVICE_BASE_URL='' VITE_SERVICE_BASE_URL='http://localhost:80'
# other backend service base url, test environment # other backend service base url, test environment
VITE_OTHER_SERVICE_BASE_URL= `{ VITE_OTHER_SERVICE_BASE_URL= `{
......
...@@ -5,7 +5,7 @@ import { useRouterPush } from '@/hooks/common/router'; ...@@ -5,7 +5,7 @@ import { useRouterPush } from '@/hooks/common/router';
defineOptions({ name: 'ExceptionBase' }); defineOptions({ name: 'ExceptionBase' });
type ExceptionType = '403' | '404' | '500'; type ExceptionType = '401' | '403' | '404' | '500';
interface Props { interface Props {
/** /**
...@@ -23,6 +23,7 @@ const props = defineProps<Props>(); ...@@ -23,6 +23,7 @@ const props = defineProps<Props>();
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const iconMap: Record<ExceptionType, string> = { const iconMap: Record<ExceptionType, string> = {
'401': '401',
'403': 'no-permission', '403': 'no-permission',
'404': 'not-found', '404': 'not-found',
'500': 'service-error' '500': 'service-error'
......
...@@ -133,8 +133,8 @@ function getSiderCollapsedWidth() { ...@@ -133,8 +133,8 @@ function getSiderCollapsedWidth() {
<GlobalSider /> <GlobalSider />
</template> </template>
<GlobalMenu /> <GlobalMenu />
<GlobalContent style="display: none;" /> <GlobalContent />
<div id="extjs-root" style="width: 100%; height: 100%"></div> <!-- <div id="extjs-root" style="width: 100%; height: 100%"></div> -->
<ThemeDrawer /> <ThemeDrawer />
<template #footer> <template #footer>
<GlobalFooter /> <GlobalFooter />
......
...@@ -5,8 +5,8 @@ defineOptions({ ...@@ -5,8 +5,8 @@ defineOptions({
name: 'GlobalLogo' name: 'GlobalLogo'
}); });
const DisplayName = window.uiGlobalConfig.DisplayName; const DisplayName = '本地平台';
const Icon = window.uiGlobalConfig.Icon; const Icon = 'window.uiGlobalConfig.Icon';
interface Props { interface Props {
/** Whether to show the title */ /** Whether to show the title */
......
...@@ -16,7 +16,7 @@ import GlobalLogo from '../../global-logo/index.vue'; ...@@ -16,7 +16,7 @@ import GlobalLogo from '../../global-logo/index.vue';
defineOptions({ defineOptions({
name: 'VerticalMenuMix' name: 'VerticalMenuMix'
}); });
const DisplayName = window.uiGlobalConfig.DisplayName; const DisplayName = 'window.uiGlobalConfig.DisplayName';
const route = useRoute(); const route = useRoute();
const appStore = useAppStore(); const appStore = useAppStore();
const themeStore = useThemeStore(); const themeStore = useThemeStore();
......
...@@ -18,7 +18,7 @@ const isMixLayoutMode = computed(() => layoutMode.value.includes('mix')); ...@@ -18,7 +18,7 @@ const isMixLayoutMode = computed(() => layoutMode.value.includes('mix'));
const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wrapper'); const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wrapper');
const DisplayName = window.uiGlobalConfig.DisplayName; const DisplayName = 'window.uiGlobalConfig.DisplayName';
</script> </script>
<template> <template>
......
...@@ -9,7 +9,7 @@ export function setupLoading() { ...@@ -9,7 +9,7 @@ export function setupLoading() {
const { r, g, b } = getRgb(themeColor); const { r, g, b } = getRgb(themeColor);
// const DisplayName = '123'; // const DisplayName = '123';
const DisplayName = window.uiGlobalConfig.DisplayName; const DisplayName = 'window.uiGlobalConfig.DisplayName';
const primaryColor = `--primary-color: ${r} ${g} ${b}`; const primaryColor = `--primary-color: ${r} ${g} ${b}`;
const loadingClasses = [ const loadingClasses = [
......
...@@ -20,5 +20,9 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro ...@@ -20,5 +20,9 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
500: () => import("@/views/_builtin/500/index.vue"), 500: () => import("@/views/_builtin/500/index.vue"),
"iframe-page": () => import("@/views/_builtin/iframe-page/[url].vue"), "iframe-page": () => import("@/views/_builtin/iframe-page/[url].vue"),
login: () => import("@/views/_builtin/login/index.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"), home: () => import("@/views/home/index.vue"),
}; };
...@@ -73,5 +73,43 @@ export const generatedRoutes: GeneratedRoute[] = [ ...@@ -73,5 +73,43 @@ export const generatedRoutes: GeneratedRoute[] = [
constant: true, constant: true,
hideInMenu: 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 = { ...@@ -181,7 +181,11 @@ const routeMap: RouteMap = {
"500": "/500", "500": "/500",
"home": "/home", "home": "/home",
"iframe-page": "/iframe-page/:url", "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'; ...@@ -13,49 +13,103 @@ import { transformElegantRoutesToVueRoutes } from '../elegant/transform';
* @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route * @link https://github.com/soybeanjs/elegant-router?tab=readme-ov-file#custom-route
*/ */
const customRoutes: CustomRoute[] = [ const customRoutes: CustomRoute[] = [
// { {
// name: 'exception', name: 'exception',
// path: '/exception', path: '/exception',
// component: 'layout.base', component: 'layout.base',
// meta: { meta: {
// title: 'exception', title: 'exception',
// i18nKey: 'route.exception', i18nKey: 'route.exception',
// icon: 'ant-design:exception-outlined', icon: 'ant-design:exception-outlined',
// order: 7 order: 7
// }, },
// children: [ children: [
// { {
// name: 'exception_403', name: 'exception_403',
// path: '/exception/403', path: '/exception/403',
// component: 'view.403', component: 'view.403',
// meta: { meta: {
// title: 'exception_403', title: 'exception_403',
// i18nKey: 'route.exception_403', i18nKey: 'route.exception_403',
// icon: 'ic:baseline-block' icon: 'ic:baseline-block'
// } }
// }, },
// { {
// name: 'exception_404', name: 'exception_404',
// path: '/exception/404', path: '/exception/404',
// component: 'view.404', component: 'view.404',
// meta: { meta: {
// title: 'exception_404', title: 'exception_404',
// i18nKey: 'route.exception_404', i18nKey: 'route.exception_404',
// icon: 'ic:baseline-web-asset-off' icon: 'ic:baseline-web-asset-off'
// } }
// }, },
// { {
// name: 'exception_500', name: 'exception_500',
// path: '/exception/500', path: '/exception/500',
// component: 'view.500', component: 'view.500',
// meta: { meta: {
// title: 'exception_500', title: 'exception_500',
// i18nKey: 'route.exception_500', i18nKey: 'route.exception_500',
// icon: 'ic:baseline-wifi-off' 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', // name: 'document',
// path: '/document', // path: '/document',
...@@ -72,7 +126,9 @@ const customRoutes: CustomRoute[] = [ ...@@ -72,7 +126,9 @@ const customRoutes: CustomRoute[] = [
// path: '/document/antd', // path: '/document/antd',
// component: 'view.iframe-page', // component: 'view.iframe-page',
// props: { // props: {
// url: 'https://antdv.com/components/overview-cn' // url: 'https://antdv.com/components/overview-cn',
// kvid: 'A0B25952-82B6-4A1E-B567-4BCDF9463Fs9A1',
// type: 'iframe'
// }, // },
// meta: { // meta: {
// title: 'document_antd', // title: 'document_antd',
...@@ -178,7 +234,7 @@ const customRoutes: CustomRoute[] = [ ...@@ -178,7 +234,7 @@ const customRoutes: CustomRoute[] = [
// icon: 'logos:vue' // icon: 'logos:vue'
// } // }
// } // }
// ] // ]
// } // }
]; ];
/** /**
...@@ -186,86 +242,85 @@ const customRoutes: CustomRoute[] = [ ...@@ -186,86 +242,85 @@ const customRoutes: CustomRoute[] = [
* *
* @param MenuThree MenuThree * @param MenuThree MenuThree
*/ */
// 以下是获取菜单的示例
// ${window.uiGlobalConfig.InternalCode} // ${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=dashboard`);
const { data: menus } = await getRootMenu( // // const { data: menus } = await getRootMenu(
`/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=${window.uiGlobalConfig.InternalCode}` // // `/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=${window.uiGlobalConfig.InternalCode}`
); // // );
// const rootMenu =getRootMenu('/Restful/Kivii.Basic.Entities.Menu/Show.json?RootInternalCode=Dashboard');
const MenuThree = await getMenuThree(menus?.MenusMain?.Results); // const MenuThree = await getMenuThree(menus?.MenusMain?.Results);
const MenuRoot = menus?.MenuRoot; // const MenuRoot = menus?.MenuRoot;
// console.log(MenuRoot); // // console.log(MenuRoot);
// 存储 MenuRoot 到 store // // 存储 MenuRoot 到 store
if (MenuRoot) { // if (MenuRoot) {
setTimeout(() => { // setTimeout(() => {
const routeStore = useRouteStore(); // const routeStore = useRouteStore();
routeStore.setMenuRoot(MenuRoot); // routeStore.setMenuRoot(MenuRoot);
}, 1000); // }, 1000);
} // }
const MenuThree2 = generateRoutes(MenuThree); // const MenuThree2 = generateRoutes(MenuThree);
if (MenuThree2.length > 0) { // if (MenuThree2.length > 0) {
for (let i = 0; i < MenuThree2.length; i++) { // for (let i = 0; i < MenuThree2.length; i++) {
customRoutes.push(MenuThree2[i]); // customRoutes.push(MenuThree2[i]);
} // }
} // }
function getMenuThree(data: any) { // function getMenuThree(data: any) {
const cloneData = JSON.parse(JSON.stringify(data)); // 对源数据深度克隆 // const cloneData = JSON.parse(JSON.stringify(data)); // 对源数据深度克隆
return cloneData.filter((father: { Kvid: any; children: any; ParentKvid: undefined }) => { // 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);
const branchArr = cloneData.filter((child: { ParentKvid: any }) => father.Kvid == child.ParentKvid); // // eslint-disable-next-line no-unused-expressions
// eslint-disable-next-line no-unused-expressions // branchArr.length > 0 ? (father.children = branchArr) : '';
branchArr.length > 0 ? (father.children = branchArr) : ''; // // eslint-disable-next-line eqeqeq
// eslint-disable-next-line eqeqeq // return father.ParentKvid == undefined;
return father.ParentKvid == undefined; // });
}); // }
} // function generateRoutes(data: any[]) {
function generateRoutes(data: any[]) { // return data.map(item => {
return data.map(item => { // const route: any = {
const route: any = { // name: item.Type === 'System' ? `${item.Type}` : item.Kvid,
name: item.Type === 'System' ? `${item.Type}` : item.Kvid, // path: item.Type === 'System' ? `/${item.Type}` : `/${item.Kvid}`,
path: item.Type === 'System' ? `/${item.Type}` : `/${item.Kvid}`, // component: 'layout.base',
component: 'layout.base', // meta: {
meta: { // title: item.DisplayName,
title: item.DisplayName, // icon: 'mdi:file-document-multiple-outline',
icon: 'mdi:file-document-multiple-outline', // order: item.SortId,
order: item.SortId, // keepAlive: true
keepAlive: true // },
}, // children: []
children: [] // };
};
if (item.children && item.children.length > 0) { // if (item.children && item.children.length > 0) {
route.children = item.children.map( // route.children = item.children.map(
(child: { Remark: string; Type: string; Kvid: any; DisplayName: any; Icon: any; SortId: any }) => { // (child: { Remark: string; Type: string; Kvid: any; DisplayName: any; Icon: any; SortId: any }) => {
const sanitizedRemark = // const sanitizedRemark =
child.Remark && child.Remark.startsWith('/') ? child.Remark.replace(/^\//, '') : child.Remark; // child.Remark && child.Remark.startsWith('/') ? child.Remark.replace(/^\//, '') : child.Remark;
return { // return {
name: child.Type === 'System' ? `${item.Type}_${sanitizedRemark}` : `${item.Kvid}_${child.Kvid}`, // name: child.Type === 'System' ? `${item.Type}_${sanitizedRemark}` : `${item.Kvid}_${child.Kvid}`,
path: 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', // component: 'view.iframe-page',
props: { // props: {
url: child.Type === 'System' ? sanitizedRemark : '', // url: child.Type === 'System' ? sanitizedRemark : '',
kvid: child.Kvid, // kvid: child.Kvid,
type: child.Type // type: child.Type
}, // },
meta: { // meta: {
title: child.DisplayName, // title: child.DisplayName,
icon: child.Icon, // icon: child.Icon,
order: child.SortId, // order: child.SortId,
keepAlive: true, // keepAlive: true,
type: 'iframe' // type: 'iframe'
} // }
}; // };
} // }
); // );
} // }
return route; // return route;
}); // });
} // }
export function createStaticRoutes() { export function createStaticRoutes() {
const constantRoutes: ElegantRoute[] = []; const constantRoutes: ElegantRoute[] = [];
......
...@@ -36,6 +36,10 @@ declare module "@elegant-router/types" { ...@@ -36,6 +36,10 @@ declare module "@elegant-router/types" {
"home": "/home"; "home": "/home";
"iframe-page": "/iframe-page/:url"; "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";
}; };
/** /**
...@@ -86,6 +90,7 @@ declare module "@elegant-router/types" { ...@@ -86,6 +90,7 @@ declare module "@elegant-router/types" {
| "home" | "home"
| "iframe-page" | "iframe-page"
| "login" | "login"
| "test"
>; >;
/** /**
...@@ -109,6 +114,10 @@ declare module "@elegant-router/types" { ...@@ -109,6 +114,10 @@ declare module "@elegant-router/types" {
| "500" | "500"
| "iframe-page" | "iframe-page"
| "login" | "login"
| "test"
| "test_test1"
| "test_test2"
| "test_test3"
| "home" | "home"
>; >;
......
...@@ -15,7 +15,7 @@ declare global { ...@@ -15,7 +15,7 @@ declare global {
uiGlobalConfig: { uiGlobalConfig: {
InternalCode: string; InternalCode: string;
[key: string]: any; [key: string]: any;
} };
} }
interface ViewTransition { interface ViewTransition {
......
...@@ -174,7 +174,9 @@ const handleMenuAccess = async () => { ...@@ -174,7 +174,9 @@ const handleMenuAccess = async () => {
extTag.value = handler; extTag.value = handler;
} }
} else { } else {
hasError.value = true; // hasError.value = true;
selectTag.value = `${url}`;
console.log(selectTag.value);
} }
} catch (error) { } catch (error) {
console.error('Menu access error:', error); console.error('Menu access error:', error);
......
...@@ -3,7 +3,7 @@ import { computed } from 'vue'; ...@@ -3,7 +3,7 @@ import { computed } from 'vue';
import type { Component } from 'vue'; import type { Component } from 'vue';
import { getPaletteColorByNumber, mixColor } from '@sa/color'; import { getPaletteColorByNumber, mixColor } from '@sa/color';
import { $t } from '@/locales'; import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app'; // import { useAppStore } from '@/store/modules/app';
import { useThemeStore } from '@/store/modules/theme'; import { useThemeStore } from '@/store/modules/theme';
import { loginModuleRecord } from '@/constants/app'; import { loginModuleRecord } from '@/constants/app';
import PwdLogin from './modules/pwd-login.vue'; import PwdLogin from './modules/pwd-login.vue';
...@@ -19,10 +19,10 @@ interface Props { ...@@ -19,10 +19,10 @@ interface Props {
const props = defineProps<Props>(); const props = defineProps<Props>();
const appStore = useAppStore(); // const appStore = useAppStore();
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const DisplayName = window.uiGlobalConfig.DisplayName; const DisplayName = 'window.uiGlobalConfig.DisplayName';
const Icon = window.uiGlobalConfig.Icon; const Icon = 'window.uiGlobalConfig.Icon';
interface LoginModule { interface LoginModule {
label: string; label: string;
component: Component; 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