downApp.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  6. <title>双子星云手机</title>
  7. <link rel="icon" href="../static/img/favicon2.ico" type="img/x-ico">
  8. <link rel="stylesheet" href="../static/js/vender/toastr/toastr.min.css">
  9. <script src="../static/js/vender/jquery-3.4.1.min.js"></script>
  10. <script src="../static/js/vender/toastr/toastr.min.js"></script>
  11. <script src="../static/js/vender/config.js"></script>
  12. <style>
  13. @media screen and (max-width: 750px) {
  14. html {
  15. font-size: calc(100vw / 7.5);
  16. }
  17. }
  18. @media screen and (min-width: 750px) {
  19. html {
  20. font-size: calc(450px / 7.5);
  21. }
  22. }
  23. html, body, div, ul, li, p {
  24. padding: 0;
  25. margin: 0;
  26. }
  27. ul, li {
  28. list-style: none;
  29. }
  30. .container{
  31. width: 7.5rem;
  32. height: 116vh;
  33. position: relative;
  34. }
  35. .down-bg{
  36. width: 100%;
  37. height: 100%;
  38. position: relative;
  39. }
  40. .down-row{
  41. width: 6.7rem;
  42. height: 1rem;
  43. position: fixed;
  44. bottom: 0.2rem;
  45. left: 50%;
  46. transform: translateX(-50%);
  47. display: flex;
  48. justify-content: space-between;
  49. align-items: center;
  50. font-size: 0.24rem;
  51. background: linear-gradient(180deg, #251282 0%, #140463 100%);
  52. color: #ffffff;
  53. border-radius: 0.18rem;
  54. border: 0.02rem solid #412DA4;
  55. padding: 0 0.2rem;
  56. }
  57. /* .left{
  58. } */
  59. .address{
  60. text-align: center;
  61. width: 4rem;
  62. height: 0.6rem;
  63. line-height: 0.6rem;
  64. background-color: #ffffff;
  65. color: #333333;
  66. border-radius: 0.1rem;
  67. z-index: 999;
  68. overflow: hidden;
  69. padding: 0 0.08rem;
  70. text-overflow:ellipsis;
  71. white-space: nowrap;
  72. }
  73. .right-btn{
  74. width: 1.1rem;
  75. height: 0.6rem;
  76. line-height: 0.6rem;
  77. text-align: center;
  78. background: #6048D8;
  79. box-shadow: 0 0.04rem 0.12rem 0 rgba(60, 31, 201, 0.4), 0 0.02rem 0.26rem 0 rgba(255, 255, 255, 0.29);
  80. border-radius: 0.1rem;
  81. background-color: #6048D8;
  82. }
  83. .down-pic{
  84. width: 4.74rem;
  85. height: 4.74rem;
  86. position: absolute;
  87. bottom: 2.4rem;
  88. left: 50%;
  89. transform: translateX(-50%);
  90. }
  91. #toast-container>.toast-error {
  92. background-image: none !important;
  93. }
  94. .toast-error {
  95. background-color: rgba(0, 0, 0, 0.8);
  96. }
  97. #toast-container>div {
  98. font-size: 14px;
  99. min-width: 80px !important;
  100. padding: 12px !important;
  101. box-shadow: none;
  102. }
  103. .toast-center-center {
  104. min-width: 100px;
  105. top: 50%;
  106. left: 50%;
  107. text-align: center;
  108. transform: translateX(-50%);
  109. }
  110. @media (max-width: 480px) and (min-width: 241px) {
  111. #toast-container>div {
  112. min-width: 80px !important;
  113. width: auto;
  114. }
  115. }
  116. </style>
  117. </head>
  118. <body>
  119. <div class="container">
  120. <img class="down-bg" src="../static/img/down-bg.png" />
  121. <img class="down-pic" src="../static/img/doubleElevenActivity/pic.jpg" />
  122. <div class="down-row">
  123. <div class="left">下载链接</div>
  124. <div class="address">http://www.androidscloud.com/suanchou</div>
  125. <div class="right-btn">复制</div>
  126. </div>
  127. <div class="ipt"></div>
  128. </div>
  129. <script type="text/javascript">
  130. let timer,flag = true;
  131. //点击复制按钮
  132. $('.right-btn')[0].addEventListener('click',copyUrl);
  133. //复制
  134. function copyUrl(){
  135. stopManyClick(() => {
  136. var oInput = document.createElement('input'); //创建一个input
  137. oInput.setAttribute("readonly", "readonly");//设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
  138. oInput.value = 'http://www.androidscloud.com/suanchou';
  139. $('.ipt')[0].appendChild(oInput);//将input插入到body
  140. // oInput.select(); // 选择对象 ios不支持
  141. selectText(oInput, 0, oInput.value.length);
  142. document.execCommand("Copy"); // 执行浏览器复制命令
  143. toastr.error('复制当前网址成功!');
  144. oInput.style.display='none'; // 将input隐藏
  145. oInput.blur();
  146. oInput.remove(); // 将input销毁
  147. })
  148. }
  149. // input自带的select()方法在苹果端无法进行选择,所以需要自己去写一个类似的方法
  150. // 选择文本。createTextRange(setSelectionRange)是input方法
  151. function selectText(textbox, startIndex, stopIndex) {
  152. if (textbox.createTextRange) {//ie
  153. const range = textbox.createTextRange();
  154. range.collapse(true);
  155. range.moveStart('character', startIndex);//起始光标
  156. range.moveEnd('character', stopIndex - startIndex);//结束光标
  157. range.select();//不兼容苹果
  158. } else {//firefox/chrome
  159. textbox.setSelectionRange(startIndex, stopIndex);
  160. textbox.focus();
  161. }
  162. }
  163. //防止提示一秒内重复显示
  164. function stopManyClick(fn) {
  165. if (flag) {
  166. fn();
  167. }
  168. flag = false;
  169. if(timer){clearTimeout(timer);}
  170. timer = setTimeout(() => {flag = true}, 1500);
  171. }
  172. </script>
  173. </body>
  174. </html>