feat(projects): 登录页面开始迁移

This commit is contained in:
Soybean
2022-01-04 19:09:00 +08:00
parent 035fa114c9
commit f5a36a05cb
30 changed files with 341 additions and 20 deletions

View File

@ -1,6 +1,9 @@
import { colord } from 'colord';
import { colord, extend } from 'colord';
import mixPlugin from 'colord/plugins/mix';
import type { HsvColor } from 'colord';
extend([mixPlugin]);
type ColorIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
const hueStep = 2;
@ -114,3 +117,22 @@ function getValue(hsv: HsvColor, i: number, isLight: boolean) {
}
return value;
}
/**
* 给颜色加透明度
* @param color - 颜色
* @param alpha - 透明度(0 - 1)
*/
export function addColorAlpha(color: string, alpha: number) {
return colord(color).alpha(alpha).toHex();
}
/**
* 颜色混合
* @param firstColor - 第一个颜色
* @param secondColor - 第二个颜色
* @param ratio - 第二个颜色占比
*/
export function mixColor(firstColor: string, secondColor: string, ratio: number) {
return colord(firstColor).mix(secondColor, ratio).toHex();
}

View File

@ -1 +1,2 @@
export * from './helpers';
export * from './regexp';

View File

@ -0,0 +1,7 @@
import type { LoginModuleKey } from '@/interface';
/** 获取登录页面模块的动态路由的正则 */
export function getLoginModuleRegExp() {
const modules: LoginModuleKey[] = ['pwd-login', 'code-login', 'register', 'reset-pwd', 'bind-wechat'];
return modules.join('|');
}