Sin descripción

serviceEvmThree.html 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
  7. <title>添加客服</title>
  8. <link rel="stylesheet" href="../common/reset.css">
  9. <script type="text/javascript" src="../common/jquery-2.1.0.js"></script>
  10. <script type="text/javascript">
  11. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  12. window.onresize = function () {
  13. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  14. }
  15. </script>
  16. <style type="text/css">
  17. body{background: #fff;width:100%;min-height:100vh}
  18. .copyDiv{
  19. width: 2.6rem;
  20. height: 0.37rem;
  21. margin: auto;
  22. font-size: 0.16rem;
  23. display: flex;
  24. align-items: center;
  25. justify-content: space-between;
  26. position: absolute;
  27. left: 0;
  28. right: 0;
  29. top: 4.95rem;
  30. margin: auto;
  31. box-sizing: border-box;
  32. background: #ffee34;
  33. padding: 0 0.1rem;
  34. border-radius: 0.37rem;
  35. }
  36. .copyText{
  37. flex: 1;
  38. /* color: #930015; */
  39. color: #fe3237;
  40. padding: 0.03rem;
  41. font-size: 0.14rem;
  42. }
  43. .copyButton{
  44. width: 0.6rem;
  45. /* color: #930015; */
  46. color: #fe3237;
  47. text-align: center;
  48. }
  49. #copy_1,#copy_2{
  50. position: absolute;
  51. left: -1000rem;
  52. }
  53. .alert-info {
  54. position: fixed;
  55. top: 1.74rem;
  56. right: 0;
  57. left: 0;
  58. bottom: 0;
  59. text-align: center;
  60. }
  61. .alert-info p {
  62. display: inline-block;
  63. height: 0.38rem;
  64. color: #fff;
  65. font-size: 0.14rem;
  66. line-height: 0.38rem;
  67. padding: 0 0.10rem;
  68. background-color: rgba(0, 0, 0, 0.7);
  69. border-radius: 5px;
  70. }
  71. .content{
  72. width: 100%;
  73. }
  74. .content img{
  75. width: 100%;
  76. }
  77. </style>
  78. </head>
  79. <body>
  80. <div class="content">
  81. <img src="img/serviceEvmThree04.jpg?v=2" id="bgImg"/>
  82. <div class="copyDiv">
  83. <div class="copyText">微信号:<span id="wechatNumber">M13910555321</span></div>
  84. <div class="copyButton" onclick="copyEvent()">复制</div>
  85. </div>
  86. </div>
  87. <input id="copy_1" type="text" readOnly="true" value=""/>
  88. <div id="copy_2"></div>
  89. <div class="alert-info" style="display: none;">
  90. <!-- tip提示,3s后消失 -->
  91. <p></p>
  92. </div>
  93. </body>
  94. </html>
  95. <script type="text/javascript">
  96. var qs = parseQueryString(window.location.href);
  97. $().ready(function () {
  98. if(qs.wxNumber == 'P-P-1004'){
  99. $("#wechatNumber").html('P-P-1004');
  100. $("#bgImg").attr('src','img/serviceEvmThree0402.jpg')
  101. }
  102. if(qs.wxNumber == 'guopiao10041030'){
  103. $("#wechatNumber").html('guopiao10041030');
  104. $("#bgImg").attr('src','img/serviceEvmThree0403.jpg')
  105. }
  106. writeLogH5({action:'addServiceThree',channel:'H5',url:window.location.href});//埋点
  107. })
  108. function copyEvent () {
  109. var data=$("#wechatNumber").html();
  110. copy_2.innerHTML = data;
  111. copy_1.value = data;
  112. if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
  113. //区分iPhone设备
  114. window.getSelection().removeAllRanges();//这段代码必须放在前面否则无效
  115. var Url2=document.getElementById("copy_2");//要复制文字的节点
  116. var range = document.createRange();
  117. // 选中需要复制的节点
  118. range.selectNode(Url2);
  119. // 执行选中元素
  120. window.getSelection().addRange(range);
  121. // 执行 copy 操作
  122. var successful = document.execCommand('copy');
  123. // 移除选中的元素
  124. window.getSelection().removeAllRanges();
  125. }else{
  126. var Url2=document.getElementById("copy_1");//要复制文字的节点
  127. Url2.select(); // 选择对象
  128. document.execCommand("Copy"); // 执行浏览器复制命令
  129. }
  130. showMsg('复制成功')
  131. }
  132. //提示弹框
  133. function showMsg(msg) {
  134. var msgBox = document.getElementsByClassName('alert-info')[0];
  135. msgBox.children[0].innerText = msg;
  136. msgBox.style.display="block";
  137. setTimeout(function() {
  138. msgBox.style.display="none";
  139. }, 1500);
  140. }
  141. //H5页面埋点
  142. function writeLogH5 (data) {
  143. $.ajax({
  144. type:'post',
  145. url:'/api/v2/channel/writeLogH5',
  146. dataType:'json',
  147. data:data,
  148. success:function (res) {
  149. }
  150. })
  151. }
  152. function parseQueryString(url) {
  153. var urlObj = {};
  154. var reg = /([^?=&]+)=([^?=&]+)/g;
  155. url.replace(reg, function($0, $1, $2) {
  156. urlObj[$1] = decodeURIComponent($2);
  157. })
  158. return urlObj;
  159. }
  160. </script>