登录
This commit is contained in:
parent
e78faa9f0d
commit
050f33ba68
10
src/App.vue
10
src/App.vue
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<Header />
|
||||
<Header v-if="!isLoginPage"/>
|
||||
<main class="main-content">
|
||||
<router-view />
|
||||
</main>
|
||||
@ -9,6 +9,12 @@
|
||||
|
||||
<script setup>
|
||||
import Header from '@/components/Header.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { computed } from 'vue'
|
||||
const route = useRoute()
|
||||
const isLoginPage = computed(() => {
|
||||
return route.path.startsWith('/login') // 假设登录/注册路径是 /auth
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@ -40,6 +46,6 @@ header {
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding-top: 30px;
|
||||
/* padding-top: 30px; */
|
||||
}
|
||||
</style>
|
||||
@ -16,7 +16,7 @@
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item>
|
||||
<a-button type="primary" html-type="submit" block class="login-form-button">
|
||||
<a-button type="primary" block @click="handleClick" class="login-form-button">
|
||||
登 录
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
@ -25,6 +25,8 @@
|
||||
<script lang="ts" setup>
|
||||
import { reactive, computed } from 'vue';
|
||||
import { UserOutlined, LockOutlined } from '@ant-design/icons-vue';
|
||||
import { useRouter } from 'vue-router'
|
||||
const router=useRouter()
|
||||
interface FormState {
|
||||
username: string;
|
||||
password: string;
|
||||
@ -35,8 +37,9 @@ const formState = reactive<FormState>({
|
||||
password: '',
|
||||
remember: true,
|
||||
});
|
||||
const onFinish = (values: any) => {
|
||||
const handleClick = (values: any) => {
|
||||
console.log('Success:', values);
|
||||
router.push('/')
|
||||
};
|
||||
|
||||
const onFinishFailed = (errorInfo: any) => {
|
||||
|
||||
@ -46,7 +46,7 @@ const onTabsClick = () => {
|
||||
<style scoped lang="scss">
|
||||
.login-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
height: 100vh;
|
||||
background: url("@/assets/bg-login.png") no-repeat;
|
||||
background-size: 100% 100%;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user