quanyawei
2024-09-06 60e16bd5406c4cbdf61bf20a50e8e1b49a45b2aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<template>
  <a-locale-provider :locale="currentLocale">
    <div id="app" :class="{'aside-collapsed':isCollapse}" v-title="title">
      <router-view/>
    </div>
  </a-locale-provider>
</template>
 
<style lang="less">
 
</style>
 
<script  lang="ts">
 
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
 
import { State, Mutation, namespace } from 'vuex-class';
import routerDynamic from './views/passport/login/successLoginRoutee'
import router from "@/route/router";
import getMenus from "./views/passport/login/successLoginRoutee";
// app模块
const appModule = namespace('app');
 
/**
 * app主入口
 */
@Component({
  components: {
  },
})
export default class App extends Vue {
 
  // 折叠
  @appModule.State('isCollapse')
  private isCollapse!: boolean;
 
  // 浏览器标题信息
  @appModule.State('doctitle')
  private doctitle!: any;
 
  // app名称
  @appModule.State('name')
  private appName!: any;
 
  /**
   * 获取浏览器标题,包含多语言信息
   */
  get title() {
    let title = this.doctitle.title;
    if (this.doctitle.i18n) {
      title = this.$t(this.doctitle.i18n)
    }
    return title === undefined ? '七星瓢虫环境科技' : title;
  }
 
  /**
   * 获取当前多语言信息
   */
  get currentLocale() {
    const messages: any = this.$i18n.messages[this.$i18n.locale];
    return messages;
  }
 
  /**
   * mounted 周期
   */
  private mounted() {
    let token = sessionStorage.getItem('token')
    if (token === null) {
      this.$router.push('/passport/login')
    }else {
      getMenus(token)
    }
 
  }
}
</script>