|
|
@ -1,9 +1,11 @@ |
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { useAuthStore } from '@/stores/auth' |
|
|
import { useAuthStore } from '@/stores/auth' |
|
|
import { useRouter } from 'vue-router' |
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
|
import { useTheme } from '@/composables/useTheme' |
|
|
|
|
|
|
|
|
const auth = useAuthStore() |
|
|
const auth = useAuthStore() |
|
|
const router = useRouter() |
|
|
const router = useRouter() |
|
|
|
|
|
const theme = useTheme() |
|
|
|
|
|
|
|
|
async function handleLogout() { |
|
|
async function handleLogout() { |
|
|
try { |
|
|
try { |
|
|
@ -27,9 +29,19 @@ async function handleLogout() { |
|
|
<a v-if="auth.isLoggedIn" href="#" @click.prevent="handleLogout">退出</a> |
|
|
<a v-if="auth.isLoggedIn" href="#" @click.prevent="handleLogout">退出</a> |
|
|
<router-link v-else to="/login">登录</router-link> |
|
|
<router-link v-else to="/login">登录</router-link> |
|
|
</nav> |
|
|
</nav> |
|
|
|
|
|
<button |
|
|
|
|
|
class="theme-toggle" |
|
|
|
|
|
type="button" |
|
|
|
|
|
:title="theme.isDark ? '切至天青昼' : '切至黛墨夜'" |
|
|
|
|
|
@click="theme.toggle()" |
|
|
|
|
|
>{{ theme.isDark ? '昼' : '夜' }}</button> |
|
|
</header> |
|
|
</header> |
|
|
<main class="app-main"> |
|
|
<main class="app-main"> |
|
|
<router-view /> |
|
|
|
|
|
|
|
|
<router-view v-slot="{ Component }"> |
|
|
|
|
|
<transition name="page" mode="out-in"> |
|
|
|
|
|
<component :is="Component" /> |
|
|
|
|
|
</transition> |
|
|
|
|
|
</router-view> |
|
|
</main> |
|
|
</main> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
@ -39,42 +51,85 @@ async function handleLogout() { |
|
|
box-sizing: border-box; |
|
|
box-sizing: border-box; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
body { |
|
|
|
|
|
margin: 0; |
|
|
|
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', |
|
|
|
|
|
'Microsoft YaHei', sans-serif; |
|
|
|
|
|
background-color: #f5f6f8; |
|
|
|
|
|
color: #24292f; |
|
|
|
|
|
line-height: 1.6; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.app-header { |
|
|
.app-header { |
|
|
display: flex; |
|
|
display: flex; |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
justify-content: space-between; |
|
|
|
|
|
|
|
|
gap: 20px; |
|
|
padding: 0 24px; |
|
|
padding: 0 24px; |
|
|
height: 56px; |
|
|
|
|
|
background-color: #1f2430; |
|
|
|
|
|
color: #fff; |
|
|
|
|
|
|
|
|
height: 60px; |
|
|
|
|
|
background-color: var(--ac-header-bg); |
|
|
|
|
|
color: var(--ac-header-text); |
|
|
|
|
|
border-bottom: 1px solid var(--ac-border); |
|
|
|
|
|
transition: background-color var(--song-dur-2) var(--song-ease), color var(--song-dur-2) var(--song-ease); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.app-header .brand { |
|
|
.app-header .brand { |
|
|
color: #fff; |
|
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
height: 100%; |
|
|
|
|
|
margin-right: auto; |
|
|
|
|
|
color: var(--ac-header-text); |
|
|
|
|
|
font-family: var(--song-font-display); |
|
|
font-size: 18px; |
|
|
font-size: 18px; |
|
|
font-weight: 700; |
|
|
|
|
|
|
|
|
font-weight: 400; |
|
|
|
|
|
letter-spacing: 0.06em; |
|
|
text-decoration: none; |
|
|
text-decoration: none; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.nav-links { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
height: 100%; |
|
|
|
|
|
gap: 6px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.nav-links a, |
|
|
.nav-links a, |
|
|
.nav-links .username { |
|
|
.nav-links .username { |
|
|
margin-left: 18px; |
|
|
|
|
|
color: #cfd3dc; |
|
|
|
|
|
|
|
|
color: var(--ac-header-muted); |
|
|
text-decoration: none; |
|
|
text-decoration: none; |
|
|
font-size: 14px; |
|
|
font-size: 14px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.nav-links a { |
|
|
|
|
|
display: inline-flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
height: 100%; |
|
|
|
|
|
padding: 0 12px; |
|
|
|
|
|
color: var(--ac-header-muted); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.nav-links a:hover { |
|
|
.nav-links a:hover { |
|
|
color: #fff; |
|
|
|
|
|
|
|
|
color: var(--ac-header-text); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.nav-links a.router-link-active { |
|
|
|
|
|
color: var(--ac-header-text); |
|
|
|
|
|
background: var(--ac-header-active-bg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.nav-links .username { |
|
|
|
|
|
margin-left: 12px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.theme-toggle { |
|
|
|
|
|
width: 34px; |
|
|
|
|
|
height: 34px; |
|
|
|
|
|
flex-shrink: 0; |
|
|
|
|
|
border: 1px solid var(--ac-border); |
|
|
|
|
|
border-radius: var(--ac-radius-m); |
|
|
|
|
|
background: transparent; |
|
|
|
|
|
color: var(--ac-header-muted); |
|
|
|
|
|
font-family: var(--song-font-serif); |
|
|
|
|
|
font-size: 15px; |
|
|
|
|
|
letter-spacing: 0.1em; |
|
|
|
|
|
cursor: pointer; |
|
|
|
|
|
transition: color var(--song-dur-1) var(--song-ease), border-color var(--song-dur-1) var(--song-ease), background var(--song-dur-1) var(--song-ease); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.theme-toggle:hover { |
|
|
|
|
|
color: var(--ac-header-text); |
|
|
|
|
|
border-color: var(--ac-header-muted); |
|
|
|
|
|
background: var(--ac-header-active-bg); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.app-main { |
|
|
.app-main { |
|
|
|