This commit is contained in:
eleanor.mao
2025-06-03 00:03:08 +08:00
commit 48f2c49c2b
100 changed files with 34596 additions and 0 deletions

6
src/utils/common.ts Normal file
View File

@ -0,0 +1,6 @@
export const isValidPhone = (phone: string, callback: (msg?: string) => void) => {
if (!/^1\d{10}$/.test(phone)) {
callback('手机号格式不正确');
}
callback();
};

22
src/utils/login.ts Normal file
View File

@ -0,0 +1,22 @@
import { history } from '@umijs/max';
import { LOGIN_PATH } from '@/constants/global';
let _token = '';
export const setToken = (token: string) => {
_token = token;
};
export const getToken = () => {
return _token;
};
export const clearToken = () => {
return (_token = '');
};
export const gotoLogin = () => {
console.trace('gotoLogin');
history.push(LOGIN_PATH);
};