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

<script>
import localStronge from "./api/localData";
import websocket from "./mixins/websocket";
export default {
  mixins: [websocket],
  name: "App",
  created() {
    localStronge.setServiceip({
      ip: "127.0.0.1",
      // ip: "192.168.1.115",
      // ip: "192.168.101.121",
      host: "9081",
    });
    // 127.0.0.1 8082
    //192.168.0.150 8081
    //172.16.15.208 8080
  },
  methods: {
    loadScript(url) {
      return new Promise((resolve, reject) => {
        const script = document.createElement('script');
        script.src = url;
        script.onload = resolve;
        script.onerror = reject;
        document.head.appendChild(script);
      });
    },
    initWaterAPI() {
      this.loadScript('http://47.112.247.192:8001/caserver/wm-ys-2024.js?v=' + new Date().getTime())
        .then(() => {
          // 文件加载成功后执行的逻辑
          console.log('JavaScript 文件加载成功');
        }).then(() => {
          let params = {
            URL: "http://47.112.247.192:8001/caserver/",
            opened: 1, //水印开关：0关闭 1开启
            companyId: "TS002", //企业编号
            userId: "001", //员工工号
            alpha: 0.6, //水印强度
            anchorAlpha: 0.3 //定位点强度
          };
          setTimeout(function () {
            watermarkY(params)
          }
            , 1000)
        })
        .catch(() => {
          // 文件加载失败的处理逻辑
          //console.error('JavaScript 文件加载失败');
        });
    }
  },
  mounted() {
    this.init();
    //this.initWaterAPI();
  },
};
</script>
<style>
#mask_bgw {
  position: fixed;
  _position: absolute;
  top: 2px;
  left: 2px;
  z-index: 99999997;
  background: url("~@/assets/img/U01_1.png");
  background-size: 150px 150px;
  opacity: 1;
  pointer-events: none;
  width: 100%;
  height: 100%;
}
</style>
