谢杰标 2 سال پیش
والد
کامیت
6925643b85
4فایلهای تغییر یافته به همراه89 افزوده شده و 12 حذف شده
  1. 38 10
      index.html
  2. 4 2
      manifest.json
  3. 37 0
      static/adapt-pc/pc.css
  4. 10 0
      static/adapt-pc/pc.js

+ 38 - 10
index.html

@@ -1,20 +1,48 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
   <head>
-    <meta charset="UTF-8" />
+    <meta charset="utf-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <title><%= htmlWebpackPlugin.options.title %></title>
+    <!-- Open Graph data -->
+    <!-- <meta property="og:title" content="Title Here" /> -->
+    <!-- <meta property="og:url" content="http://www.example.com/" /> -->
+    <!-- <meta property="og:image" content="http://example.com/image.jpg" /> -->
+    <!-- <meta property="og:description" content="Description Here" /> -->
     <script>
-      var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
-        CSS.supports('top: constant(a)'))
+      var coverSupport =
+        "CSS" in window &&
+        typeof CSS.supports === "function" &&
+        (CSS.supports("top: env(a)") || CSS.supports("top: constant(a)"));
       document.write(
         '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
-        (coverSupport ? ', viewport-fit=cover' : '') + '" />')
+          (coverSupport ? ", viewport-fit=cover" : "") +
+          '" />'
+      );
     </script>
-    <title></title>
-    <!--preload-links-->
-    <!--app-context-->
+    <link
+      rel="stylesheet"
+      href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css"
+    />
+    <link rel="stylesheet" href="<%= BASE_URL %>static/adapt-pc/pc.css" />
   </head>
   <body>
-    <div id="app"><!--app-html--></div>
-    <script type="module" src="/main.js"></script>
+    <noscript>
+      <strong>Please enable JavaScript to continue.</strong>
+    </noscript>
+    <div id="app"></div>
+    <!-- built files will be auto injected -->
+    <uni-adapt-pc></uni-adapt-pc>
+    <!--  -->
+    <script type="text/html" id="tpl-adapt-pc">
+      <div class="container">
+        <iframe src="helang-mobile-href"></iframe>
+      </div>
+    </script>
+
+    <script
+      type="text/JavaScript"
+      src="<%= BASE_URL %>static/adapt-pc/pc.js"
+    ></script>
   </body>
 </html>

+ 4 - 2
manifest.json

@@ -71,10 +71,12 @@
     "vueVersion" : "2",
     "h5" : {
         "router" : {
-            "mode" : "history"
+            "mode" : "history",
+            "base" : ""
         },
         "devServer" : {
             "https" : false
-        }
+        },
+        "template" : "index.html"
     }
 }

+ 37 - 0
static/adapt-pc/pc.css

@@ -0,0 +1,37 @@
+
+body[adapt='pc']>*{
+	display: none !important;
+}
+ 
+body[adapt='pc']>uni-adapt-pc{
+	display: block !important;
+}
+ 
+body[adapt='pc'] {
+	margin: 0;
+	background-color: #fff;
+	width: 100vw;
+	height: 100vh;
+}
+ 
+body[adapt='pc'] uni-adapt-pc .container{
+	position: fixed;
+	width: 375px;
+	height: 100%;
+	z-index: 1;
+	top: 0;
+	right: 0;
+	bottom: 0;
+	left: 0;
+	margin: auto;
+	max-height: 680px;
+	box-sizing: border-box;
+	border: 1px solid #ddd;
+	box-shadow: 0 0 10px #ddd;
+}
+ 
+body[adapt='pc'] uni-adapt-pc iframe{
+	width: 100%;
+	height: 100%;
+	border: none;
+}

+ 10 - 0
static/adapt-pc/pc.js

@@ -0,0 +1,10 @@
+;(function(){
+	console.log(243)
+	if(window.innerWidth < 768){
+		return;
+	}
+	var tpl = document.querySelector("#tpl-adapt-pc").innerHTML || '';
+	tpl = tpl.replace('helang-mobile-href',window.location.href);
+	document.querySelector("uni-adapt-pc").innerHTML = tpl;
+	document.body.setAttribute("adapt","pc");
+})();