index.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title>
  7. <%= htmlWebpackPlugin.options.title %>
  8. </title>
  9. <script>
  10. var _hmt = _hmt || [];
  11. (function() {
  12. var hm = document.createElement("script");
  13. hm.src = "https://hm.baidu.com/hm.js?c4d2113682fb35862a0acaa7679c09fd";
  14. var s = document.getElementsByTagName("script")[0];
  15. s.parentNode.insertBefore(hm, s);
  16. })();
  17. </script>
  18. <script>
  19. var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS
  20. .supports('top: constant(a)'))
  21. document.write(
  22. '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
  23. (coverSupport ? ', viewport-fit=cover' : '') + '" />')
  24. </script>
  25. <link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
  26. <link href="https://cdn.bootcdn.net/ajax/libs/normalize/8.0.1/normalize.min.css" rel="stylesheet">
  27. <script src="https://wwcdn.weixin.qq.com/node/wework/wwopen/js/wwLogin-1.2.7.js" type="text/javascript"
  28. charset="utf-8"></script>
  29. <script type="text/javascript">
  30. var userAgent = navigator.userAgent;
  31. if (userAgent.indexOf('AlipayClient') > -1) {
  32. // 支付宝小程序的 JS-SDK 防止 404 需要动态加载,如果不需要兼容支付宝小程序,则无需引用此 JS 文件。
  33. document.writeln('<script src="https://appx/web-view.min.js"' + '>' + '<' + '/' + 'script>');
  34. } else if (/QQ/i.test(userAgent) && /miniProgram/i.test(userAgent)) {
  35. // QQ 小程序
  36. document.write(
  37. '<script type="text/javascript" src="https://qqq.gtimg.cn/miniprogram/webview_jssdk/qqjssdk-1.0.0.js"><\/script>'
  38. );
  39. } else if (/miniProgram/i.test(userAgent) && /micromessenger/i.test(userAgent)) {
  40. // 微信小程序 JS-SDK 如果不需要兼容微信小程序,则无需引用此 JS 文件。
  41. document.write(
  42. '<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"><\/script>');
  43. } else if (/toutiaomicroapp/i.test(userAgent)) {
  44. // 头条小程序 JS-SDK 如果不需要兼容头条小程序,则无需引用此 JS 文件。
  45. document.write(
  46. '<script type="text/javascript" src="https://s3.pstatp.com/toutiao/tmajssdk/jssdk-1.0.1.js"><\/script>');
  47. } else if (/swan/i.test(userAgent)) {
  48. // 百度小程序 JS-SDK 如果不需要兼容百度小程序,则无需引用此 JS 文件。
  49. document.write(
  50. '<script type="text/javascript" src="https://b.bdstatic.com/searchbox/icms/searchbox/js/swan-2.0.18.js"><\/script>'
  51. );
  52. } else if (/quickapp/i.test(userAgent)) {
  53. // quickapp
  54. document.write('<script type="text/javascript" src="https://quickapp/jssdk.webview.min.js"><\/script>');
  55. }
  56. </script>
  57. <script type="text/javascript">
  58. ! function(e, n) {
  59. "object" == typeof exports && "undefined" != typeof module ? module.exports = n() : "function" ==
  60. typeof define && define.amd ? define(n) : e.uniWebview = n()
  61. }(this, function() {
  62. "use strict";
  63. var e = {},
  64. a = [],
  65. n = function(e, n) {
  66. if (0 === a.length) {
  67. var i = plus.webview.currentWebview();
  68. if (!i) throw new Error("plus.webview.currentWebview() is undefined");
  69. var t = i.parent();
  70. if (!t) throw new Error("plus.webview.currentWebview().parent() is undefined");
  71. a.push(t.id)
  72. }
  73. var r = JSON.stringify({
  74. options: {
  75. timestamp: +new Date
  76. },
  77. name: e,
  78. arg: n
  79. });
  80. plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("WEB_INVOKE_APPSERVICE",' + r +
  81. "," + JSON.stringify(a) + ");")
  82. };
  83. e.navigateTo = function() {
  84. var e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).url;
  85. n("navigateTo", {
  86. url: encodeURI(e)
  87. })
  88. }, e.navigateBack = function() {
  89. var e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).delta;
  90. n("navigateBack", {
  91. delta: parseInt(e) || 1
  92. })
  93. }, e.switchTab = function() {
  94. var e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).url;
  95. n("switchTab", {
  96. url: encodeURI(e)
  97. })
  98. }, e.reLaunch = function() {
  99. var e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).url;
  100. n("reLaunch", {
  101. url: encodeURI(e)
  102. })
  103. }, e.redirectTo = function() {
  104. var e = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).url;
  105. n("redirectTo", {
  106. url: encodeURI(e)
  107. })
  108. }, e.getEnv = function(e) {
  109. e({
  110. plus: !0
  111. })
  112. }, e.postMessage = function() {
  113. var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
  114. n("postMessage", e.data || {})
  115. };
  116. var i = {};
  117. "undefined" != typeof wx && wx.miniProgram && (i.navigateTo = wx.miniProgram.navigateTo, i.navigateBack = wx
  118. .miniProgram.navigateBack, i.switchTab = wx.miniProgram.switchTab, i.reLaunch = wx.miniProgram.reLaunch, i
  119. .redirectTo = wx.miniProgram.redirectTo, i.postMessage = wx.miniProgram.postMessage, i.getEnv = wx
  120. .miniProgram.getEnv);
  121. var t = /uni-app/i.test(navigator.userAgent),
  122. r = /micromessenger/i.test(navigator.userAgent),
  123. o = {},
  124. d = function() {
  125. window.UniAppJSBridge = !0, document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady", {
  126. bubbles: !0,
  127. cancelable: !0
  128. }))
  129. };
  130. return t && (o = e, window.plus && /complete|loaded|interactive/.test(document.readyState) ? d() : document
  131. .addEventListener("plusready", d)), r && (o = i, window.WeixinJSBridge && WeixinJSBridge.invoke ? d() :
  132. document.addEventListener("WeixinJSBridgeReady", d)), o
  133. });
  134. </script>
  135. <script>
  136. document.addEventListener('UniAppJSBridgeReady', function() {
  137. uniWebview.getEnv(function(res) {
  138. console.log('当前环境:' + JSON.stringify(res))
  139. });
  140. });
  141. </script>
  142. </head>
  143. <body>
  144. <noscript>
  145. <strong>Please enable JavaScript to continue.</strong>
  146. </noscript>
  147. <div id="app"></div>
  148. <!-- built files will be auto injected -->
  149. </body>
  150. </html>