123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
- <title>分享领红包</title>
- <link rel="stylesheet" type="text/css" href="public/public_css.css"/>
- <style type="text/css">
- body{ min-height:100vh;}
- .banner{width: 3.025rem;height: 1.15rem;margin: auto;padding-top: 0.11rem;}
- .banner img{width: 100%;}
- .red_packet{margin: auto;}
- .red_packet .click{font-size:0.18rem;color:#FB3D38;text-align: center;padding-top: 0.2rem;padding-bottom: 0.2rem;}
- .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);}
- .red_packet .con{font-size:0.14rem;color:#666666;padding-top: 0.2rem;padding-bottom: 0.345rem;text-align: center;}
- .already{height: 2rem;padding-left: 0.16rem;padding-right: 0.15rem;}
- .already .num{font-size:0.15rem;color:#FB3D38;padding-bottom: 0.175rem;}
- .already ul{height: 1.305rem;overflow-x:hidden;overflow-y: scroll;}
- .already ul li{float: left;padding-bottom: 0.08rem;color: #666666;line-height: 0.355rem;}
- .already ul li img{float: left;display: block;width: 0.355rem;height: 0.355rem;border:0;}
- .already ul li .username{ display: inline-block; float: left;padding-left: 0.075rem;width: 1.1rem;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
- .already ul li .ed{padding-right: 0.48rem;}
- .already ul li .username,.already ul li .ed{font-size: 0.14rem;}
- .already ul li .day,.already ul li .time{font-size: 0.12rem;}
- .already ul li .day{padding-right:0.08rem ;}
- .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 ;}
- .cooperation img{float:left;width: 0.46rem;margin-right: 0.57rem;}
- .cooperation img:nth-child(3){margin-right: 0rem;}
- .bottom{margin: auto;color: #FB3D38;text-align: center;font-size: 0.14rem;}
- .bottom p:nth-child(1){padding-top: 0.185rem;padding-bottom: 0.205rem;font-size: 0.15rem;}
- #copy_1,#copy_2,#taokouling{position: absolute;left: -1000rem;}
- .alert-info {position: absolute;top: 1.74rem;right: 0;left: 0;bottom: 0;text-align: center;}
- .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;}
- .roll-wrap{height:1.305rem;overflow:hidden;}
- </style>
- <script type="text/javascript">
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- window.onresize = function(){
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- }
- </script>
- </head>
- <body>
- <div class="banner">
- <img src="images/banner.png"/>
- </div>
- <div class="red_packet">
- <p class="click">点我领红包</p>
- <p class="copy" onclick="collarRed()">领取红包</p>
- <p class="con">自动生成淘口令,打开手机淘宝领取红包</p>
- </div>
- <div class="already">
- <p class="num"></p>
- <div class="roll-wrap" id="roll-wrap">
- <ul>
- <!--<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>
- <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>
- <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>-->
- </ul>
- </div>
- </div>
- <div class="cooperation">
- <img src="images/jinniu.png" alt="" />
- <img src="images/taobao.png" alt="" />
- <img src="images/liedou.png" alt="" />
- </div>
- <div class="bottom">
- <p>联合送礼</p>
- <p>下载猎豆优选,大额红包拿到手软</p>
- </div>
-
-
- <input id="copy_1" type="text" readOnly="true" value=""/>
- <div id="copy_2"></div>
- <text id="taokouling">€WVXSb1pT51S€</text>
-
- <div class="alert-info" style="display: none;">
- <!-- tip提示,3s后消失 -->
- <p></p>
- </div>
- </body>
- </html>
- <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
- <script type="text/javascript">
- var user_id = 1;
- //页面加载,显示数据
- window.onload = function () {
- Lead() ;
- }
- //领红包
- function collarRed() {
- $.ajax({
- type:"post",
- url:"/api/V2/receiveRedPacket",
- data:{
- user_id:user_id
- },
- success: function (res) {
- var data =JSON.parse(res)
- console.log(data)
- if(data.code == 0){
- copyPassword();
- }else if(data.code == 4003){
- console.log("领取失败")
- }
- }
- })
- }
- //已领红包
- function Lead() {
- $.ajax({
- type:"post",
- url:"/api/V2/returnRedPacket",
- success: function (res) {
- var data =JSON.parse(res)
- // console.log(data)
- if(data.code == 0){
- var dataArr = data.res.list,html = '',numHtml = '', name = '' , img = '';
- numHtml +='已有'+ data.res.count +'位用户领取红包';
- dataArr.forEach(function (item, index) {
- if(item.user_name){
- name = item.user_name;
- }else{
- name = '匿名';
- }
- if(item.user_img){
- img = item.user_img;
- }else{
- img = 'images/moren.png'
- }
- html += '<li><img src='+ img +' /><span class="username">'+ name +'</span><span class="ed">领取了红包</span><span class="day">'+ item.received_time +'</span></li>'
- })
- $('.num').html(numHtml);
- $('.roll-wrap ul').html(html)
- }
- new scrollTxt().init();
- }
- })
- }
-
- function copyPassword() {
- var data=document.getElementById("taokouling").innerHTML;
- copy_2.innerHTML = data;
- copy_1.value = data;
- if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
- //区分iPhone设备
- window.getSelection().removeAllRanges();//这段代码必须放在前面否则无效
- var Url2=document.getElementById("copy_2");//要复制文字的节点
- var range = document.createRange();
- // 选中需要复制的节点
- range.selectNode(Url2);
- // 执行选中元素
- window.getSelection().addRange(range);
- // 执行 copy 操作
- var successful = document.execCommand('copy');
-
- // 移除选中的元素
- window.getSelection().removeAllRanges();
- }else{
- var Url2=document.getElementById("copy_1");//要复制文字的节点
- Url2.select(); // 选择对象
- document.execCommand("Copy"); // 执行浏览器复制命令
- }
- window.location.href="Invitation.html"
- }
-
-
- function scrollTxt(){
- var controls={},
- values={},
- t1=200, /*播放动画的时间*/
- t2=1500, /*播放时间间隔*/
- si;
- controls.rollWrap=$("#roll-wrap");
- controls.rollWrapUl=controls.rollWrap.children();
- controls.rollWrapLIs=controls.rollWrapUl.children();
- values.liNums=controls.rollWrapLIs.length;
- values.liHeight=controls.rollWrapLIs.eq(0).height();
- values.ulHeight=controls.rollWrap.height();
- this.init=function(){
- autoPlay();
- // pausePlay();
- }
- /*滚动*/
- function play(){
- controls.rollWrapUl.animate({"margin-top" : "-"+values.liHeight}, t1, function(){
- $(this).css("margin-top" , "0").children().eq(0).appendTo($(this));
- });
- }
- /*自动滚动*/
- function autoPlay(){
- /*如果所有li标签的高度和大于.roll-wrap的高度则滚动*/
- if(values.liHeight*values.liNums > values.ulHeight){
- si=setInterval(function(){
- play();
- },t2);
- }
- }
- /*鼠标经过ul时暂停滚动*/
- function pausePlay(){
- controls.rollWrapUl.on({
- "mouseenter":function(){
- clearInterval(si);
- }
- ,
- "mouseleave":function(){
- autoPlay();
- }
- });
- }
- }
-
-
- </script>
|