heyang 3 lat temu
rodzic
commit
efd99a2453

+ 1 - 0
microserviceUserH5/static/css/changePhoneActivity.css

@@ -165,6 +165,7 @@ ul, li {
   align-items: center;
 }
 .login-row-title{
+  width: 0.84rem;
   font-size: 0.28rem;
   margin-left: 0.16rem;
 }

+ 33 - 0
microserviceUserH5/static/css/webOnServer.css

@@ -0,0 +1,33 @@
+@media screen and (max-width: 750px) {
+  html {
+    font-size: calc(100vw / 7.5);
+  }
+}
+
+@media screen and (min-width: 750px) {
+  html {
+    font-size: calc(450px / 7.5);
+  }
+}
+
+html, body, div, ul, li, p {
+  padding: 0;
+  margin: 0;
+}
+
+ul, li {
+  list-style: none;
+}
+
+.container{
+  width: 7.5rem;
+  height: 100vh;
+  background: #F2F2F2;
+  margin: 0 auto;
+}
+
+.title{
+  width: 100%;
+  text-align: center;
+  font-size: 0.4rem;
+}

BIN
microserviceUserH5/static/img/webOnServer/add.png


BIN
microserviceUserH5/static/img/webOnServer/down.png


BIN
microserviceUserH5/static/img/webOnServer/download.png


BIN
microserviceUserH5/static/img/webOnServer/phone.png


+ 20 - 3
microserviceUserH5/vcloud/invite.html

@@ -23,6 +23,7 @@
 			<img class="activity-bg" src="../static/img/changePhoneActivity/activity-bg.png" />
 			<img class="time" src="../static/img/changePhoneActivity/time.png" />
 			<div class="login-container">
+			   <div class="ipt"></div>
 			   <img class="login-bg" src="../static/img/changePhoneActivity/login-bg.png" />
 			   <div class="login-row-select">
 				   <div class="login-row-title">平台:</div>
@@ -189,15 +190,31 @@
 			stopManyClick(() => {
 				var oInput = document.createElement('input'); //创建一个input
 				oInput.setAttribute("readonly", "readonly");//设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
-				oInput.value = window.location.href || 'https://client.androidscloud.com/h5/microserviceUserH5/vcloud/invite.html';
-				document.body.appendChild(oInput);//将input插入到body
-				oInput.select(); // 选择对象
+				oInput.value = window.location.href;
+				$('.ipt')[0].appendChild(oInput);//将input插入到body
+				// oInput.select(); // 选择对象 ios不支持
+				selectText(oInput, 0, oInput.value.length);
 				document.execCommand("Copy"); // 执行浏览器复制命令
 				toastr.error('复制当前网址成功!');
 				oInput.style.display='none'; // 将input隐藏
+				oInput.blur();
 				oInput.remove(); // 将input销毁
 			})
 		}
+		// input自带的select()方法在苹果端无法进行选择,所以需要自己去写一个类似的方法
+		// 选择文本。createTextRange(setSelectionRange)是input方法
+		function selectText(textbox, startIndex, stopIndex) {
+		if (textbox.createTextRange) {//ie
+			const range = textbox.createTextRange();
+			range.collapse(true);
+			range.moveStart('character', startIndex);//起始光标
+			range.moveEnd('character', stopIndex - startIndex);//结束光标
+			range.select();//不兼容苹果
+		} else {//firefox/chrome
+			textbox.setSelectionRange(startIndex, stopIndex);
+			textbox.focus();
+		}
+		}
 		//点击选择框
 		$('.login-row-select')[0].addEventListener('click',()=>{
 			$('.options')[0].className = 'options show';

+ 71 - 0
microserviceUserH5/vcloud/webOnServer.html

@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta name="apple-mobile-web-app-capable" content="yes">
+    <meta name="apple-mobile-web-app-status-bar-style" content="black">
+    <meta content="text/html charset=UTF-8" http-equiv="Content-Type" />
+    <meta charset="UTF-8">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+	<link rel="icon" href="../static/img/favicon2.ico" type="img/x-ico">
+	<link rel="stylesheet" href="../static/css/webOnServer.css">
+    <!--快捷方式默认图标:icon-->
+    <title>双子星</title>
+    <!--快捷方式默认标题:name-->
+</head>
+
+<body>
+    <div class="container">
+        <div class="title">添加应用到桌面</div>
+        <div>
+            <img src="../static/img/webOnServer/phone.png" />
+        </div>
+        <a href="" id="qbt" style="display: none;"></a>
+        <!--快捷方式参数url:url-->
+        <span id="msg"></span>
+    </div>
+</body>
+<script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.1.1/jquery.min.js"></script>
+<script>
+    (function ($) {
+        $.extend({
+            urlGet: function () {
+                var aQuery = window.location.href.split("?");  //取得Get参数
+                var aGET = new Array();
+                if (aQuery.length > 1) {
+                    var aBuf = aQuery[1].split("&");
+                    for (var i = 0, iLoop = aBuf.length; i < iLoop; i++) {
+                        var aTmp = aBuf[i].split("=");  //分离key与Value
+                        aGET[aTmp[0]] = aTmp[1];
+                    }
+                }
+                return aGET;
+            }
+        })
+
+        var GET = $.urlGet(); //获取URL的Get参数
+        var account = GET['account'];
+        var phoneID = GET['phoneID'];
+        var appID = GET['appID'];
+        var icon = GET['icon'];
+        var name = decodeURI(GET['name']);
+        
+        $(document).attr("title",name);
+        var url = "shuangzixingiOSApp://h5/microserviceUserH5/vcloud/shortcut/webOnServer.html?"
+        var href_srt = decodeURI("account="+account+"&phoneID="+phoneID+"&appID="+appID+"&icon="+icon+"&name="+name)
+        $("#qbt").attr("href",url+href_srt)
+        $("link[rel='apple-touch-icon']").attr("href",icon)
+
+        if (window.navigator.standalone == true) {
+            var lnk = document.getElementById("qbt").click();
+            // todo 点击快捷方式 打开app引导页 样式
+        }
+        else {
+            document.getElementById("msg").innerHTML = '<div style="font-size:12px">添加快捷方式引导页</div>';
+            // todo 添加快捷方式引导页 样式
+        }
+
+    })(jQuery);
+</script>
+
+</html>