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