From 215d8bab380728164d7fe2958c2d2d1151fce892 Mon Sep 17 00:00:00 2001 From: Vben <anncwb@126.com> Date: 星期六, 10 四月 2021 21:41:22 +0800 Subject: [PATCH] refactor: refactor store --- src/settings/projectSetting.ts | 194 ++++++++++++++++++++++++++---------------------- 1 files changed, 104 insertions(+), 90 deletions(-) diff --git a/src/settings/projectSetting.ts b/src/settings/projectSetting.ts index 54d2c80..24ffb4b 100644 --- a/src/settings/projectSetting.ts +++ b/src/settings/projectSetting.ts @@ -1,162 +1,176 @@ -import type { ProjectConfig } from '/@/types/config'; - -import { MenuTypeEnum, MenuModeEnum, TriggerEnum } from '/@/enums/menuEnum'; -import { ContentEnum, PermissionModeEnum, ThemeEnum, RouterTransitionEnum } from '/@/enums/appEnum'; -import { primaryColor } from '../../build/config/lessModifyVars'; -import { isProdMode } from '/@/utils/env'; +import type { ProjectConfig } from '/#/config'; +import { MenuTypeEnum, MenuModeEnum, TriggerEnum, MixSidebarTriggerEnum } from '/@/enums/menuEnum'; +import { CacheTypeEnum } from '/@/enums/cacheEnum'; +import { + ContentEnum, + PermissionModeEnum, + ThemeEnum, + RouterTransitionEnum, + SettingButtonPositionEnum, +} from '/@/enums/appEnum'; +import { SIDE_BAR_BG_COLOR_LIST, HEADER_PRESET_BG_COLOR_LIST } from './designSetting'; +import { primaryColor } from '../../build/config/themeConfig'; // ! You need to clear the browser cache after the change const setting: ProjectConfig = { - // locale setting - locale: { - // Locale - lang: 'zh_CN', - // Default locale - fallback: 'zh_CN', - // available Locales - availableLocales: ['zh_CN', 'en'], - }, - - // color - // TODO 涓婚鑹� - themeColor: primaryColor, - // Whether to show the configuration button showSettingButton: true, - // 鏉冮檺妯″紡 + // Whether to show the theme switch button + showDarkModeToggle: true, + + // `Settings` button position + settingButtonPosition: SettingButtonPositionEnum.AUTO, + + // Permission mode permissionMode: PermissionModeEnum.ROLE, - // 缃戠珯鐏拌壊妯″紡锛岀敤浜庡彲鑳芥偧蹇电殑鏃ユ湡寮�鍚� + // Permission-related cache is stored in sessionStorage or localStorage + permissionCacheType: CacheTypeEnum.LOCAL, + + // color + themeColor: primaryColor, + + // Website gray mode, open for possible mourning dates grayMode: false, - // 鑹插急妯″紡 + // Color Weakness Mode colorWeak: false, - // 鏄惁鍙栨秷鑿滃崟,椤堕儴,澶氭爣绛鹃〉鏄剧ず, 鐢ㄤ簬鍙兘鍐呭祵鍦ㄥ埆鐨勭郴缁熷唴 + // Whether to cancel the menu, the top, the multi-tab page display, for possible embedded in other systems fullContent: false, // content mode contentMode: ContentEnum.FULL, - // 鏄惁鏄剧ずlogo + // Whether to display the logo showLogo: true, - // 鏄惁鏄剧ず椤佃剼 - showFooter: true, + // Whether to show footer + showFooter: false, - // 澶撮儴閰嶇疆 + // Header configuration headerSetting: { // header bg color - bgColor: '#ffffff', + bgColor: HEADER_PRESET_BG_COLOR_LIST[0], + // Fixed at the top fixed: true, - // 鏄惁鏄剧ず椤堕儴 + // Whether to show top show: true, // theme theme: ThemeEnum.LIGHT, - // 寮�鍚攣灞忓姛鑳� + // Whether to enable the lock screen function useLockPage: true, - // 鏄剧ず鍒锋柊鎸夐挳 - showRedo: true, - // 鏄剧ず鍏ㄥ睆鎸夐挳 + // Whether to show the full screen button showFullScreen: true, - // 鏄剧ず鏂囨。鎸夐挳 + // Whether to show the document button showDoc: true, - // 鏄剧ず娑堟伅涓績鎸夐挳 + // Whether to show the notification button showNotice: true, + // Whether to display the menu search + showSearch: true, }, - // 鑿滃崟閰嶇疆 + // Menu configuration menuSetting: { // sidebar menu bg color - bgColor: '#273352', - + bgColor: SIDE_BAR_BG_COLOR_LIST[0], + // Whether to fix the left menu fixed: true, - // 鑿滃崟鎶樺彔 + // Menu collapse collapsed: false, - // 鎶樺彔鑿滃崟鏃跺�欐槸鍚︽樉绀鸿彍鍗曞悕 + // Whether to display the menu name when folding the menu collapsedShowTitle: false, - // 鏄惁鍙嫋鎷� - hasDrag: false, - // 鏄惁鏄剧ず 娌℃湁dom + // Whether it can be dragged + // Only limited to the opening of the left menu, the mouse has a drag bar on the right side of the menu + canDrag: false, + // Whether to show no dom show: true, - // 鏄惁鏄剧ず 鏈塪om - hidden: true, - // 鏄惁鏄剧ず鎼滅储妗� - showSearch: true, - // 鑿滃崟瀹藉害 + // Whether to show dom + hidden: false, + // Menu width menuWidth: 210, - // 鑿滃崟妯″紡 + // Menu mode mode: MenuModeEnum.INLINE, - // 鑿滃崟绫诲瀷 + // Menu type type: MenuTypeEnum.SIDEBAR, - // 鑿滃崟涓婚 + // Menu theme theme: ThemeEnum.DARK, - // 鍒嗗壊鑿滃崟 + // Split menu split: false, - // 椤堕儴鑿滃崟甯冨眬 + // Top menu layout topMenuAlign: 'center', - // 鎶樺彔鑿滃崟鏃跺�欓殣钘忔悳绱㈡ - collapsedShowSearch: false, - // 鎶樺彔瑙﹀彂鍣ㄧ殑浣嶇疆 + // Fold trigger position trigger: TriggerEnum.HEADER, - // 寮�鍚墜椋庣惔妯″紡,鍙樉绀轰竴涓彍鍗� + // Turn on accordion mode, only show a menu accordion: true, + // Switch page to close menu + closeMixSidebarOnChange: false, + // Module opening method 鈥榗lick鈥� |'hover' + mixSideTrigger: MixSidebarTriggerEnum.CLICK, + // Fixed expanded menu + mixSideFixed: false, }, - // 澶氭爣绛� + // Multi-label multiTabsSetting: { - // 寮�鍚� + // Turn on show: true, - // 寮�鍚揩閫熸搷浣� + // Is it possible to drag and drop sorting tabs + canDrag: true, + // Turn on quick actions showQuick: true, - // 鏍囩椤电紦瀛樻渶澶ф暟閲� - max: 12, + // Whether to show the refresh button + showRedo: true, + // Whether to show the collapse button + showFold: true, }, - // 鏄惁寮�鍚疜eepAlive缂撳瓨 寮�鍙戞椂鍊欐渶濂藉叧闂�,涓嶇劧姣忔閮介渶瑕佹竻闄ょ紦瀛� + // Transition Setting + transitionSetting: { + // Whether to open the page switching animation + // The disabled state will also disable pageLoadinng + enable: true, + + // Route basic switching animation + basicTransition: RouterTransitionEnum.FADE_SIDE, + + // Whether to open page switching loading + // Only open when enable=true + openPageLoading: true, + + // Whether to open the top progress bar + openNProgress: false, + }, + + // Whether to enable KeepAlive cache is best to close during development, otherwise the cache needs to be cleared every time openKeepAlive: true, - // 鑷姩閿佸睆鏃堕棿锛屼负0涓嶉攣灞忋�� 鍗曚綅鍒嗛挓 榛樿0 + // Automatic screen lock time, 0 does not lock the screen. Unit minute default 0 lockTime: 0, - // 鏄剧ず闈㈠寘灞� + // Whether to show breadcrumbs showBreadCrumb: true, - // 鏄剧ず闈㈠寘灞戝浘鏍� + // Whether to show the breadcrumb icon showBreadCrumbIcon: false, - // 浣跨敤error-handler-plugin - useErrorHandle: isProdMode(), + // Use error-handler-plugin + useErrorHandle: false, - // 寮�鍚〉闈㈠垏鎹㈠姩鐢� - openRouterTransition: true, - - // 璺敱鍒囨崲鍔ㄧ敾 - routerTransition: RouterTransitionEnum.FADE_SIDE, - - // 鏄惁寮�鍚櫥褰曞畨鍏ㄦ牎楠� - openLoginVerify: true, - - // 鏄惁寮�鍚〉闈㈠垏鎹oading - openPageLoading: true, - - // 鏄惁寮�鍚洖鍒伴《閮� + // Whether to open back to top useOpenBackTop: true, - // 寮�鍚《閮ㄨ繘搴︽潯 - openNProgress: isProdMode(), - - // 鏄惁鍙互宓屽叆iframe椤甸潰 + // Is it possible to embed iframe pages canEmbedIFramePage: true, - // 鍒囨崲鐣岄潰鐨勬椂鍊欐槸鍚﹀垹闄ゆ湭鍏抽棴鐨刴essage鍙妌otify + // Whether to delete unclosed messages and notify when switching the interface closeMessageOnSwitch: true, - // 鍒囨崲鐣岄潰鐨勬椂鍊欐槸鍚﹀彇娑堝凡缁忓彂閫佷絾鏄湭鍝嶅簲鐨刪ttp璇锋眰銆� - // 濡傛灉寮�鍚�,鎯冲鍗曠嫭鎺ュ彛瑕嗙洊銆傚彲浠ュ湪鍗曠嫭鎺ュ彛璁剧疆 - removeAllHttpPending: true, + // Whether to cancel the http request that has been sent but not responded when switching the interface. + // If it is enabled, I want to overwrite a single interface. Can be set in a separate interface + removeAllHttpPending: false, }; export default setting; -- Gitblit v1.8.0