// 配置阿里 图标
import '@/assets/styles/index.less';
import '@/assets/styles/symbol_color/iconfont.css';
import '@/assets/styles/symbol_color/iconfont.js';
import '@/assets/styles/symbol_no_color/iconfont.css';
import '@/assets/styles/symbol_no_color/iconfont.js';
import Antd, { message } from 'ant-design-vue';
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';

// 解决缓存刷新问题
(function () {
    const lastTime = new Date().getTime();
    const localVersion = localStorage.getItem('version');

    if (localVersion) {
        const diffTime = lastTime - Number(localVersion);
        const millisecond = 12 * 60 * 60 * 1000; // 12小时毫秒数
        // 判断上次加载时间是否超过12小时
        if (diffTime > millisecond) {
            localStorage.setItem('version', lastTime.toString());
            location.reload(); // 页面强制刷新
        }
    } else {
        localStorage.setItem('version', lastTime.toString());
    }
})()

const app = createApp(App);
app.use(router);
app.use(Antd).mount('#app');

// 配置全局属性
app.config.globalProperties.$message = message;
