|
@@ -2,6 +2,7 @@ import { reactive } from "vue";
|
|
import { isPhone } from "@pureadmin/utils";
|
|
import { isPhone } from "@pureadmin/utils";
|
|
import type { FormRules } from "element-plus";
|
|
import type { FormRules } from "element-plus";
|
|
import { useUserStoreHook } from "/@/store/modules/user";
|
|
import { useUserStoreHook } from "/@/store/modules/user";
|
|
|
|
+import { isMobile } from "/@/utils/validate";
|
|
|
|
|
|
/** 6位数字验证码正则 */
|
|
/** 6位数字验证码正则 */
|
|
export const REGEXP_SIX = /^\d{6}$/;
|
|
export const REGEXP_SIX = /^\d{6}$/;
|
|
@@ -11,7 +12,20 @@ export const REGEXP_PWD = /^[0-9A-Za-z]{6,18}$/;
|
|
|
|
|
|
/** 登录校验 */
|
|
/** 登录校验 */
|
|
const loginRules = reactive(<FormRules>{
|
|
const loginRules = reactive(<FormRules>{
|
|
- username: [{ required: true, message: "请输入账号", trigger: "blur" }],
|
|
|
|
|
|
+ username: [
|
|
|
|
+ {
|
|
|
|
+ validator(_, value, callback) {
|
|
|
|
+ if (!value) {
|
|
|
|
+ callback(new Error("请输入手机号"));
|
|
|
|
+ } else if (!isMobile(value)) {
|
|
|
|
+ callback(new Error("手机号格式不正确"));
|
|
|
|
+ } else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ trigger: "blur"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
password: [
|
|
password: [
|
|
{
|
|
{
|
|
validator: (rule, value, callback) => {
|
|
validator: (rule, value, callback) => {
|