feat: 系统模块初始化

This commit is contained in:
baiqi 2023-06-09 13:46:11 +08:00 committed by 刘瑞斌
parent 2cbf2b90c9
commit 301feaf714
8 changed files with 101 additions and 15 deletions

View File

@ -0,0 +1,25 @@
import { Modal } from '@arco-design/web-vue';
import type { ModalConfig } from '@arco-design/web-vue';
export type ModalType = 'info' | 'success' | 'warning' | 'error';
export type ModalSize = 'small' | 'medium' | 'large' | 'full';
export type ModalMode = 'default' | 'weak';
export interface ModalOptions extends ModalConfig {
mode?: ModalMode;
type: ModalType;
size?: ModalSize;
}
export default function useModal() {
return {
openModal: (options: ModalOptions) =>
Modal[options.type]({
...options,
titleAlign: 'start',
modalClass: `ms-modal-${options.mode || 'default'} ms-modal-${options.size || 'medium'}`,
}),
};
}

View File

@ -10,6 +10,9 @@ import localeApiTest from '@/views/api-test/locale/en-US';
export default { export default {
message: { message: {
'menu.apiTest': 'Api Test', 'menu.apiTest': 'Api Test',
'menu.settings': 'System Settings',
'menu.settings.user': 'User',
'menu.settings.organization': 'Organization',
'navbar.action.locale': 'Switch to English', 'navbar.action.locale': 'Switch to English',
...sys, ...sys,
...localeSettings, ...localeSettings,

View File

@ -0,0 +1 @@
export default {};

View File

@ -9,20 +9,9 @@ import localeApiTest from '@/views/api-test/locale/zh-CN';
export default { export default {
message: { message: {
'menu.component': '组件库', 'menu.settings': '系统设置',
'menu.component.demo': '组件示例', 'menu.settings.user': '用户',
'menu.apitest': '接口测试', 'menu.settings.organization': '组织',
'menu.dashboard': '仪表盘',
'menu.minder': '脑图',
'menu.server.dashboard': '仪表盘-服务端',
'menu.server.workplace': '工作台-服务端',
'menu.server.monitor': '实时监控-服务端',
'menu.list': '列表页',
'menu.result': '结果页',
'menu.exception': '异常页',
'menu.form': '表单页',
'menu.profile': '详情页',
'menu.visualization': '数据可视化',
'menu.user': '个人中心', 'menu.user': '个人中心',
'navbar.action.locale': '切换为中文', 'navbar.action.locale': '切换为中文',
...sys, ...sys,

View File

@ -0,0 +1 @@
export default {};

View File

@ -76,7 +76,6 @@ setupMock({
{ {
path: 'list', path: 'list',
name: 'apiTest', name: 'apiTest',
component: () => import('@/views/api-test/index.vue'),
meta: { meta: {
locale: 'menu.apiTest', locale: 'menu.apiTest',
roles: ['*'], roles: ['*'],
@ -85,6 +84,26 @@ setupMock({
}, },
], ],
}, },
{
path: '/system',
name: 'system',
meta: {
locale: 'menu.settings',
icon: 'icon-dashboard',
order: 0,
},
children: [
{
path: 'user',
name: 'user',
meta: {
locale: 'menu.settings.user',
roles: ['*'],
icon: 'icon-computer',
},
},
],
},
]; ];
return successResponseWrap(menuList); return successResponseWrap(menuList);
}); });

View File

@ -0,0 +1,27 @@
import { DEFAULT_LAYOUT } from '../base';
import { AppRouteRecordRaw } from '../types';
const ApiTest: AppRouteRecordRaw = {
path: '/system',
name: 'system',
component: DEFAULT_LAYOUT,
meta: {
locale: 'menu.settings',
icon: 'icon-dashboard',
order: 0,
},
children: [
{
path: 'user',
name: 'user',
component: () => import('@/views/system/user/index.vue'),
meta: {
locale: 'menu.settings.user',
roles: ['*'],
icon: 'icon-computer',
},
},
],
};
export default ApiTest;

View File

@ -0,0 +1,21 @@
<template>
<div>
<a-button @click="open">Modal</a-button>
</div>
</template>
<script setup lang="ts">
import useModal from '@/hooks/useModal';
const { openModal } = useModal();
function open() {
openModal({
mode: 'weak',
type: 'info',
content: '这是一个弱提示',
});
}
</script>
<style lang="less" scoped></style>