mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-03-03 10:44:26 +08:00
feat: change theme and index style
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
<template>
|
||||
<div class="admin-home" v-if="isLogin">
|
||||
<admin-sidebar/>
|
||||
<admin-sidebar />
|
||||
<div class="content-box" :class="{ 'content-collapse': sidebar.collapse }">
|
||||
<admin-header/>
|
||||
<admin-tags/>
|
||||
<div :class="'content '+theme" :style="{height:contentHeight+'px'}">
|
||||
<admin-header />
|
||||
<admin-tags />
|
||||
<div
|
||||
:class="'content ' + theme"
|
||||
:style="{ height: contentHeight + 'px' }"
|
||||
>
|
||||
<router-view v-slot="{ Component }">
|
||||
<transition name="move" mode="out-in">
|
||||
<keep-alive :include="tags.nameList">
|
||||
@@ -17,40 +20,43 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import {useSidebarStore} from '@/store/sidebar';
|
||||
import {useTagsStore} from '@/store/tags';
|
||||
import { useSidebarStore } from "@/store/sidebar";
|
||||
import { useTagsStore } from "@/store/tags";
|
||||
import AdminHeader from "@/components/admin/AdminHeader.vue";
|
||||
import AdminSidebar from "@/components/admin/AdminSidebar.vue";
|
||||
import AdminTags from "@/components/admin/AdminTags.vue";
|
||||
import {useRouter} from "vue-router";
|
||||
import {checkAdminSession} from "@/store/cache";
|
||||
import {ref, watch} from "vue";
|
||||
import {useSharedStore} from "@/store/sharedata";
|
||||
import { useRouter } from "vue-router";
|
||||
import { checkAdminSession } from "@/store/cache";
|
||||
import { ref, watch } from "vue";
|
||||
import { useSharedStore } from "@/store/sharedata";
|
||||
|
||||
const sidebar = useSidebarStore();
|
||||
const tags = useTagsStore();
|
||||
const isLogin = ref(false)
|
||||
const contentHeight = window.innerHeight - 80
|
||||
const store = useSharedStore()
|
||||
const theme = ref(store.adminTheme)
|
||||
const isLogin = ref(false);
|
||||
const contentHeight = window.innerHeight - 80;
|
||||
const store = useSharedStore();
|
||||
const theme = ref(store.adminTheme);
|
||||
|
||||
// 获取会话信息
|
||||
const router = useRouter();
|
||||
checkAdminSession().then(() => {
|
||||
isLogin.value = true
|
||||
}).catch(() => {
|
||||
router.replace('/admin/login')
|
||||
})
|
||||
|
||||
watch(() => store.adminTheme, (val) => {
|
||||
theme.value = val
|
||||
})
|
||||
|
||||
checkAdminSession()
|
||||
.then(() => {
|
||||
isLogin.value = true;
|
||||
})
|
||||
.catch(() => {
|
||||
router.replace("/admin/login");
|
||||
});
|
||||
|
||||
watch(
|
||||
() => store.adminTheme,
|
||||
(val) => {
|
||||
theme.value = val;
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="stylus">
|
||||
@import '@/assets/css/color-dark.styl';
|
||||
// @import '@/assets/css/color-dark.styl';
|
||||
@import '@/assets/css/main.styl';
|
||||
@import '@/assets/iconfont/iconfont.css';
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user