123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <template>
- <div v-cloak id="app">
- <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')
- 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>
|