[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: { watch: {
$route(to, from) {
this.init();
},
}, },
mounted() { mounted() {
this.init();
}, },
methods: { 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 = [ const noSocketIOPages = [
"/status-page", "/status-page",
"/"
]; ];
export default { export default {

View file

@ -5,7 +5,7 @@ export default {
system: (window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light", system: (window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light",
userTheme: localStorage.theme, userTheme: localStorage.theme,
userHeartbeatBar: localStorage.heartbeatBarTheme, userHeartbeatBar: localStorage.heartbeatBarTheme,
statusPageTheme: "dark", statusPageTheme: "light",
path: "", path: "",
}; };
}, },
@ -27,6 +27,12 @@ export default {
computed: { computed: {
theme() { theme() {
// Entry no need dark
if (this.path === "") {
return "light";
}
if (this.path === "/status-page") { if (this.path === "/status-page") {
return this.statusPageTheme; return this.statusPageTheme;
} else { } 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 Settings from "./pages/Settings.vue";
import Setup from "./pages/Setup.vue"; import Setup from "./pages/Setup.vue";
import StatusPage from "./pages/StatusPage.vue"; import StatusPage from "./pages/StatusPage.vue";
import Entry from "./pages/Entry.vue";
const routes = [ const routes = [
{ {
path: "/", path: "/",
component: Entry,
},
{
path: "/dashboard",
component: Layout, component: Layout,
children: [ children: [
{ {
name: "root",
path: "", path: "",
component: Dashboard, component: Dashboard,
children: [ children: [
{ {
name: "DashboardHome", name: "DashboardHome",
path: "/dashboard", path: "",
component: DashboardHome, component: DashboardHome,
children: [ children: [
{ {