update
This commit is contained in:
@@ -5,7 +5,7 @@ import BulletChat from "../login/BulletChat.vue";
|
|||||||
import XInput from "../../components/XInput.vue";
|
import XInput from "../../components/XInput.vue";
|
||||||
import SendMsg from "../../components/SendMsg.vue";
|
import SendMsg from "../../components/SendMsg.vue";
|
||||||
import Api from "../../api/index.js";
|
import Api from "../../api/index.js";
|
||||||
import {showToast} from "../../utils/uils.js";
|
import {showToast, verifyForm} from "../../utils/uils.js";
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
mobile: null,
|
mobile: null,
|
||||||
@@ -15,7 +15,16 @@ const form = reactive({
|
|||||||
invite: null,
|
invite: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
mobile: {
|
||||||
|
reg: /^1[3-9]\d{9}$/,
|
||||||
|
msg: '手机号错误'
|
||||||
|
},
|
||||||
|
wechat: {}
|
||||||
|
};
|
||||||
|
|
||||||
const success = async () => {
|
const success = async () => {
|
||||||
|
verifyForm(form, rules);
|
||||||
const {msg} = await Api.system.register(form);
|
const {msg} = await Api.system.register(form);
|
||||||
showToast(msg);
|
showToast(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,3 +173,17 @@ export const uploadFile = ({count}) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const verifyForm = (model, rules) => {
|
||||||
|
Object.entries(model).forEach(([key, value]) => {
|
||||||
|
console.log(rules[key], key)
|
||||||
|
if (rules[key] && !rules[key].reg.test(value)) {
|
||||||
|
showToast({
|
||||||
|
icon: 'error',
|
||||||
|
mask: true,
|
||||||
|
title: rules[key].msg,
|
||||||
|
});
|
||||||
|
throw new Error(rules[key].msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ export default defineConfig({
|
|||||||
defineModel: true,
|
defineModel: true,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
UnifiedViteWeappTailwindcssPlugin({
|
// UnifiedViteWeappTailwindcssPlugin({
|
||||||
rem2rpx: true,
|
// rem2rpx: true,
|
||||||
})
|
// })
|
||||||
],
|
],
|
||||||
css: {
|
css: {
|
||||||
postcss: {
|
postcss: {
|
||||||
|
|||||||
Reference in New Issue
Block a user