style(projects): update prettier config

This commit is contained in:
Soybean
2022-04-01 14:47:57 +08:00
parent ca2dfa6185
commit df56abe18d
128 changed files with 2237 additions and 2037 deletions

View File

@ -17,7 +17,7 @@ export const useAppStore = defineStore('app-store', {
reloadFlag: true,
settingDrawerVisible: false,
siderCollapse: false,
mixSiderFixed: false,
mixSiderFixed: false
}),
actions: {
/**
@ -65,6 +65,6 @@ export const useAppStore = defineStore('app-store', {
/** 设置 vertical-mix模式下 侧边栏的固定状态 */
toggleMixSiderFixed() {
this.mixSiderFixed = !this.mixSiderFixed;
},
},
}
}
});

View File

@ -18,13 +18,13 @@ export const useAuthStore = defineStore('auth-store', {
state: (): AuthState => ({
userInfo: getUserInfo(),
token: getToken(),
loginLoding: false,
loginLoding: false
}),
getters: {
/** 是否登录 */
isLogin(state) {
return Boolean(state.token);
},
}
},
actions: {
/** 重置auth状态 */
@ -67,7 +67,7 @@ export const useAuthStore = defineStore('auth-store', {
window.$notification?.success({
title: '登录成功!',
content: `欢迎回来,${data.userName}!`,
duration: 3000,
duration: 3000
});
} else {
// 不成功则重置状态
@ -87,6 +87,6 @@ export const useAuthStore = defineStore('auth-store', {
await this.loginByToken(data);
}
this.loginLoding = false;
},
},
}
}
});

View File

