[status page] improve the entry

This commit is contained in:
LouisLam 2021-09-23 13:57:24 +08:00
parent 5f533b9091
commit 439f45d91e
5 changed files with 50 additions and 19 deletions

View file

@ -111,28 +111,15 @@ export default {
},
watch: {
$route(to, from) {
this.init();
},
},
mounted() {
this.init();
},
methods: {
async init() {
if (this.$route.name === "root") {
let entryPage = (await axios.get("/api/entry-page")).data;
if (entryPage === "statusPage") {
this.$router.push("/status-page");
} else {
this.$router.push("/dashboard");
}
}
},
},
};

View file

@ -6,6 +6,7 @@ let socket;
const noSocketIOPages = [
"/status-page",
"/"
];
export default {

View file

@ -5,7 +5,7 @@ export default {
system: (window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light",
userTheme: localStorage.theme,
userHeartbeatBar: localStorage.heartbeatBarTheme,
statusPageTheme: "dark",
statusPageTheme: "light",
path: "",
};
},
@ -27,6 +27,12 @@ export default {
computed: {
theme() {
// Entry no need dark
if (this.path === "") {
return "light";
}
if (this.path === "/status-page") {
return this.statusPageTheme;
} else {
@ -72,5 +78,5 @@ export default {
}
}
}
}
};

33
src/pages/Entry.vue Normal file
View file

@ -0,0 +1,33 @@
<template>
<div></div>
</template>
<script>
import axios from "axios";
export default {
data() {
return {};
},
computed: {
},
watch: {
},
async mounted() {
let entryPage = (await axios.get("/api/entry-page")).data;
if (entryPage === "statusPage") {
this.$router.push("/status-page");
} else {
this.$router.push("/dashboard");
}
},
};
</script>

View file

@ -9,20 +9,24 @@ import List from "./pages/List.vue";
import Settings from "./pages/Settings.vue";
import Setup from "./pages/Setup.vue";
import StatusPage from "./pages/StatusPage.vue";
import Entry from "./pages/Entry.vue";
const routes = [
{
path: "/",
component: Entry,
},
{
path: "/dashboard",
component: Layout,
children: [
{
name: "root",
path: "",
component: Dashboard,
children: [
{
name: "DashboardHome",
path: "/dashboard",
path: "",
component: DashboardHome,
children: [
{