index.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. <title>音乐数字课堂</title>
  32. <style>
  33. body {
  34. background: #f1f5ff;
  35. width: 100%;
  36. }
  37. .bgImg {
  38. width: 456px;
  39. height: 522px;
  40. }
  41. .btnImg {
  42. width: 288px;
  43. position: absolute;
  44. left: 50%;
  45. margin-left: -144px;
  46. bottom: 31px;
  47. cursor: pointer;
  48. z-index: 100;
  49. }
  50. .imgWrap {
  51. width: 456px;
  52. height: 522px;
  53. margin: 140px auto 0;
  54. position: relative;
  55. z-index: 100;
  56. }
  57. /* margin-top: 300px; */
  58. .textWrap {
  59. margin-top: 140px;
  60. text-align: center;
  61. width: 500px;
  62. position: absolute;
  63. top: 141px;
  64. left: 50%;
  65. margin-left: -288px;
  66. }
  67. .subMsg {
  68. margin-top: 32px;
  69. font-size: 22px;
  70. line-height: 30px;
  71. color: #777;
  72. }
  73. .subBtn {
  74. width: 231px;
  75. height: 62px;
  76. background: #198CFE;
  77. border-radius: 18px;
  78. border: none;
  79. font-size: 22px;
  80. font-weight: 600;
  81. color: #FFFFFF;
  82. line-height: 30px;
  83. cursor: pointer;
  84. margin-top: 32px;
  85. list-style: none outside none;
  86. text-decoration: none;
  87. }
  88. </style>
  89. <script type="text/javascript">
  90. function gotoLinlk() {
  91. console.log('点击')
  92. var agent = navigator.userAgent.toLowerCase();
  93. var isMac = function () { return /macintosh|mac os x/i.test(navigator.userAgent); }();
  94. if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
  95. window.open('https://oss.dayaedu.com/appstore/ChromeStandaloneSetup32.exe');
  96. }
  97. if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
  98. window.open('https://oss.dayaedu.com/appstore/ChromeStandaloneSetup64.exe');
  99. }
  100. if (isMac) {
  101. window.open('https://oss.dayaedu.com/appstore/googlechrome-mac.dmg');
  102. }
  103. }
  104. function getChromeVersion() {
  105. var arr = navigator.userAgent.split(' ');
  106. var chromeVersion = '';
  107. for (var i = 0; i < arr.length; i++) {
  108. if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
  109. }
  110. if (chromeVersion) {
  111. return Number(chromeVersion.split('/')[1].split('.')[0]);
  112. } else {
  113. return false;
  114. }
  115. };
  116. function IsFF() {
  117. var sAgent = window.navigator.userAgent.toLowerCase();
  118. if (sAgent.indexOf("firefox") != -1) {
  119. return true;
  120. }
  121. return false;
  122. }
  123. function isChrome() {
  124. var isChromium = window.chrome;
  125. var winNav = window.navigator;
  126. var vendorName = winNav.vendor;
  127. var isOpera = typeof window.opr !== 'undefined';
  128. var isIEedge = winNav.userAgent.indexOf('Edge') > -1;
  129. var isIOSChrome = winNav.userAgent.match('CriOS');
  130. return (
  131. isIOSChrome ||
  132. (isChromium !== null &&
  133. typeof isChromium !== 'undefined' &&
  134. vendorName === 'Google Inc.' &&
  135. isOpera === false &&
  136. isIEedge === false)
  137. );
  138. };
  139. function IEVersion() {
  140. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  141. var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
  142. var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
  143. var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
  144. if (isIE) {
  145. var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
  146. reIE.test(userAgent);
  147. var fIEVersion = parseFloat(RegExp["$1"]);
  148. if (fIEVersion == 7) {
  149. return 7;
  150. } else if (fIEVersion == 8) {
  151. return 8;
  152. } else if (fIEVersion == 9) {
  153. return 9;
  154. } else if (fIEVersion == 10) {
  155. return 10;
  156. } else {
  157. return 6;//IE版本<=7
  158. }
  159. } else if (isEdge) {
  160. return 'edge';//edge
  161. } else if (isIE11) {
  162. return 11; //IE11
  163. } else {
  164. return -1;//不是ie浏览器
  165. }
  166. }
  167. (function (window) {
  168. const reloadPage = async () => {
  169. if ('serviceWorker' in navigator) {
  170. // let refreshing = false
  171. const flag = (await caches.keys()).length > 0;
  172. // console.log(caches.keys(), `0904路由更新有缓存${flag}`);
  173. caches.keys().then(function (cacheNames) {
  174. cacheNames.forEach(function (cacheName) {
  175. caches.delete(cacheName);
  176. });
  177. });
  178. // 尝试监听install
  179. }
  180. console.log('index.html')
  181. window.location.reload();
  182. }
  183. // let refreshing = false
  184. // if ('serviceWorker' in navigator) {
  185. // // let refreshing = false
  186. // let flag = caches.keys().length > 0
  187. // console.log(caches.keys(), 'caches.keys()', `是否有缓存${flag}`);
  188. // caches.keys().then(function (cacheNames) {
  189. // cacheNames.forEach(function (cacheName) {
  190. // caches.delete(cacheName);
  191. // });
  192. // if (flag) {
  193. // window.location.reload()
  194. // }
  195. // });
  196. // // 尝试监听install
  197. // }
  198. // let refreshing = false
  199. // navigator.serviceWorker.addEventListener('controllerchange', () => {
  200. // console.log('controllerchange')
  201. // if (refreshing) {
  202. // return
  203. // }
  204. // refreshing = true;
  205. // window.location.reload();
  206. // })
  207. if (!isChrome()) {
  208. // 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>");
  209. if (IEVersion() < 9 && IEVersion() != -1) {
  210. document.writeln(" <div class='textWrap'><h1>当前浏览器版本过低</h1><p class='subMsg'>为了保证良好的上课体验,推荐您使用谷歌浏览器</p> <button class='subBtn' onclick='gotoLinlk()'>下载谷歌浏览器</button>");
  211. document.execCommand("Stop");
  212. } else {
  213. 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>");
  214. document.execCommand("Stop");
  215. }
  216. } else {
  217. if (getChromeVersion() < 90) {
  218. 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>");
  219. document.execCommand("Stop");
  220. window.stop()
  221. console.log('Stop')
  222. }
  223. // if (IsFF()) {
  224. }
  225. })(window);
  226. </script>
  227. </head>
  228. <!-- 按钮 https://oss.dayaedu.com/gyt/basic/1688699779209.png -->
  229. <!-- 背景 https://oss.dayaedu.com/gyt/basic/1688699993534.png -->
  230. <body class="myBody">
  231. <div id="app"></div>
  232. <script type="module" src="/src/main.ts"></script>
  233. </body>
  234. </html>