<template>
  <div id="app">
    <router-view />
  </div>
</template>
<script>
import watermark from 'watermark-dom';
export default {
  name: 'App',
  created() {
    // 当前设备：PC/mobile
    let isDevice = window.navigator.userAgent.match(
      /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
    );
    localStorage.setItem('isDevice', !isDevice ? 'PC' : 'mobile'); // !isDevice: true:PC false:mobile
  },
  mounted() {
    setTimeout(() => {
      let username = localStorage.getItem('nickName');
      if (username) {
        let now = new Date();
        let year = now.getFullYear();
        let month = now.getMonth() + 1;
        let day = now.getDate();
        month = month < 10 ? '0' + month : month;
        day = day < 10 ? '0' + day : day;
        let date = year + '-' + month + '-' + day;
        watermark.load({
          watermark_txt: username + '@立邦' + date,
          watermark_fontsize: '13px',
          watermark_width: 100,
          watermark_rows: 0,
          watermark_cols: 3,
          watermark_height: 50,
          watermark_x_space: 10,
          watermark_y_space: 60,
          watermark_alpha: 0.1,
        });
      }
    }, 1000);
  },
  methods: {},
};
</script>
<style lang="scss">
#wm_div_id {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999999;
}
#app {
  width: 100%;
  height: 100%;
}
</style>
