diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index f691bd1..4b056a7 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -14,7 +14,7 @@ >

登录

- + - + import { MessagePlugin } from "tdesign-vue-next"; -import { reactive,ref } from "vue"; +import { reactive, ref } from "vue"; +// import {login} from "@/api/login"; // import { DesktopIcon, LockOnIcon } from "tdesign-icons-vue"; const INITIAL_DATA = { account: "", password: "", }; -const from = ref() +const from = ref(); const formData = reactive({ ...INITIAL_DATA, }); const rules = reactive({ - account: [ + account: [ { required: true, - message: '必须填写', + message: "必须填写", }, { min: 10, - message: '输入不正确', + message: "输入不正确", }, { max: 10, - message: '输入不正确', + message: "输入不正确", }, ], - password: [ + password: [ { required: true, - message: '密码必填', + message: "密码必填", }, { len: 8, - message: '请输入 8 位密码', + message: "请输入 8 位密码", }, { pattern: /[A-Z]+/, - message: '密码必须包含大写字母', + message: "密码必须包含大写字母", }, ], -}) +}); const onReset = () => { MessagePlugin.success("重置成功"); }; -const onSubmit = ({ validateResult, firstError }) => { - if (validateResult === true) { - MessagePlugin.success("提交成功"); - } else { - console.log("Errors: ", validateResult); - MessagePlugin.warning(firstError); - } +const onSubmit = () => { + this.$refs.form.validateResult((valid,errors) => { + console.log(valid); + if (valid) { + MessagePlugin.success("提交成功"); + } else { + MessagePlugin.error("提交失败"); + console.log("Errors: ", errors); + return false; + } + }); }; diff --git a/src/pages/students/student.vue b/src/pages/students/student.vue new file mode 100644 index 0000000..d9280dc --- /dev/null +++ b/src/pages/students/student.vue @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 9740085..e5a3dc3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,6 +1,7 @@ import { createRouter, createWebHistory } from "vue-router"; import FinanceBillManage from "./modules/financeBillManage"; import Login from "@/pages/login/index.vue"; +import Student from "@/pages/students/student.vue"; import Layout from "@/layout/index.vue"; const router = createRouter({ @@ -27,6 +28,11 @@ const router = createRouter({ name: "login", component: Login, }, + { + path: "/student", + name: "student", + component: Student, + }, ...FinanceBillManage, ], });