@ -7,7 +7,7 @@ import {
transformAuthRouteToMenu,
transformAuthRoutesToVueRoutes,
transformAuthRoutesToSearchMenus,
getCacheRoutes,
getCacheRoutes
} from '@/utils';
import { useTabStore } from '../tab';
@ -37,7 +37,7 @@ export const useRouteStore = defineStore('route-store', {
routeHomeName: 'dashboard_analysis',
menus: [],
searchMenus: [],
cacheRoutes: [],
cacheRoutes: []
}),
actions: {
/**
@ -50,7 +50,7 @@ export const useRouteStore = defineStore('route-store', {
this.searchMenus = transformAuthRoutesToSearchMenus(routes);
const vueRoutes = transformAuthRoutesToVueRoutes(routes);
vueRoutes.forEach((route) => {
vueRoutes.forEach(route => {
router.addRoute(route);
});
@ -95,6 +95,6 @@ export const useRouteStore = defineStore('route-store', {
initHomeTab(this.routeHomeName, router);
this.isInitedAuthRoute = true;
},
},
}
}
});

View File

@ -11,8 +11,8 @@ export function getTabRouteByVueRoute(route: RouteRecordNormalized | RouteLocati
meta: route.meta,
scrollPosition: {
left: 0,
top: 0,
},
top: 0
}
};
return tabRoute;
}
@ -23,7 +23,7 @@ export function getTabRouteByVueRoute(route: RouteRecordNormalized | RouteLocati
* @param path - 该页签的路径
*/
export function getIndexInTabRoutes(tabs: GlobalTabRoute[], path: string) {
return tabs.findIndex((tab) => tab.path === path);
return tabs.findIndex(tab => tab.path === path);
}
/**

View File

@ -21,21 +21,21 @@ export const useTabStore = defineStore('tab-store', {
name: 'root',
path: '/',
meta: {
title: 'root',
title: 'root'
},
scrollPosition: {
left: 0,
top: 0,
},
top: 0
}
},
activeTab: '',
activeTab: ''
}),
getters: {
/** 当前激活状态的页签索引 */
activeTabIndex(state) {
const { tabs, activeTab } = state;
return tabs.findIndex((tab) => tab.path === activeTab);
},
return tabs.findIndex(tab => tab.path === activeTab);
}
},
actions: {
/**
@ -52,7 +52,7 @@ export const useTabStore = defineStore('tab-store', {
*/
initHomeTab(routeHomeName: string, router: Router) {
const routes = router.getRoutes();
const findHome = routes.find((item) => item.name === routeHomeName);
const findHome = routes.find(item => item.name === routeHomeName);
if (findHome) {
this.homeTab = getTabRouteByVueRoute(findHome);
}
@ -74,7 +74,7 @@ export const useTabStore = defineStore('tab-store', {
const { routerPush } = useRouterPush(false);
const isActive = this.activeTab === path;
const updateTabs = this.tabs.filter((tab) => tab.path !== path);
const updateTabs = this.tabs.filter(tab => tab.path !== path);
this.tabs = updateTabs;
if (isActive && updateTabs.length) {
const activePath = updateTabs[updateTabs.length - 1].path;
@ -92,7 +92,7 @@ export const useTabStore = defineStore('tab-store', {
const homePath = this.homeTab.path;
const remain = [homePath, ...excludes];
const hasActive = remain.includes(this.activeTab);
const updateTabs = this.tabs.filter((tab) => remain.includes(tab.path));
const updateTabs = this.tabs.filter(tab => remain.includes(tab.path));
this.tabs = updateTabs;
if (!hasActive && updateTabs.length) {
const activePath = updateTabs[updateTabs.length - 1].path;
@ -107,7 +107,7 @@ export const useTabStore = defineStore('tab-store', {
clearLeftTab(path: string) {
const index = getIndexInTabRoutes(this.tabs, path);
if (index > -1) {
const excludes = this.tabs.slice(index).map((item) => item.path);
const excludes = this.tabs.slice(index).map(item => item.path);
this.clearTab(excludes);
}
},
@ -118,7 +118,7 @@ export const useTabStore = defineStore('tab-store', {
clearRightTab(path: string) {
const index = getIndexInTabRoutes(this.tabs, path);
if (index > -1) {
const excludes = this.tabs.slice(0, index + 1).map((item) => item.path);
const excludes = this.tabs.slice(0, index + 1).map(item => item.path);
this.clearTab(excludes);
}
},
@ -153,7 +153,7 @@ export const useTabStore = defineStore('tab-store', {
getTabScrollPosition(path: string) {
const position = {
left: 0,
top: 0,
top: 0
};
const index = getIndexInTabRoutes(this.tabs, path);
if (index > -1) {
@ -177,6 +177,6 @@ export const useTabStore = defineStore('tab-store', {
}
this.tabs = tabs;
this.setActiveTab(currentRoute.path);
},
},
}
}
});

View File

@ -26,17 +26,17 @@ interface ColorAction {
/** 获取主题颜色的各种场景对应的颜色 */
function getThemeColors(colors: [ColorType, string][]) {
const colorActions: ColorAction[] = [
{ scene: '', handler: (color) => color },
{ scene: 'Suppl', handler: (color) => color },
{ scene: 'Hover', handler: (color) => getColorPalette(color, 5) },
{ scene: 'Pressed', handler: (color) => getColorPalette(color, 7) },
{ scene: 'Active', handler: (color) => addColorAlpha(color, 0.1) },
{ scene: '', handler: color => color },
{ scene: 'Suppl', handler: color => color },
{ scene: 'Hover', handler: color => getColorPalette(color, 5) },
{ scene: 'Pressed', handler: color => getColorPalette(color, 7) },
{ scene: 'Active', handler: color => addColorAlpha(color, 0.1) }
];
const themeColor: ThemeColor = {};
colors.forEach((color) => {
colorActions.forEach((action) => {
colors.forEach(color => {
colorActions.forEach(action => {
const [colorType, colorValue] = color;
const colorKey: ColorKey = `${colorType}Color${action.scene}`;
themeColor[colorKey] = action.handler(colorValue);
@ -57,18 +57,18 @@ export function getNaiveThemeOverrides(colors: Record<ColorType, string>): Globa
['info', info],
['success', success],
['warning', warning],
['error', error],
['error', error]
]);
const colorLoading = primary;
return {
common: {
...themeColors,
...themeColors
},
LoadingBar: {
colorLoading,
},
colorLoading
}
};
}
@ -79,7 +79,7 @@ type ThemeVarsKeys = keyof ThemeVars;
export function addThemeCssVarsToHtml(themeVars: ThemeVars) {
const keys = Object.keys(themeVars) as ThemeVarsKeys[];
const style: string[] = [];
keys.forEach((key) => {
keys.forEach(key => {
style.push(`--${kebabCase(key)}: ${themeVars[key]}`);
});
const styleStr = style.join(';');
@ -97,6 +97,6 @@ export function handleWindicssDarkMode() {
}
return {
addDarkClass,
removeDarkClass,
removeDarkClass
};
}

View File

@ -18,7 +18,7 @@ export const useThemeStore = defineStore('theme-store', {
/** naive-ui暗黑主题 */
naiveTheme(state) {
return state.darkMode ? darkTheme : undefined;
},
}
},
actions: {
/** 重置theme状态 */
@ -128,6 +128,6 @@ export const useThemeStore = defineStore('theme-store', {
/** 设置页面过渡动画类型 */
setPageAnimateMode(mode: EnumType.ThemeAnimateMode) {
this.page.animateMode = mode;
},
},
}
}
});