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>
<t-form-item name="account">
<t-form-item label="账号" name="account">
<t-input
clearable
v-model="formData.account"
@ -23,7 +23,7 @@
<desktop-icon slot:string="prefix-icon"></desktop-icon>
</t-input>
</t-form-item>
<t-form-item name="password">
<t-form-item label="密码" name="password">
<t-input
type="password"
clearable
@ -45,14 +45,15 @@
<script setup>
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,
});
@ -61,43 +62,47 @@ const rules = reactive({
account: [
{
required: true,
message: '必须填写',
message: "必须填写",
},
{
min: 10,
message: '输入不正确',
message: "输入不正确",
},
{
max: 10,
message: '输入不正确',
message: "输入不正确",
},
],
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) {
const onSubmit = () => {
this.$refs.form.validateResult((valid,errors) => {
console.log(valid);
if (valid) {
MessagePlugin.success("提交成功");
} else {
console.log("Errors: ", validateResult);
MessagePlugin.warning(firstError);
MessagePlugin.error("提交失败");
console.log("Errors: ", errors);
return false;
}
});
};
</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 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,
],
});