feat: 系统模块初始化
This commit is contained in:
parent
2cbf2b90c9
commit
301feaf714
|
@ -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'}`,
|
||||
}),
|
||||
};
|
||||
}
|
|
@ -10,6 +10,9 @@ import localeApiTest from '@/views/api-test/locale/en-US';
|
|||
export default {
|
||||
message: {
|
||||
'menu.apiTest': 'Api Test',
|
||||
'menu.settings': 'System Settings',
|
||||
'menu.settings.user': 'User',
|
||||
'menu.settings.organization': 'Organization',
|
||||
'navbar.action.locale': 'Switch to English',
|
||||
...sys,
|
||||
...localeSettings,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export default {};
|
|
@ -9,20 +9,9 @@ import localeApiTest from '@/views/api-test/locale/zh-CN';
|
|||
|
||||
export default {
|
||||
message: {
|
||||
'menu.component': '组件库',
|
||||
'menu.component.demo': '组件示例',
|
||||
'menu.apitest': '接口测试',
|
||||
'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.settings': '系统设置',
|
||||
'menu.settings.user': '用户',
|
||||
'menu.settings.organization': '组织',
|
||||
'menu.user': '个人中心',
|
||||
'navbar.action.locale': '切换为中文',
|
||||
...sys,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export default {};
|
|
@ -76,7 +76,6 @@ setupMock({
|
|||
{
|
||||
path: 'list',
|
||||
name: 'apiTest',
|
||||
component: () => import('@/views/api-test/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.apiTest',
|
||||
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);
|
||||
});
|
||||
|
|
|
@ -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;
|
|
@ -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>
|
Loading…
Reference in New Issue