index.html 9.1 KB

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