<!DOCTYPE html>

<html lang="zh-CN">


<head>
  <meta charset="UTF-8" />
  <link rel="icon" href="/favicon.ico" />
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
  <meta http-equiv="Cache" content="no-cache">
  <meta http-equiv="pragram" content="no-cache">
  <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
  <meta http-equiv="pragma" content="no-cache">
  <meta http-equiv="expires" content="0">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <!-- 自动将HTTP请求升级成安全的HTTPS请求 -->
  <!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> -->
  <!-- 设置苹果工具栏颜色 -->
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  <meta name="format-detection" content="telphone=no, email=no" />
  <!-- 启用360浏览器的极速模式(webkit) -->
  <meta name="renderer" content="webkit" />
  <!-- 避免IE使用兼容模式 -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="HandheldFriendly" content="true" />
  <!-- 设置在apple上以应用模式启动时,是否全屏 -->
  <meta name="apple-touch-fullscreen" content="yes" />
  <!-- windows phone 点击无高光 -->
  <meta name="msapplication-tap-highlight" content="no" />
  <meta name="referrer" content="no-referrer" />
  <!-- <script data-key="responsivevoice.js" src="https://code.responsivevoice.org/responsivevoice.js?key=5tX5zUJU" ></script> -->
  <!-- <script data-key="responsivevoice.js" src="/responsivevoice.js?key=5tX5zUJU"></script> -->
  <title>音乐数字课堂</title>

  <style>
    body {
      background: #f1f5ff;
      width: 100%;
    }

    .bgImg {
      width: 456px;
      height: 522px;
    }

    .btnImg {
      width: 288px;
      position: absolute;
      left: 50%;
      margin-left: -144px;
      bottom: 31px;
      cursor: pointer;
      z-index: 100;

    }

    .imgWrap {
      width: 456px;
      height: 522px;
      margin: 140px auto 0;
      position: relative;
      z-index: 100;
    }

    /* margin-top: 300px; */
    .textWrap {
      margin-top: 140px;
      text-align: center;
      width: 500px;
      position: absolute;
      top: 141px;
      left: 50%;
      margin-left: -288px;
    }

    .subMsg {
      margin-top: 32px;
      font-size: 22px;
      line-height: 30px;
      color: #777;
    }

    .subBtn {
      width: 231px;
      height: 62px;
      background: #198CFE;
      border-radius: 18px;
      border: none;
      font-size: 22px;
      font-weight: 600;
      color: #FFFFFF;
      line-height: 30px;
      cursor: pointer;
      margin-top: 32px;
      list-style: none outside none;
      text-decoration: none;
    }
  </style>
  <script type="text/javascript">
    function gotoLinlk() {
      console.log('点击')
      var agent = navigator.userAgent.toLowerCase();
      var isMac = function () { return /macintosh|mac os x/i.test(navigator.userAgent); }();
      if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
        window.open('https://oss.dayaedu.com/appstore/ChromeStandaloneSetup32.exe');
      }
      if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
        window.open('https://oss.dayaedu.com/appstore/ChromeStandaloneSetup64.exe');
      }
      if (isMac) {
        window.open('https://oss.dayaedu.com/appstore/googlechrome-mac.dmg');
      }
    }
    function getChromeVersion() {
      var arr = navigator.userAgent.split(' ');
      var chromeVersion = '';
      for (var i = 0; i < arr.length; i++) {
        if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
      }
      if (chromeVersion) {
        return Number(chromeVersion.split('/')[1].split('.')[0]);
      } else {
        return false;
      }
    };
    function IsFF() {
      var sAgent = window.navigator.userAgent.toLowerCase();

      if (sAgent.indexOf("firefox") != -1) {
        return true;
      }
      return false;
    }

    function isChrome() {
      var isChromium = window.chrome;
      var winNav = window.navigator;
      var vendorName = winNav.vendor;
      var isOpera = typeof window.opr !== 'undefined';
      var isIEedge = winNav.userAgent.indexOf('Edge') > -1;
      var isIOSChrome = winNav.userAgent.match('CriOS');
      return (
        isIOSChrome ||
        (isChromium !== null &&
          typeof isChromium !== 'undefined' &&
          vendorName === 'Google Inc.' &&
          isOpera === false &&
          isIEedge === false)
      );
    };
    function IEVersion() {
      var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
      var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
      var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
      var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
      if (isIE) {
        var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
        reIE.test(userAgent);
        var fIEVersion = parseFloat(RegExp["$1"]);
        if (fIEVersion == 7) {
          return 7;
        } else if (fIEVersion == 8) {
          return 8;
        } else if (fIEVersion == 9) {
          return 9;
        } else if (fIEVersion == 10) {
          return 10;
        } else {
          return 6;//IE版本<=7
        }
      } else if (isEdge) {
        return 'edge';//edge
      } else if (isIE11) {
        return 11; //IE11
      } else {
        return -1;//不是ie浏览器
      }
    }
    (function (window) {
      const reloadPage = async () => {
        if ('serviceWorker' in navigator) {
          // let refreshing = false
          const flag = (await caches.keys()).length > 0;
          // console.log(caches.keys(), `0904路由更新有缓存${flag}`);
          caches.keys().then(function (cacheNames) {
            cacheNames.forEach(function (cacheName) {
              caches.delete(cacheName);
            });
          });
          // 尝试监听install
        }
        console.log('index.html')
        window.location.reload();
      }
      // let refreshing = false


      // if ('serviceWorker' in navigator) {
      //   // let refreshing = false
      //   let flag = caches.keys().length > 0
      //   console.log(caches.keys(), 'caches.keys()', `是否有缓存${flag}`);
      //   caches.keys().then(function (cacheNames) {
      //     cacheNames.forEach(function (cacheName) {
      //       caches.delete(cacheName);
      //     });
      //     if (flag) {
      //       window.location.reload()
      //     }
      //   });

      //   // 尝试监听install


      // }
      // let refreshing = false
      // navigator.serviceWorker.addEventListener('controllerchange', () => {
      //   console.log('controllerchange')
      //   if (refreshing) {
      //     return
      //   }
      //   refreshing = true;
      //   window.location.reload();
      // })


      if (!isChrome()) {
        // document.writeln("<div class='imgWrap'><img src='https://oss.dayaedu.com/gyt/basic/1688699993534.png' class='bgImg' alt=''><img src='https://oss.dayaedu.com/gyt/basic/1688699779209.png' class='btnImg' alt=''></div>");


        if (IEVersion() < 9 && IEVersion() != -1) {

          document.writeln(" <div class='textWrap'><h1>当前浏览器版本过低</h1><p class='subMsg'>为了保证良好的上课体验,推荐您使用谷歌浏览器</p> <button class='subBtn' onclick='gotoLinlk()'>下载谷歌浏览器</button>");
          document.execCommand("Stop");
        } else {
          document.writeln(" <div class='imgWrap'><img onabort='this.src=this.src' src='https://oss.dayaedu.com/gyt/basic/1688699993534.png' class='bgImg' alt=''><img src='https://oss.dayaedu.com/gyt/basic/1688699779209.png'  onabort='this.src=this.src' onclick='gotoLinlk()' class='btnImg' alt=''></div>");
          document.execCommand("Stop");
        }
      } else {
        if (getChromeVersion() < 90) {

          document.writeln(" <div class='imgWrap'><img src='https://oss.dayaedu.com/gyt/basic/1688699993534.png' class='bgImg' alt=''><img src='https://oss.dayaedu.com/gyt/basic/1688699779209.png' onclick='gotoLinlk()' class='btnImg' alt=''></div>");
          document.execCommand("Stop");
          window.stop()
          console.log('Stop')
        }

        // if (IsFF()) {

      }

    })(window);
  </script>
</head>

<!-- 按钮 https://oss.dayaedu.com/gyt/basic/1688699779209.png -->
<!-- 背景 https://oss.dayaedu.com/gyt/basic/1688699993534.png -->

<body class="myBody">

  <div id="app"></div>
  <script type="module" src="/src/main.ts"></script>

</body>

</html>