index.html 1.7 KB

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