123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <a-config-provider :locale="locale">
- <div id="app">
- <div v-if="envtips!=''" class="envtipsBox">{{ envtips }}</div>
- <router-view/>
- </div>
- </a-config-provider>
- </template>
- <script>
- import zhCN from 'ant-design-vue/es/locale/zh_CN';
- import { AppDeviceEnquire } from '@/utils/mixin'
- import moment from 'moment';//引入moment
- import 'moment/locale/zh-cn';
- moment.locale('zh-cn'); //设置语言 或 moment.lang('zh-cn');
- export default {
- mixins: [AppDeviceEnquire],
- data () {
- return {
- locale:zhCN,
- envtips: '',
- moment
- }
- },
- created () {
- this.envtips = process.env.VUE_APP_ENVTIPS
- // 在页面加载时读取sessionStorage
- if (sessionStorage.getItem('store')) {
- const data = JSON.parse(sessionStorage.getItem('store'))
- sessionStorage.setItem('Access-Token', data.user.token)
- this.$store.replaceState(Object.assign({}, this.$store.state, data))
- }
- // 在页面刷新时将store保存到sessionStorage里
- window.addEventListener('beforeunload', () => {
- this.$store.state.app.isNewTab = true
- this.$store.state.app.updateList = false
- sessionStorage.setItem('store', JSON.stringify(this.$store.state))
- })
- // 按F5 刷新页面
- window.addEventListener('keydown', (e) => {
- if (e.keyCode == '116') {
- window.location.reload()
- }
- })
- this.$message.config({
- top: `100px`,
- duration: 3,
- maxCount: 3
- })
- }
- }
- </script>
- <style>
- #app {
- height: 100%;
- }
- .envtipsBox{
- position: fixed;
- z-index: 100000;
- background: red;
- text-align: center;
- color: #fff;
- font-size: 30px;
- top: 0;
- left: 0;
- width: 30%;
- margin-left: 20%;
- }
- </style>
|