暂无描述

index.html 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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" type="text/css" href="public/public_css.css"/>
  9. <style type="text/css">
  10. body{ min-height:100vh;}
  11. .banner{width: 3.025rem;height: 1.15rem;margin: auto;padding-top: 0.11rem;}
  12. .banner img{width: 100%;}
  13. .red_packet{margin: auto;}
  14. .red_packet .click{font-size:0.18rem;color:#FB3D38;text-align: center;padding-top: 0.2rem;padding-bottom: 0.2rem;}
  15. .red_packet .copy{width:0.94rem;height:0.26rem;margin:auto;color:#FFF;font-size:0.15rem;line-height: 0.26rem;text-align:center;background:#FB3D38;border-radius:0.075rem;box-shadow:0.02rem 0.045rem 0.05rem rgba(143,141,141,0.22);}
  16. .red_packet .con{font-size:0.14rem;color:#666666;padding-top: 0.2rem;padding-bottom: 0.345rem;text-align: center;}
  17. .already{height: 2rem;padding-left: 0.16rem;padding-right: 0.15rem;}
  18. .already .num{font-size:0.15rem;color:#FB3D38;padding-bottom: 0.175rem;}
  19. .already ul{height: 1.305rem;overflow-x:hidden;overflow-y: scroll;}
  20. .already ul li{float: left;padding-bottom: 0.08rem;color: #666666;line-height: 0.355rem;}
  21. .already ul li img{float: left;display: block;width: 0.355rem;height: 0.355rem;border:0;}
  22. .already ul li .username{ display: inline-block; float: left;padding-left: 0.075rem;width: 1.1rem;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
  23. .already ul li .ed{padding-right: 0.48rem;}
  24. .already ul li .username,.already ul li .ed{font-size: 0.14rem;}
  25. .already ul li .day,.already ul li .time{font-size: 0.12rem;}
  26. .already ul li .day{padding-right:0.08rem ;}
  27. .cooperation{width:2.54rem;height: 0.46rem;margin: auto;background: url(images/add.png) no-repeat 0.6rem 0.125rem,url(images/add.png) no-repeat 1.65rem 0.125rem; background-size:0.22rem 0.22rem ;}
  28. .cooperation img{float:left;width: 0.46rem;margin-right: 0.57rem;}
  29. .cooperation img:nth-child(3){margin-right: 0rem;}
  30. .bottom{margin: auto;color: #FB3D38;text-align: center;font-size: 0.14rem;}
  31. .bottom p:nth-child(1){padding-top: 0.185rem;padding-bottom: 0.205rem;font-size: 0.15rem;}
  32. #copy_1,#copy_2,#taokouling{position: absolute;left: -1000rem;}
  33. .alert-info {position: absolute;top: 1.74rem;right: 0;left: 0;bottom: 0;text-align: center;}
  34. .alert-info p {display: inline-block;color: #fff;font-size: 0.14rem;line-height: 0.38rem;padding: 0 0.10rem;background-color: rgba(0, 0, 0, 0.7);border-radius: 5px;}
  35. .roll-wrap{height:1.305rem;overflow:hidden;}
  36. </style>
  37. <script type="text/javascript">
  38. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  39. window.onresize = function(){
  40. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  41. }
  42. </script>
  43. </head>
  44. <body>
  45. <div class="banner">
  46. <img src="images/banner.png"/>
  47. </div>
  48. <div class="red_packet">
  49. <p class="click">点我领红包</p>
  50. <p class="copy" onclick="collarRed()">领取红包</p>
  51. <p class="con">自动生成淘口令,打开手机淘宝领取红包</p>
  52. </div>
  53. <div class="already">
  54. <p class="num"></p>
  55. <div class="roll-wrap" id="roll-wrap">
  56. <ul>
  57. <!--<li><img src="images/001.png" /><span class="username">小豆***</span><span class="ed">领取了红包</span><span class="day">05-30</span><span class="time">14:36</span></li>
  58. <li><img src="images/001.png" /><span class="username">小兰***</span><span class="ed">领取了红包</span><span class="day">05-30</span><span class="time">14:37</span></li>
  59. <li><img src="images/001.png" /><span class="username">小豆紫***</span><span class="ed">领取了红包</span><span class="day">05-30</span><span class="time">15:36</span></li>-->
  60. </ul>
  61. </div>
  62. </div>
  63. <div class="cooperation">
  64. <img src="images/jinniu.png" alt="" />
  65. <img src="images/taobao.png" alt="" />
  66. <img src="images/liedou.png" alt="" />
  67. </div>
  68. <div class="bottom">
  69. <p>联合送礼</p>
  70. <p>下载猎豆优选,大额红包拿到手软</p>
  71. </div>
  72. <input id="copy_1" type="text" readOnly="true" value=""/>
  73. <div id="copy_2"></div>
  74. <text id="taokouling">€WVXSb1pT51S€</text>
  75. <div class="alert-info" style="display: none;">
  76. <!-- tip提示,3s后消失 -->
  77. <p></p>
  78. </div>
  79. </body>
  80. </html>
  81. <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
  82. <script type="text/javascript">
  83. var user_id = 1;
  84. //页面加载,显示数据
  85. window.onload = function () {
  86. Lead() ;
  87. }
  88. //领红包
  89. function collarRed() {
  90. $.ajax({
  91. type:"post",
  92. url:"/api/V2/receiveRedPacket",
  93. data:{
  94. user_id:user_id
  95. },
  96. success: function (res) {
  97. var data =JSON.parse(res)
  98. console.log(data)
  99. if(data.code == 0){
  100. copyPassword();
  101. }else if(data.code == 4003){
  102. console.log("领取失败")
  103. }
  104. }
  105. })
  106. }
  107. //已领红包
  108. function Lead() {
  109. $.ajax({
  110. type:"post",
  111. url:"/api/V2/returnRedPacket",
  112. success: function (res) {
  113. var data =JSON.parse(res)
  114. // console.log(data)
  115. if(data.code == 0){
  116. var dataArr = data.res.list,html = '',numHtml = '', name = '' , img = '';
  117. numHtml +='已有'+ data.res.count +'位用户领取红包';
  118. dataArr.forEach(function (item, index) {
  119. if(item.user_name){
  120. name = item.user_name;
  121. }else{
  122. name = '匿名';
  123. }
  124. if(item.user_img){
  125. img = item.user_img;
  126. }else{
  127. img = 'images/moren.png'
  128. }
  129. html += '<li><img src='+ img +' /><span class="username">'+ name +'</span><span class="ed">领取了红包</span><span class="day">'+ item.received_time +'</span></li>'
  130. })
  131. $('.num').html(numHtml);
  132. $('.roll-wrap ul').html(html)
  133. }
  134. new scrollTxt().init();
  135. }
  136. })
  137. }
  138. function copyPassword() {
  139. var data=document.getElementById("taokouling").innerHTML;
  140. copy_2.innerHTML = data;
  141. copy_1.value = data;
  142. if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
  143. //区分iPhone设备
  144. window.getSelection().removeAllRanges();//这段代码必须放在前面否则无效
  145. var Url2=document.getElementById("copy_2");//要复制文字的节点
  146. var range = document.createRange();
  147. // 选中需要复制的节点
  148. range.selectNode(Url2);
  149. // 执行选中元素
  150. window.getSelection().addRange(range);
  151. // 执行 copy 操作
  152. var successful = document.execCommand('copy');
  153. // 移除选中的元素
  154. window.getSelection().removeAllRanges();
  155. }else{
  156. var Url2=document.getElementById("copy_1");//要复制文字的节点
  157. Url2.select(); // 选择对象
  158. document.execCommand("Copy"); // 执行浏览器复制命令
  159. }
  160. window.location.href="Invitation.html"
  161. }
  162. function scrollTxt(){
  163. var controls={},
  164. values={},
  165. t1=200, /*播放动画的时间*/
  166. t2=1500, /*播放时间间隔*/
  167. si;
  168. controls.rollWrap=$("#roll-wrap");
  169. controls.rollWrapUl=controls.rollWrap.children();
  170. controls.rollWrapLIs=controls.rollWrapUl.children();
  171. values.liNums=controls.rollWrapLIs.length;
  172. values.liHeight=controls.rollWrapLIs.eq(0).height();
  173. values.ulHeight=controls.rollWrap.height();
  174. this.init=function(){
  175. autoPlay();
  176. // pausePlay();
  177. }
  178. /*滚动*/
  179. function play(){
  180. controls.rollWrapUl.animate({"margin-top" : "-"+values.liHeight}, t1, function(){
  181. $(this).css("margin-top" , "0").children().eq(0).appendTo($(this));
  182. });
  183. }
  184. /*自动滚动*/
  185. function autoPlay(){
  186. /*如果所有li标签的高度和大于.roll-wrap的高度则滚动*/
  187. if(values.liHeight*values.liNums > values.ulHeight){
  188. si=setInterval(function(){
  189. play();
  190. },t2);
  191. }
  192. }
  193. /*鼠标经过ul时暂停滚动*/
  194. function pausePlay(){
  195. controls.rollWrapUl.on({
  196. "mouseenter":function(){
  197. clearInterval(si);
  198. }
  199. ,
  200. "mouseleave":function(){
  201. autoPlay();
  202. }
  203. });
  204. }
  205. }
  206. </script>