Browse Source

🎟 优化

master
wangxiang 3 years ago
parent
commit
e9f8ea6b81
  1. 6
      kicc-ui/src/logics/initAppConfig.ts
  2. 2
      kicc-ui/src/logics/mitt/routeChange.ts
  3. 14
      kicc-ui/src/logics/theme/updateBackground.ts
  4. 2
      kicc-ui/src/settings/componentSetting.ts
  5. 8
      kicc-ui/src/settings/designSetting.ts
  6. 6
      kicc-ui/src/settings/encryptionSetting.ts
  7. 2
      kicc-ui/src/settings/localeSetting.ts
  8. 2
      kicc-ui/src/settings/projectSetting.ts

6
kicc-ui/src/logics/initAppConfig.ts

@ -21,7 +21,7 @@ import { Persistent } from '/@/utils/cache/persistent'; @@ -21,7 +21,7 @@ import { Persistent } from '/@/utils/cache/persistent';
import { deepMerge } from '/@/utils';
import { ThemeEnum } from '/@/enums/appEnum';
// 初始项目配置
/** 初始项目配置 */
export function initAppConfigStore() {
const localeStore = useLocaleStore();
const appStore = useAppStore();
@ -36,9 +36,7 @@ export function initAppConfigStore() { @@ -36,9 +36,7 @@ export function initAppConfigStore() {
menuSetting: { bgColor } = {},
} = projCfg;
try {
if (themeColor && themeColor !== primaryColor) {
changeTheme(themeColor);
}
if (themeColor && themeColor !== primaryColor) changeTheme(themeColor);
grayMode && updateGrayMode(grayMode);
colorWeak && updateColorWeak(colorWeak);
} catch (error) {

2
kicc-ui/src/logics/mitt/routeChange.ts

@ -10,9 +10,7 @@ import type { RouteLocationNormalized } from 'vue-router'; @@ -10,9 +10,7 @@ import type { RouteLocationNormalized } from 'vue-router';
import { getRawRoute } from '/@/utils';
const emitter = mitt();
const key = Symbol();
let lastChangeTab: RouteLocationNormalized;
export function setRouteChange(lastChangeRoute: RouteLocationNormalized) {

14
kicc-ui/src/logics/theme/updateBackground.ts

@ -19,10 +19,7 @@ const SIDER_DARK_BG_COLOR = '--sider-dark-bg-color'; @@ -19,10 +19,7 @@ const SIDER_DARK_BG_COLOR = '--sider-dark-bg-color';
const SIDER_DARK_DARKEN_BG_COLOR = '--sider-dark-darken-bg-color';
const SIDER_LIGHTEN_BG_COLOR = '--sider-dark-lighten-bg-color';
/**
*
* @param color
*/
/** 更改顶部标题的背景颜色 */
export function updateHeaderBgColor(color?: string) {
const appStore = useAppStore();
const darkMode = appStore.getDarkMode === ThemeEnum.DARK;
@ -41,7 +38,7 @@ export function updateHeaderBgColor(color?: string) { @@ -41,7 +38,7 @@ export function updateHeaderBgColor(color?: string) {
setCssVar(HEADER_BG_HOVER_COLOR_VAR, hoverColor);
setCssVar(HEADER_MENU_ACTIVE_BG_COLOR_VAR, hoverColor);
// 确定色值深浅自动切换主题
// 确定色值深浅,自动切换主题
const isDark = colorIsDark(color!);
appStore.setProjectConfig({
headerSetting: {
@ -50,10 +47,7 @@ export function updateHeaderBgColor(color?: string) { @@ -50,10 +47,7 @@ export function updateHeaderBgColor(color?: string) {
});
}
/**
*
* @param color bg color
*/
/** 更改左侧菜单的背景颜色 */
export function updateSidebarBgColor(color?: string) {
const appStore = useAppStore();
@ -69,7 +63,7 @@ export function updateSidebarBgColor(color?: string) { @@ -69,7 +63,7 @@ export function updateSidebarBgColor(color?: string) {
setCssVar(SIDER_DARK_DARKEN_BG_COLOR, darken(color!, 6));
setCssVar(SIDER_LIGHTEN_BG_COLOR, lighten(color!, 5));
// 只有当背景颜色为fff时菜单的主题才会变为浅色
// 只有当背景颜色为fff时,菜单的主题才会变为浅色
const isLight = ['#fff', '#ffffff'].includes(color!.toLowerCase());
appStore.setProjectConfig({

2
kicc-ui/src/settings/componentSetting.ts

@ -42,7 +42,7 @@ export default { @@ -42,7 +42,7 @@ export default {
// 滚动条设置
scrollbar: {
// 是否使用原生滚动条
// 打开后menu、modal、drawer都会将弹出的滚动条改为native
// 打开后menu、modal、drawer都会将弹出的滚动条改为native
native: false,
},
};

8
kicc-ui/src/settings/designSetting.ts

@ -6,12 +6,10 @@ @@ -6,12 +6,10 @@
*/
import { ThemeEnum } from '../enums/appEnum';
export const prefixCls = 'kicc';
export const darkMode = ThemeEnum.LIGHT;
// 应用主题预设颜色
/** 应用主题预设颜色 */
export const APP_PRESET_COLOR_LIST: string[] = [
'#03ac54',
'#0960bd',
@ -20,7 +18,7 @@ export const APP_PRESET_COLOR_LIST: string[] = [ @@ -20,7 +18,7 @@ export const APP_PRESET_COLOR_LIST: string[] = [
'#0096c7',
];
// 导航栏预设颜色
/** 导航栏预设颜色 */
export const HEADER_PRESET_BG_COLOR_LIST: string[] = [
'#ffffff',
'#001624',
@ -30,7 +28,7 @@ export const HEADER_PRESET_BG_COLOR_LIST: string[] = [ @@ -30,7 +28,7 @@ export const HEADER_PRESET_BG_COLOR_LIST: string[] = [
'#018ffb',
];
// 侧边预设颜色
/** 侧边预设颜色 */
export const SIDE_BAR_BG_COLOR_LIST: string[] = [
'#001624',
'#001529',

6
kicc-ui/src/settings/encryptionSetting.ts

@ -7,14 +7,14 @@ @@ -7,14 +7,14 @@
import { isDevMode } from '/@/utils/env';
// 系统默认缓存时间,以秒为单位
/** 系统默认缓存时间,以秒为单位 */
export const DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7;
// aes加密密钥
/** aes加密密钥 */
export const cacheCipher = {
key: '_11111000001111@',
iv: '@11111000001111_',
};
// 系统缓存是否使用aes加密
/** 系统缓存是否使用aes加密 */
export const enableStorageEncryption = !isDevMode();

2
kicc-ui/src/settings/localeSetting.ts

@ -23,7 +23,7 @@ export const localeSetting: LocaleSetting = { @@ -23,7 +23,7 @@ export const localeSetting: LocaleSetting = {
availableLocales: [LOCALE.ZH_CN, LOCALE.EN_US],
};
// 语言环境列表
/** 语言环境列表 */
export const localeList: DropMenu[] = [
{
text: '简体中文',

2
kicc-ui/src/settings/projectSetting.ts

@ -18,7 +18,7 @@ import { @@ -18,7 +18,7 @@ import {
import { SIDE_BAR_BG_COLOR_LIST, HEADER_PRESET_BG_COLOR_LIST } from './designSetting';
import { primaryColor } from '../../build/config/themeConfig';
// 更改后需要清除浏览器缓存
/** 更改后需要清除浏览器缓存 */
const setting: ProjectConfig = {
// 是否显示配置按钮
showSettingButton: true,

Loading…
Cancel
Save