<template>
  <div id="app" :class="{greyFilter,[`theme-${$theme}`]:true}">
    <router-view/>
  </div>
</template>

<script>
import {mapState} from "vuex";
import customConfig from "./config.json";

export default {
  name: 'app',
  computed: {
    ...mapState(['sys']),
    greyFilter: v => v.sys?.theme?.enableGreyFilter == 1,
  },
  methods: {
    initFavicon(icon) {
      const linkList = document.head.querySelectorAll('link') || {},
          url = `${this.$cdn}/favicon/${icon || "favicon"}.ico`
      if (Object.values(linkList).findIndex(e => e.href == url) == -1) {
        let favicon = document.createElement("link")
        favicon.rel = "icon"
        favicon.href = url
        document.head.appendChild(favicon)
      }
    }
  },
  created() {
    this.initFavicon(customConfig.sysInfo?.favicon)
    document.title = this.sys.info.fullTitle
    customConfig?.hmt && this.$injectLib("https://hm.baidu.com/hm.js?4e5dd7c5512e5da68c025c3b956fbd5d")
  }
}
</script>

<style lang="scss">
html, body {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
}

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, blockquote, th, td {
  margin: 0;
  padding: 0;
}

#app {
  font-family: Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

li {
  list-style-type: none;
}

.greyFilter {
  filter: grayscale(100%);
}

.amap-logo, .amap-copyright {
  display: none !important;
}
</style>
