重构前端公共布局与基础样式
This commit is contained in:
+74
-28
@@ -1,50 +1,96 @@
|
||||
<script setup lang="ts">
|
||||
import MyHead from "@/components/MyHead.vue";
|
||||
import MyFooter from "@/components/MyFooter.vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="login">
|
||||
<el-container class="common-layout">
|
||||
<el-header class="header">
|
||||
<div class="app-shell">
|
||||
<div class="bg-orb bg-orb-left"></div>
|
||||
<div class="bg-orb bg-orb-right"></div>
|
||||
<el-container class="shell-container">
|
||||
<el-header class="shell-header">
|
||||
<MyHead />
|
||||
</el-header>
|
||||
<el-main class="main-content">
|
||||
<RouterView />
|
||||
<el-main class="shell-main">
|
||||
<Transition name="fade-up" mode="out-in">
|
||||
<RouterView :key="route.fullPath" />
|
||||
</Transition>
|
||||
</el-main>
|
||||
<el-footer class="footer">
|
||||
<MyFooter/>
|
||||
<el-footer class="shell-footer">
|
||||
<MyFooter />
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
#app {
|
||||
margin: 0px 0px;
|
||||
}
|
||||
|
||||
*{
|
||||
padding:0px
|
||||
}
|
||||
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.common-layout {
|
||||
min-width: 100vw;
|
||||
.app-shell {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
.shell-container {
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.shell-header {
|
||||
height: auto;
|
||||
padding: 18px 20px 0;
|
||||
}
|
||||
|
||||
.shell-main {
|
||||
max-width: 1240px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 18px 20px 24px;
|
||||
}
|
||||
|
||||
.shell-footer {
|
||||
height: auto;
|
||||
padding: 0 20px 18px;
|
||||
}
|
||||
|
||||
.bg-orb {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(1px);
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.bg-orb-left {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
top: -120px;
|
||||
left: -90px;
|
||||
background: radial-gradient(circle at center, rgba(47, 143, 104, 0.35), transparent 70%);
|
||||
}
|
||||
|
||||
.bg-orb-right {
|
||||
width: 360px;
|
||||
height: 360px;
|
||||
right: -130px;
|
||||
bottom: -170px;
|
||||
background: radial-gradient(circle at center, rgba(67, 168, 121, 0.3), transparent 70%);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.shell-header {
|
||||
padding: 12px 12px 0;
|
||||
}
|
||||
|
||||
.shell-main {
|
||||
padding: 12px 12px 18px;
|
||||
}
|
||||
|
||||
.shell-footer {
|
||||
padding: 0 12px 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+27
-72
@@ -1,86 +1,41 @@
|
||||
/* color palette from <https://github.com/vuejs/theme> */
|
||||
:root {
|
||||
--vt-c-white: #ffffff;
|
||||
--vt-c-white-soft: #f8f8f8;
|
||||
--vt-c-white-mute: #f2f2f2;
|
||||
|
||||
--vt-c-black: #181818;
|
||||
--vt-c-black-soft: #222222;
|
||||
--vt-c-black-mute: #282828;
|
||||
|
||||
--vt-c-indigo: #2c3e50;
|
||||
|
||||
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
|
||||
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
|
||||
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
|
||||
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
|
||||
|
||||
--vt-c-text-light-1: var(--vt-c-indigo);
|
||||
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
|
||||
--vt-c-text-dark-1: var(--vt-c-white);
|
||||
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
|
||||
}
|
||||
|
||||
/* semantic color variables for this project */
|
||||
:root {
|
||||
--color-background: var(--vt-c-white);
|
||||
--color-background-soft: var(--vt-c-white-soft);
|
||||
--color-background-mute: var(--vt-c-white-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-light-2);
|
||||
--color-border-hover: var(--vt-c-divider-light-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-light-1);
|
||||
--color-text: var(--vt-c-text-light-1);
|
||||
|
||||
--section-gap: 160px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--color-background: var(--vt-c-black);
|
||||
--color-background-soft: var(--vt-c-black-soft);
|
||||
--color-background-mute: var(--vt-c-black-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-dark-2);
|
||||
--color-border-hover: var(--vt-c-divider-dark-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-dark-1);
|
||||
--color-text: var(--vt-c-text-dark-2);
|
||||
}
|
||||
--green-900: #123d2d;
|
||||
--green-800: #1a5a42;
|
||||
--green-700: #237556;
|
||||
--green-600: #2f8f68;
|
||||
--green-500: #43a879;
|
||||
--green-200: #d9f1e5;
|
||||
--green-100: #eef9f3;
|
||||
--surface: #f7fbf8;
|
||||
--surface-strong: #ffffff;
|
||||
--text-primary: #1b2a23;
|
||||
--text-secondary: #4b6156;
|
||||
--border-soft: #d6e6dc;
|
||||
--shadow-soft: 0 14px 30px rgba(19, 61, 45, 0.09);
|
||||
--shadow-strong: 0 20px 45px rgba(19, 61, 45, 0.16);
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
color: var(--color-text);
|
||||
background: var(--color-background);
|
||||
transition:
|
||||
color 0.5s,
|
||||
background-color 0.5s;
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
background:
|
||||
radial-gradient(circle at 12% 18%, rgba(67, 168, 121, 0.2), transparent 32%),
|
||||
radial-gradient(circle at 85% 0%, rgba(35, 117, 86, 0.14), transparent 28%),
|
||||
linear-gradient(165deg, #eef9f3 0%, #f8fcfa 50%, #edf7f1 100%);
|
||||
font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
line-height: 1.6;
|
||||
font-family:
|
||||
Inter,
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Oxygen,
|
||||
Ubuntu,
|
||||
Cantarell,
|
||||
'Fira Sans',
|
||||
'Droid Sans',
|
||||
'Helvetica Neue',
|
||||
sans-serif;
|
||||
font-size: 15px;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
+35
-25
@@ -1,35 +1,45 @@
|
||||
@import './base.css';
|
||||
@import "./base.css";
|
||||
|
||||
#app {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
font-weight: normal;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
a,
|
||||
.green {
|
||||
a {
|
||||
color: var(--green-700);
|
||||
text-decoration: none;
|
||||
color: hsla(160, 100%, 37%, 1);
|
||||
transition: 0.4s;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
a:hover {
|
||||
background-color: hsla(160, 100%, 37%, 0.2);
|
||||
}
|
||||
a:hover {
|
||||
color: var(--green-800);
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
body {
|
||||
display: flex;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
#app {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
padding: 0 2rem;
|
||||
}
|
||||
.page-title {
|
||||
margin: 0;
|
||||
font-size: clamp(24px, 3vw, 34px);
|
||||
line-height: 1.2;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
margin: 10px 0 0;
|
||||
color: var(--text-secondary);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.surface-card {
|
||||
background: var(--surface-strong);
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 18px;
|
||||
box-shadow: var(--shadow-soft);
|
||||
}
|
||||
|
||||
.fade-up-enter-active,
|
||||
.fade-up-leave-active {
|
||||
transition: opacity 0.22s ease, transform 0.22s ease;
|
||||
}
|
||||
|
||||
.fade-up-enter-from,
|
||||
.fade-up-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
}
|
||||
|
||||
+25
-10
@@ -1,17 +1,32 @@
|
||||
<template>
|
||||
<div class="footer">
|
||||
Footer123
|
||||
<div class="footer surface-card">
|
||||
<span>学习是一条可重复走通的路径:计划、执行、复盘、再出发</span>
|
||||
<span class="footer-tag">LPT-FE</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
*{
|
||||
margin: 20px;
|
||||
padding:0px;
|
||||
}
|
||||
.footer {
|
||||
text-align: center;
|
||||
min-height: 8vh;
|
||||
background-color: green;
|
||||
padding: 12px 16px;
|
||||
min-height: 58px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
.footer-tag {
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.6px;
|
||||
color: var(--green-700);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.footer {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+51
-12
@@ -1,20 +1,30 @@
|
||||
<template>
|
||||
<div class="head">
|
||||
<span>学习进度跟踪系统</span>
|
||||
<el-button v-if="!isLoginRoute" @click="handleLogout">退出登录</el-button>
|
||||
<div class="head surface-card">
|
||||
<div class="brand-block">
|
||||
<p class="brand-title">学习进度跟踪系统</p>
|
||||
<p class="brand-subtitle">把学习变成可记录、可回顾、可持续的日常流程</p>
|
||||
</div>
|
||||
<el-button
|
||||
v-if="!isLoginRoute"
|
||||
type="success"
|
||||
plain
|
||||
class="logout-btn"
|
||||
@click="handleLogout"
|
||||
>
|
||||
退出登录
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {computed} from "vue";
|
||||
import {useRoute} from "vue-router";
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { ElMessage } from "element-plus";
|
||||
import router from "@/router";
|
||||
import { logout } from "@/api/login";
|
||||
|
||||
var route = useRoute();
|
||||
|
||||
const isLoginRoute = computed(()=>route.path === '/login');
|
||||
const route = useRoute();
|
||||
const isLoginRoute = computed(() => route.path === "/login");
|
||||
|
||||
const handleLogout = async () => {
|
||||
try {
|
||||
@@ -31,12 +41,41 @@ const handleLogout = async () => {
|
||||
|
||||
<style scoped>
|
||||
.head {
|
||||
min-height: 82px;
|
||||
padding: 14px 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 30px;
|
||||
padding: 0 24px;
|
||||
background: green;
|
||||
min-height: 7vh;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.brand-title {
|
||||
margin: 0;
|
||||
font-weight: 700;
|
||||
font-size: clamp(18px, 2.4vw, 24px);
|
||||
letter-spacing: 0.3px;
|
||||
color: var(--green-900);
|
||||
}
|
||||
|
||||
.brand-subtitle {
|
||||
margin: 4px 0 0;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
border-color: var(--green-600);
|
||||
color: var(--green-700);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.head {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user