|
@@ -1,43 +1,88 @@
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="zh-CN">
|
|
|
- <head>
|
|
|
- <meta charset="utf-8">
|
|
|
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
- <link rel="shortcut icon" type="image/x-icon" href="/static/img/favicon.ico">
|
|
|
- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
|
- <title>
|
|
|
- <%= htmlWebpackPlugin.options.title %>
|
|
|
- </title>
|
|
|
- <script src="/static/common/js/config.js"></script>
|
|
|
- <!-- 正式发布的时候使用,开发期间不启用。↓ -->
|
|
|
- <script src="/static/common/js/touch-emulator.js"></script>
|
|
|
- <script>
|
|
|
- TouchEmulator();
|
|
|
- </script>
|
|
|
- <style>
|
|
|
- ::-webkit-scrollbar{
|
|
|
- display: none;
|
|
|
- }
|
|
|
- </style>
|
|
|
- <!-- 正式发布的时候使用,开发期间不启用。↑ -->
|
|
|
- <script>
|
|
|
- document.addEventListener('DOMContentLoaded', function() {
|
|
|
- document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
|
|
|
- })
|
|
|
- </script>
|
|
|
- <link rel="stylesheet" href="<%= BASE_URL %>static/index.css" />
|
|
|
- </head>
|
|
|
- <body>
|
|
|
- <!-- 该文件为 H5 平台的模板 HTML,并非应用入口。 -->
|
|
|
- <!-- 请勿在此文件编写页面代码或直接运行此文件。 -->
|
|
|
- <!-- 详见文档:https://uniapp.dcloud.io/collocation/manifest?id=h5-template -->
|
|
|
- <noscript>
|
|
|
- <strong>本站点必须要开启JavaScript才能运行</strong>
|
|
|
- </noscript>
|
|
|
- <div id="app"></div>
|
|
|
- <!-- built files will be auto injected -->
|
|
|
- <script>
|
|
|
- /*BAIDU_STAT*/
|
|
|
- </script>
|
|
|
- </body>
|
|
|
+<head>
|
|
|
+ <meta charset="utf-8">
|
|
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
+ <link rel="shortcut icon" type="image/x-icon" href="/static/img/favicon.ico">
|
|
|
+ <meta name="viewport"
|
|
|
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
|
+ <title>
|
|
|
+ <%= htmlWebpackPlugin.options.title %>
|
|
|
+ </title>
|
|
|
+ <script src="/static/common/js/config.js"></script>
|
|
|
+ <!-- 正式发布的时候使用,开发期间不启用。↓ -->
|
|
|
+ <script src="/static/common/js/touch-emulator.js"></script>
|
|
|
+ <script>
|
|
|
+ TouchEmulator();
|
|
|
+ </script>
|
|
|
+ <style>
|
|
|
+ ::-webkit-scrollbar {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <!-- 正式发布的时候使用,开发期间不启用。↑ -->
|
|
|
+ <script>
|
|
|
+ document.addEventListener('DOMContentLoaded', function () {
|
|
|
+ document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
|
|
|
+ })
|
|
|
+ var u = navigator.userAgent;
|
|
|
+ var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
|
|
|
+ var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
|
|
|
+ function setupWebViewJsBridge(params) {
|
|
|
+ if (window.WKWebViewJavascriptBridge) {
|
|
|
+ return params(window.WKWebViewJavascriptBridge);
|
|
|
+ }
|
|
|
+ if (window.WKWVJBCallbacks) {
|
|
|
+ window.WKWVJBCallbacks.push(params);
|
|
|
+ } else {
|
|
|
+ window.WKWVJBCallbacks = [params];
|
|
|
+ }
|
|
|
+ if (isAndroid) {
|
|
|
+ if (!window.InjectJavascript) {
|
|
|
+ window.alert("ERROR: window.InjectJavascript if null!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ window.InjectJavascript.init();
|
|
|
+ } else if (isiOS) {
|
|
|
+ window.webkit && window.webkit.messageHandlers.h5ToApp.postMessage(params); // 给 ios 传参
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function appToH5(data) {
|
|
|
+ let obj = JSON.parse(data)
|
|
|
+ for (const key in obj) {
|
|
|
+ if (obj.hasOwnProperty(key)) {
|
|
|
+ window[key] = obj[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function insideH5ToApp(params) {
|
|
|
+ setupWebViewJsBridge(isiOS ? JSON.stringify(params) : function (bridge) {
|
|
|
+ bridge.callHandler("h5ToApp", {key: params.key}, function (data) {
|
|
|
+ typeof window[params.void] === 'function' && window[params.void](data)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ isAndroid && setupWebViewJsBridge(function (bridge) {
|
|
|
+ bridge.registerHandler("appToH5", function (data, callback) {
|
|
|
+ appToH5(JSON.stringify(data));
|
|
|
+ })
|
|
|
+ });
|
|
|
+ window.insideH5ToApp = insideH5ToApp; // 自己调用
|
|
|
+ window.appToH5 = appToH5;
|
|
|
+ </script>
|
|
|
+ <link rel="stylesheet" href="<%= BASE_URL %>static/index.css"/>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<!-- 该文件为 H5 平台的模板 HTML,并非应用入口。 -->
|
|
|
+<!-- 请勿在此文件编写页面代码或直接运行此文件。 -->
|
|
|
+<!-- 详见文档:https://uniapp.dcloud.io/collocation/manifest?id=h5-template -->
|
|
|
+<noscript>
|
|
|
+ <strong>本站点必须要开启JavaScript才能运行</strong>
|
|
|
+</noscript>
|
|
|
+<div id="app"></div>
|
|
|
+<!-- built files will be auto injected -->
|
|
|
+<script>
|
|
|
+ /*BAIDU_STAT*/
|
|
|
+</script>
|
|
|
+</body>
|
|
|
</html>
|