<template>
|
<div id="app" class="el-science-blue">
|
<router-view />
|
</div>
|
</template>
|
|
<script>
|
import createWs from "@/assets/js/websocket";
|
const WSMixin = createWs("server");
|
let link;
|
export default {
|
name: "App",
|
mixins: [WSMixin],
|
data() {
|
return {};
|
},
|
watch: {
|
"$store.state.ukey.connect"(isConnet) {
|
this.$store.dispatch("ukey/checkIsIn", isConnet);
|
},
|
"$store.state.ukey.isIn"(isIn) {
|
this.$store.dispatch("ukey/changeId", isIn);
|
},
|
"$store.state.theme.activeSkin"(val) {
|
if (val == "science-blue") {
|
link.href = "./theme/science-blue.css";
|
} else if (val == "science-green") {
|
link.href = "./theme/science-green.css";
|
} else if (val == "science-black") {
|
link.href = "./theme/science-black.css";
|
} else if (val == "science-purple") {
|
link.href = "./theme/science-purple.css";
|
} else if (val == "science-ziluolan") {
|
link.href = "./theme/science-ziluolan.css";
|
} else if (val == "science-skyBlue") {
|
link.href = "./theme/science-skyBlue.css";
|
}
|
},
|
},
|
mounted() {
|
// 启动ukey监控
|
this.$store.dispatch("ukey/load", true);
|
require("./assets/css/m-elementui.css");
|
this.appenCss();
|
require("./assets/css/basic.css");
|
require("./assets/css/common.css");
|
},
|
methods: {
|
appenCss() {
|
link = document.createElement("link");
|
link.type = "text/css";
|
link.id = "theme";
|
link.rel = "stylesheet";
|
if (this.$store.state.theme.activeSkin == "science-blue") {
|
link.href = "./theme/science-blue.css";
|
} else if (this.$store.state.theme.activeSkin == "science-green") {
|
link.href = "./theme/science-green.css";
|
} else if (this.$store.state.theme.activeSkin == "science-black") {
|
link.href = "./theme/science-black.css";
|
} else if (this.$store.state.theme.activeSkin == "science-purple") {
|
link.href = "./theme/science-purple.css";
|
} else if (this.$store.state.theme.activeSkin == "science-ziluolan") {
|
link.href = "./theme/science-ziluolan.css";
|
} else if (this.$store.state.theme.activeSkin == "science-skyBlue") {
|
link.href = "./theme/science-skyBlue.css";
|
} else if(this.$store.state.theme.activeSkin == "science-jyh") {
|
link.href = "./theme/science-jyh.css";
|
}
|
document.getElementsByTagName("head")[0].appendChild(link);
|
},
|
onWSMessage(res) {
|
res = JSON.parse(res.data);
|
if (res.code) {
|
sessionStorage.setItem("serverStamp", res.data);
|
} else {
|
sessionStorage.setItem("serverStamp", "" + new Date().getTime());
|
}
|
},
|
},
|
};
|
</script>
|
|
<style>
|
#app {
|
box-sizing: border-box;
|
height: 100vh;
|
}
|
</style>
|