12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <template>
- <div id="app" v-cloak>
- <router-view />
- </div>
- </template>
- <script>
- import { JudgeEnvironment } from "@/utils/validate";
- import { getCode } from "@/utils/dingding";
- export default {
- name: "App",
- data() {
- return {
- code: "",
- };
- },
- async created() {
- await this.getMenu();
- },
- methods: {
- async getMenu() {
- this.$store
- .dispatch("user/getMenuList", this)
- .then(async (res) => {
- if (res === "noToken") {
- await this.logout();
- } else if (res === "success" || res === "success-dataV") {
- if (
- this.$route.path === "/loadingPage" ||
- this.$route.path === "/" ||
- this.$route.path === "/login"
- ) {
- if (res === "success-dataV") {
- window.vm.$router.replace("/bigScreen/datavScr");
- } else {
- window.vm.$router.replace("/welcome");
- }
- }
- } else {
- await this.logout();
- }
- })
- .catch(async (err) => {
- await this.logout();
- });
- },
- async logout() {
- if (this.$route.path !== "/login") {
- await this.$store.dispatch("user/logout");
- console.log(this.$route.fullPath);
- this.$router.push(`/login`);
- }
- },
- },
- };
- </script>
- <style lang="scss">
- @import "./assets/css/index.scss";
- //因为element-ui的confim组件并不是vue生成的不具有[data-v....],所以全局注入一个class
- // .lzx_BtnErr{
- // background: #f56c6c !important;
- // color: #fff !important;
- // }
- </style>
|