<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
import {getVersionJson} from "@/api/other";
import {getStore, setStore} from "@/util/store";

export default {
  name: "app",
  data() {
    return {};
  },
  watch: {},
  created() {},
  mounted() {
    //生产环境下，检测更新
    if (process.env.NODE_ENV === 'production') {
      this.getVersionJsonApi()
      setInterval(() => {
        this.getVersionJsonApi()
      }, 1000 * 60)
    }
  },
  methods: {
    //获取版本更新信息
    async getVersionJsonApi() {
      const cache_version = getStore({name: 'version'})
      const {data} = await getVersionJson()
      const version = data.value
      setStore({name: 'version', content: version})
      if (cache_version && cache_version !== version) {
        this.$confirm('检测到有新版本更新，请点击更新，或手动刷新网页更新，如果不更新，将无法使用相关功能', '更新提醒', {
          confirmButtonText: '立即更新',
          cancelButtonText: '暂不更新',
          type: 'warning'
        }).then(() => {
          //刷新页面
          window.location.reload()
        });
      }
    },
  },
  computed: {},
};
</script>
<style lang="scss">
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.avue--detail .el-col {
  margin-bottom: 0;
}

.boxswai {
  box-sizing: border-box;
  padding: 0px 14px 10px 14px;
  width: 100%;
  height: 100%;
  color: #303133;
  .boxnei {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    background-color: #fff;
    padding: 14px;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
    overflow: auto;
  }
}
#luckysheet-rightclick-menu {
  z-index: 9999 !important; /* 提高 z-index，确保不被其他元素遮挡 */
}
</style>
