This commit is contained in:
吕才卓 2024-04-06 15:15:18 +08:00
parent cc69ee0489
commit 5f2bb4c9a8
3 changed files with 44 additions and 20 deletions

View File

@ -14,7 +14,7 @@
> >
<h2 class="login-title">登录</h2> <h2 class="login-title">登录</h2>
<t-form-item name="account"> <t-form-item label="账号" name="account">
<t-input <t-input
clearable clearable
v-model="formData.account" v-model="formData.account"
@ -23,7 +23,7 @@
<desktop-icon slot:string="prefix-icon"></desktop-icon> <desktop-icon slot:string="prefix-icon"></desktop-icon>
</t-input> </t-input>
</t-form-item> </t-form-item>
<t-form-item name="password"> <t-form-item label="密码" name="password">
<t-input <t-input
type="password" type="password"
clearable clearable
@ -45,14 +45,15 @@
<script setup> <script setup>
import { MessagePlugin } from "tdesign-vue-next"; 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"; // import { DesktopIcon, LockOnIcon } from "tdesign-icons-vue";
const INITIAL_DATA = { const INITIAL_DATA = {
account: "", account: "",
password: "", password: "",
}; };
const from = ref() const from = ref();
const formData = reactive({ const formData = reactive({
...INITIAL_DATA, ...INITIAL_DATA,
}); });
@ -61,43 +62,47 @@ const rules = reactive({
account: [ account: [
{ {
required: true, required: true,
message: '必须填写', message: "必须填写",
}, },
{ {
min: 10, min: 10,
message: '输入不正确', message: "输入不正确",
}, },
{ {
max: 10, max: 10,
message: '输入不正确', message: "输入不正确",
}, },
], ],
password: [ password: [
{ {
required: true, required: true,
message: '密码必填', message: "密码必填",
}, },
{ {
len: 8, len: 8,
message: '请输入 8 位密码', message: "请输入 8 位密码",
}, },
{ {
pattern: /[A-Z]+/, pattern: /[A-Z]+/,
message: '密码必须包含大写字母', message: "密码必须包含大写字母",
}, },
], ],
}) });
const onReset = () => { const onReset = () => {
MessagePlugin.success("重置成功"); MessagePlugin.success("重置成功");
}; };
const onSubmit = ({ validateResult, firstError }) => { const onSubmit = () => {
if (validateResult === true) { this.$refs.form.validateResult((valid,errors) => {
console.log(valid);
if (valid) {
MessagePlugin.success("提交成功"); MessagePlugin.success("提交成功");
} else { } else {
console.log("Errors: ", validateResult); MessagePlugin.error("提交失败");
MessagePlugin.warning(firstError); console.log("Errors: ", errors);
return false;
} }
});
}; };
</script> </script>

View File

@ -0,0 +1,13 @@
<template>
<div>
students
</div>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>

View File

@ -1,6 +1,7 @@
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
import FinanceBillManage from "./modules/financeBillManage"; import FinanceBillManage from "./modules/financeBillManage";
import Login from "@/pages/login/index.vue"; import Login from "@/pages/login/index.vue";
import Student from "@/pages/students/student.vue";
import Layout from "@/layout/index.vue"; import Layout from "@/layout/index.vue";
const router = createRouter({ const router = createRouter({
@ -27,6 +28,11 @@ const router = createRouter({
name: "login", name: "login",
component: Login, component: Login,
}, },
{
path: "/student",
name: "student",
component: Student,
},
...FinanceBillManage, ...FinanceBillManage,
], ],
}); });