初始化
This commit is contained in:
55
src/constants/app.ts
Normal file
55
src/constants/app.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { transformRecordToOption } from '@/utils/common';
|
||||
|
||||
export const GLOBAL_HEADER_MENU_ID = '__GLOBAL_HEADER_MENU__';
|
||||
|
||||
export const GLOBAL_SIDER_MENU_ID = '__GLOBAL_SIDER_MENU__';
|
||||
|
||||
export const themeSchemaRecord: Record<UnionKey.ThemeScheme, App.I18n.I18nKey> = {
|
||||
light: 'theme.themeSchema.light',
|
||||
dark: 'theme.themeSchema.dark',
|
||||
auto: 'theme.themeSchema.auto'
|
||||
};
|
||||
|
||||
export const themeSchemaOptions = transformRecordToOption(themeSchemaRecord);
|
||||
|
||||
export const loginModuleRecord: Record<UnionKey.LoginModule, App.I18n.I18nKey> = {
|
||||
'pwd-login': 'page.login.pwdLogin.title',
|
||||
'reset-pwd': 'page.login.resetPwd.title'
|
||||
};
|
||||
|
||||
export const themeLayoutModeRecord: Record<UnionKey.ThemeLayoutMode, App.I18n.I18nKey> = {
|
||||
vertical: 'theme.layoutMode.vertical',
|
||||
'vertical-mix': 'theme.layoutMode.vertical-mix',
|
||||
horizontal: 'theme.layoutMode.horizontal',
|
||||
'horizontal-mix': 'theme.layoutMode.horizontal-mix'
|
||||
};
|
||||
|
||||
export const themeLayoutModeOptions = transformRecordToOption(themeLayoutModeRecord);
|
||||
|
||||
export const themeScrollModeRecord: Record<UnionKey.ThemeScrollMode, App.I18n.I18nKey> = {
|
||||
wrapper: 'theme.scrollMode.wrapper',
|
||||
content: 'theme.scrollMode.content'
|
||||
};
|
||||
|
||||
export const themeScrollModeOptions = transformRecordToOption(themeScrollModeRecord);
|
||||
|
||||
export const themeTabModeRecord: Record<UnionKey.ThemeTabMode, App.I18n.I18nKey> = {
|
||||
chrome: 'theme.tab.mode.chrome',
|
||||
button: 'theme.tab.mode.button'
|
||||
};
|
||||
|
||||
export const themeTabModeOptions = transformRecordToOption(themeTabModeRecord);
|
||||
|
||||
export const themePageAnimationModeRecord: Record<UnionKey.ThemePageAnimateMode, App.I18n.I18nKey> = {
|
||||
'fade-slide': 'theme.page.mode.fade-slide',
|
||||
fade: 'theme.page.mode.fade',
|
||||
'fade-bottom': 'theme.page.mode.fade-bottom',
|
||||
'fade-scale': 'theme.page.mode.fade-scale',
|
||||
'zoom-fade': 'theme.page.mode.zoom-fade',
|
||||
'zoom-out': 'theme.page.mode.zoom-out',
|
||||
none: 'theme.page.mode.none'
|
||||
};
|
||||
|
||||
export const themePageAnimationModeOptions = transformRecordToOption(themePageAnimationModeRecord);
|
||||
|
||||
export const DARK_CLASS = 'dark';
|
||||
69
src/constants/business.ts
Normal file
69
src/constants/business.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import { transformRecordToOption } from '@/utils/common';
|
||||
|
||||
export const enableStatusRecord: Record<Api.Common.EnableStatus, App.I18n.I18nKey> = {
|
||||
'1': 'page.system.common.status.enable',
|
||||
'2': 'page.system.common.status.disable'
|
||||
};
|
||||
|
||||
export const enableStatusOptions = transformRecordToOption(enableStatusRecord);
|
||||
|
||||
export const commonStatusRecord: Record<Api.SystemManage.CommonStatus, App.I18n.I18nKey> = {
|
||||
0: 'page.system.common.status.enable',
|
||||
1: 'page.system.common.status.disable'
|
||||
};
|
||||
|
||||
export const commonStatusOptions = [
|
||||
{ value: 0, label: commonStatusRecord[0] },
|
||||
{ value: 1, label: commonStatusRecord[1] }
|
||||
] satisfies CommonType.Option<Api.SystemManage.CommonStatus, App.I18n.I18nKey>[];
|
||||
|
||||
export const dictStatusRecord: Record<'0' | '1', App.I18n.I18nKey> = {
|
||||
'0': 'page.system.common.status.enable',
|
||||
'1': 'page.system.common.status.disable'
|
||||
};
|
||||
|
||||
export const dictStatusOptions = [
|
||||
{ value: 0, label: dictStatusRecord['0'] },
|
||||
{ value: 1, label: dictStatusRecord['1'] }
|
||||
] satisfies CommonType.Option<Api.Dict.DictStatus, App.I18n.I18nKey>[];
|
||||
|
||||
export const userGenderRecord: Record<Api.SystemManage.UserGender, App.I18n.I18nKey> = {
|
||||
0: 'page.system.user.gender.unknown',
|
||||
1: 'page.system.user.gender.male',
|
||||
2: 'page.system.user.gender.female'
|
||||
};
|
||||
|
||||
export const userGenderOptions = transformRecordToOption(userGenderRecord);
|
||||
|
||||
export const menuTypeRecord: Record<Api.SystemManage.MenuType, App.I18n.I18nKey> = {
|
||||
1: 'page.system.menu.type.directory',
|
||||
2: 'page.system.menu.type.menu',
|
||||
3: 'page.system.menu.type.button'
|
||||
};
|
||||
|
||||
export const menuTypeOptions = [
|
||||
{ value: 1, label: menuTypeRecord[1] },
|
||||
{ value: 2, label: menuTypeRecord[2] },
|
||||
{ value: 3, label: menuTypeRecord[3] }
|
||||
] satisfies CommonType.Option<Api.SystemManage.MenuType, App.I18n.I18nKey>[];
|
||||
|
||||
export const roleTypeRecord: Record<Api.SystemManage.RoleType, App.I18n.I18nKey> = {
|
||||
1: 'page.system.role.type.system',
|
||||
2: 'page.system.role.type.custom'
|
||||
};
|
||||
|
||||
export const roleTypeOptions = [
|
||||
{ value: 1, label: roleTypeRecord[1] },
|
||||
{ value: 2, label: roleTypeRecord[2] }
|
||||
] satisfies CommonType.Option<Api.SystemManage.RoleType, App.I18n.I18nKey>[];
|
||||
|
||||
export const menuRouteKindRecord: Record<Api.SystemManage.MenuRouteKind, App.I18n.I18nKey> = {
|
||||
dir: 'page.system.menu.routeKindEnum.directory',
|
||||
view: 'page.system.menu.routeKindEnum.view',
|
||||
single: 'page.system.menu.routeKindEnum.single',
|
||||
iframe: 'page.system.menu.routeKindEnum.iframe',
|
||||
external: 'page.system.menu.routeKindEnum.external',
|
||||
redirect: 'page.system.menu.routeKindEnum.redirect'
|
||||
};
|
||||
|
||||
export const menuRouteKindOptions = transformRecordToOption(menuRouteKindRecord);
|
||||
8
src/constants/common.ts
Normal file
8
src/constants/common.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { transformRecordToOption } from '@/utils/common';
|
||||
|
||||
export const yesOrNoRecord: Record<CommonType.YesOrNo, App.I18n.I18nKey> = {
|
||||
Y: 'common.yesOrNo.yes',
|
||||
N: 'common.yesOrNo.no'
|
||||
};
|
||||
|
||||
export const yesOrNoOptions = transformRecordToOption(yesOrNoRecord);
|
||||
8
src/constants/map-sdk.ts
Normal file
8
src/constants/map-sdk.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/** baidu map sdk url */
|
||||
export const BAIDU_MAP_SDK_URL = `https://api.map.baidu.com/getscript?v=3.0&ak=KSezYymXPth1DIGILRX3oYN9PxbOQQmU&services=&t=20210201100830&s=1`;
|
||||
|
||||
/** Amap sdk url */
|
||||
export const AMAP_SDK_URL = 'https://webapi.amap.com/maps?v=2.0&key=e7bd02bd504062087e6563daf4d6721d';
|
||||
|
||||
/** tencent sdk url */
|
||||
export const TENCENT_MAP_SDK_URL = 'https://map.qq.com/api/gljs?v=1.exp&key=A6DBZ-KXPLW-JKSRY-ONZF4-CPHY3-K6BL7';
|
||||
25
src/constants/reg.ts
Normal file
25
src/constants/reg.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export const REG_USER_NAME = /^[\u4E00-\u9FA5a-zA-Z0-9_-]{4,16}$/;
|
||||
|
||||
/** Phone reg */
|
||||
export const REG_PHONE =
|
||||
/^[1](([3][0-9])|([4][01456789])|([5][012356789])|([6][2567])|([7][0-8])|([8][0-9])|([9][012356789]))[0-9]{8}$/;
|
||||
|
||||
/**
|
||||
* Password reg
|
||||
*
|
||||
* 6-18 characters, including letters, numbers, and underscores
|
||||
*/
|
||||
export const REG_PWD = /^\w{6,18}$/;
|
||||
|
||||
/** Email reg */
|
||||
export const REG_EMAIL = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
||||
|
||||
/** Six digit code reg */
|
||||
export const REG_CODE_SIX = /^\d{6}$/;
|
||||
|
||||
/** Four digit code reg */
|
||||
export const REG_CODE_FOUR = /^\d{4}$/;
|
||||
|
||||
/** Url reg */
|
||||
export const REG_URL =
|
||||
/(((^https?:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
|
||||
5
src/constants/service.ts
Normal file
5
src/constants/service.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
/** Web 端网关前缀 */
|
||||
export const WEB_SERVICE_PREFIX = '/admin-api';
|
||||
|
||||
/** System 模块接口前缀 */
|
||||
export const SYSTEM_SERVICE_PREFIX = `${WEB_SERVICE_PREFIX}/system`;
|
||||
Reference in New Issue
Block a user