index.html 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8"/>
  5. <meta name="referrer" content="no-referrer">
  6. <script>
  7. var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
  8. CSS.supports('top: constant(a)'))
  9. document.write(
  10. '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
  11. (coverSupport ? ', viewport-fit=cover' : '') + '" />')
  12. </script>
  13. <title></title>
  14. <!--preload-links-->
  15. <!--app-context-->
  16. </head>
  17. <body>
  18. <div id="app"><!--app-html--></div>
  19. <script type="module" src="/main.js"></script>
  20. <script>
  21. document.addEventListener('UniAppJSBridgeReady', function () {
  22. uni.webView.postMessage({
  23. data: {
  24. action: 'setPlatform'
  25. }
  26. });
  27. window.backup = (from) => {
  28. if (from === 'backbutton') {
  29. const routes = getCurrentPages();
  30. const route = routes[routes.length - 1].route;
  31. if ([
  32. 'pages/login/login',
  33. 'pages/index/index',
  34. 'pages/ie/portal',
  35. 'pages/personal-center/index/index'
  36. ].includes(route)) {
  37. uni.webView.postMessage({
  38. data: {
  39. action: 'quit'
  40. }
  41. });
  42. } else {
  43. uni.navigateBack();
  44. }
  45. }
  46. };
  47. // 默认为h5平台
  48. window.platform = 'h5';
  49. window.setPlatform = (platform) => {
  50. window.platform = platform;
  51. window.dispatchEvent(new Event('platformChange'));
  52. };
  53. });
  54. </script>
  55. </body>
  56. </html>