index.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <link rel="icon" href="/favicon.ico" />
  6. <meta name="viewport"
  7. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
  8. <meta http-equiv="Cache" content="no-cache">
  9. <meta http-equiv="pragram" content="no-cache">
  10. <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
  11. <meta http-equiv="pragma" content="no-cache">
  12. <meta http-equiv="expires" content="0">
  13. <meta name="viewport" content="width=device-width,initial-scale=1.0">
  14. <meta name="apple-mobile-web-app-capable" content="yes" />
  15. <!-- 自动将HTTP请求升级成安全的HTTPS请求 -->
  16. <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
  17. <!-- 设置苹果工具栏颜色 -->
  18. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  19. <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  20. <meta name="format-detection" content="telphone=no, email=no" />
  21. <!-- 启用360浏览器的极速模式(webkit) -->
  22. <meta name="renderer" content="webkit" />
  23. <!-- 避免IE使用兼容模式 -->
  24. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  25. <meta name="HandheldFriendly" content="true" />
  26. <!-- 设置在apple上以应用模式启动时,是否全屏 -->
  27. <meta name="apple-touch-fullscreen" content="yes" />
  28. <!-- windows phone 点击无高光 -->
  29. <meta name="msapplication-tap-highlight" content="no" />
  30. <meta name="referrer" content="no-referrer" />
  31. <script data-key="responsivevoice.js" src="https://code.responsivevoice.org/responsivevoice.js?key=5tX5zUJU" ></script>
  32. <title>音乐数字课堂</title>
  33. <style>
  34. body {
  35. background: #f1f5ff;
  36. width: 100%;
  37. }
  38. .bgImg {
  39. width: 456px;
  40. height: 522px;
  41. }
  42. .btnImg {
  43. width: 288px;
  44. position: absolute;
  45. left: 50%;
  46. margin-left: -144px;
  47. bottom: 31px;
  48. cursor: pointer;
  49. z-index: 100;
  50. }
  51. .imgWrap {
  52. width: 456px;
  53. height: 522px;
  54. margin: 140px auto 0;
  55. position: relative;
  56. z-index: 100;
  57. }
  58. /* margin-top: 300px; */
  59. .textWrap {
  60. margin-top: 140px;
  61. text-align: center;
  62. width: 500px;
  63. position: absolute;
  64. top: 141px;
  65. left: 50%;
  66. margin-left: -288px;
  67. }
  68. .subMsg {
  69. margin-top: 32px;
  70. font-size: 22px;
  71. line-height: 30px;
  72. color: #777;
  73. }
  74. .subBtn {
  75. width: 231px;
  76. height: 62px;
  77. background: #198CFE;
  78. border-radius: 18px;
  79. border: none;
  80. font-size: 22px;
  81. font-weight: 600;
  82. color: #FFFFFF;
  83. line-height: 30px;
  84. cursor: pointer;
  85. margin-top: 32px;
  86. list-style: none outside none;
  87. text-decoration: none;
  88. }
  89. </style>
  90. <script type="text/javascript">
  91. function gotoLinlk() {
  92. console.log('点击')
  93. var agent = navigator.userAgent.toLowerCase();
  94. var isMac = function () { return /macintosh|mac os x/i.test(navigator.userAgent); }();
  95. if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
  96. window.open('https://oss.dayaedu.com/appstore/ChromeStandaloneSetup32.exe');
  97. }
  98. if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
  99. window.open('https://oss.dayaedu.com/appstore/ChromeStandaloneSetup64.exe');
  100. }
  101. if (isMac) {
  102. window.open('https://oss.dayaedu.com/appstore/googlechrome-mac.dmg');
  103. }
  104. }
  105. function getChromeVersion() {
  106. var arr = navigator.userAgent.split(' ');
  107. var chromeVersion = '';
  108. for (var i = 0; i < arr.length; i++) {
  109. if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
  110. }
  111. if (chromeVersion) {
  112. return Number(chromeVersion.split('/')[1].split('.')[0]);
  113. } else {
  114. return false;
  115. }
  116. };
  117. function IsFF() {
  118. var sAgent = window.navigator.userAgent.toLowerCase();
  119. if (sAgent.indexOf("firefox") != -1) {
  120. return true;
  121. }
  122. return false;
  123. }
  124. function isChrome() {
  125. var isChromium = window.chrome;
  126. var winNav = window.navigator;
  127. var vendorName = winNav.vendor;
  128. var isOpera = typeof window.opr !== 'undefined';
  129. var isIEedge = winNav.userAgent.indexOf('Edge') > -1;
  130. var isIOSChrome = winNav.userAgent.match('CriOS');
  131. return (
  132. isIOSChrome ||
  133. (isChromium !== null &&
  134. typeof isChromium !== 'undefined' &&
  135. vendorName === 'Google Inc.' &&
  136. isOpera === false &&
  137. isIEedge === false)
  138. );
  139. };
  140. function IEVersion() {
  141. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  142. var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
  143. var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
  144. var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
  145. if (isIE) {
  146. var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
  147. reIE.test(userAgent);
  148. var fIEVersion = parseFloat(RegExp["$1"]);
  149. if (fIEVersion == 7) {
  150. return 7;
  151. } else if (fIEVersion == 8) {
  152. return 8;
  153. } else if (fIEVersion == 9) {
  154. return 9;
  155. } else if (fIEVersion == 10) {
  156. return 10;
  157. } else {
  158. return 6;//IE版本<=7
  159. }
  160. } else if (isEdge) {
  161. return 'edge';//edge
  162. } else if (isIE11) {
  163. return 11; //IE11
  164. } else {
  165. return -1;//不是ie浏览器
  166. }
  167. }
  168. (function (window) {
  169. const reloadPage = async () => {
  170. if ('serviceWorker' in navigator) {
  171. // let refreshing = false
  172. const flag = (await caches.keys()).length > 0;
  173. // console.log(caches.keys(), `0904路由更新有缓存${flag}`);
  174. caches.keys().then(function (cacheNames) {
  175. cacheNames.forEach(function (cacheName) {
  176. caches.delete(cacheName);
  177. });
  178. });
  179. // 尝试监听install
  180. }
  181. console.log('index.html')
  182. window.location.reload();
  183. }
  184. // let refreshing = false
  185. // if ('serviceWorker' in navigator) {
  186. // // let refreshing = false
  187. // let flag = caches.keys().length > 0
  188. // console.log(caches.keys(), 'caches.keys()', `是否有缓存${flag}`);
  189. // caches.keys().then(function (cacheNames) {
  190. // cacheNames.forEach(function (cacheName) {
  191. // caches.delete(cacheName);
  192. // });
  193. // if (flag) {
  194. // window.location.reload()
  195. // }
  196. // });
  197. // // 尝试监听install
  198. // }
  199. // let refreshing = false
  200. // navigator.serviceWorker.addEventListener('controllerchange', () => {
  201. // console.log('controllerchange')
  202. // if (refreshing) {
  203. // return
  204. // }
  205. // refreshing = true;
  206. // window.location.reload();
  207. // })
  208. if (!isChrome()) {
  209. // 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>");
  210. if (IEVersion() < 9 && IEVersion() != -1) {
  211. document.writeln(" <div class='textWrap'><h1>当前浏览器版本过低</h1><p class='subMsg'>为了保证良好的上课体验,推荐您使用谷歌浏览器</p> <button class='subBtn' onclick='gotoLinlk()'>下载谷歌浏览器</button>");
  212. document.execCommand("Stop");
  213. } else {
  214. 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>");
  215. document.execCommand("Stop");
  216. }
  217. } else {
  218. if (getChromeVersion() < 90) {
  219. 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>");
  220. document.execCommand("Stop");
  221. window.stop()
  222. console.log('Stop')
  223. }
  224. // if (IsFF()) {
  225. }
  226. })(window);
  227. </script>
  228. </head>
  229. <!-- 按钮 https://oss.dayaedu.com/gyt/basic/1688699779209.png -->
  230. <!-- 背景 https://oss.dayaedu.com/gyt/basic/1688699993534.png -->
  231. <body class="myBody">
  232. <div id="app"></div>
  233. <script type="module" src="/src/main.ts"></script>
  234. </body>
  235. </html>