runoob 6 anos atrás
pai
commit
fb37967ef1
3 arquivos alterados com 136 adições e 32 exclusões
  1. 21 2
      share/Invitation.html
  2. BIN
      share/images/moren.png
  3. 115 30
      share/index.html

+ 21 - 2
share/Invitation.html

@@ -102,7 +102,7 @@
102 102
 		<p class="tit">获取更多大额红包,下载猎豆优选</p>
103 103
 		<div class="leidou">
104 104
 			<img src="images/liedou.png" class="liedouImg"/>
105
-			<p class="introduce"><img src="images/logo.png" alt="" /><span>购物先领券,下单赚佣</span></p>
105
+			<p class="introduce"><img src="images/logo.png" alt="" /><span>购物先领券,下单赚佣</span></p>
106 106
 			<a class="down" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.kuxuan.coupon_liedou">下载APP</a>
107 107
 		</div>
108 108
 	</div>
@@ -127,7 +127,6 @@
127 127
 </html>
128 128
 <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
129 129
 <script type="text/javascript">
130
-	
131 130
 	var userId = null;
132 131
 	var activity_id = null;
133 132
 	var share_code = null;
@@ -184,9 +183,29 @@
184 183
 	
185 184
 	$("#share").click(function () {
186 185
 		$(".shareMask").css('display','block')
186
+		share();
187 187
 	})
188 188
 	$(".cancel").click(function () {
189 189
 		$(".shareMask").css('display','none')
190 190
 	})
191
+	
192
+	window.onload = function () {
193
+		
194
+	}
195
+	//分享
196
+	function share() {
197
+		$.ajax({
198
+			type:"post",
199
+			url:"/api/V2/share",
200
+			data:{
201
+				type:1,
202
+				count:0
203
+			},
204
+			success: function (res) {
205
+				var data =JSON.parse(res)
206
+//				console.log(data)
207
+			}
208
+		})
209
+	}
191 210
 
192 211
 </script>

BIN
share/images/moren.png


+ 115 - 30
share/index.html

@@ -18,8 +18,8 @@
18 18
 		.already .num{font-size:0.15rem;color:#FB3D38;padding-bottom: 0.175rem;}
19 19
 		.already ul{height: 1.305rem;overflow-y: scroll;}
20 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;}
22
-		.already ul li .username{padding-left: 0.075rem;padding-right: 0.55rem;	}
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 23
 		.already ul li .ed{padding-right: 0.48rem;}
24 24
 		.already ul li .username,.already ul li .ed{font-size: 0.14rem;}
25 25
 		.already ul li .day,.already ul li .time{font-size: 0.12rem;}
@@ -30,24 +30,9 @@
30 30
 		.bottom{margin: auto;color: #FB3D38;text-align: center;font-size: 0.14rem;}
31 31
 		.bottom p:nth-child(1){padding-top: 0.185rem;padding-bottom: 0.205rem;font-size: 0.15rem;} 
32 32
 		#copy_1,#copy_2,#taokouling{position: absolute;left: -1000rem;}
33
-			.alert-info {
34
-			    position: absolute;
35
-			    top: 1.74rem;
36
-			    right: 0;
37
-			    left: 0;
38
-			    bottom: 0;
39
-			    text-align: center;
40
-			}
41
-			.alert-info p {
42
-			    display: inline-block;
43
-			    /*height: 0.38rem;*/
44
-			    color: #fff;
45
-			    font-size: 0.14rem;
46
-			    line-height: 0.38rem;
47
-			    padding: 0 0.10rem;
48
-			    background-color: rgba(0, 0, 0, 0.7);
49
-			    border-radius: 5px;
50
-			}
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;}
51 36
 	</style>
52 37
 	<script type="text/javascript">
53 38
 		document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
@@ -62,20 +47,18 @@
62 47
 	</div>
63 48
 	<div class="red_packet">
64 49
 		<p class="click">点我领红包</p>
65
-		<p class="copy" onclick="copyPassword()">领取红包</p>
50
+		<p class="copy" onclick="collarRed()">领取红包</p>
66 51
 		<p class="con">自动生成淘口令,打开手机淘宝领取红包</p>
67 52
 	</div>
68 53
 	<div class="already">
69
-		<p class="num">已有999位用户领取红包</p>
54
+		<p class="num"></p>
55
+		<div class="roll-wrap" id="roll-wrap">
70 56
 		<ul>
71
-			<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>
72
-			<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>
73
-			<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>
74
-			<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>
75
-			<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>
76
-			<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>
77
-			<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>
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>-->
78 60
 		</ul>
61
+		</div>
79 62
 	</div>
80 63
 	<div class="cooperation">
81 64
 		<img src="images/jinniu.png" alt="" />
@@ -100,7 +83,61 @@
100 83
 </html>
101 84
 <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
102 85
 <script type="text/javascript">
103
-	
86
+	var user_id = 1;
87
+		//页面加载,显示数据
88
+	window.onload = function () {
89
+		Lead() ;
90
+	}
91
+	//领红包
92
+	function collarRed() {
93
+		$.ajax({
94
+			type:"post",
95
+			url:"/api/V2/receiveRedPacket",
96
+			data:{
97
+				user_id:user_id
98
+			},
99
+			success: function (res) {
100
+				var data =JSON.parse(res)
101
+				console.log(data)
102
+				if(data.code == 0){
103
+					copyPassword();
104
+				}else if(data.code == 4003){
105
+					console.log("领取失败")
106
+				}
107
+			}
108
+		})
109
+	}
110
+	//已领红包
111
+	function Lead() {
112
+		$.ajax({
113
+			type:"post",
114
+			url:"/api/V2/returnRedPacket",
115
+			success: function (res) {
116
+				var data =JSON.parse(res)
117
+//				console.log(data)
118
+				if(data.code == 0){
119
+					var dataArr = data.res.list,html = '',numHtml = '', name = '' , img = '';
120
+					numHtml +='已有'+ data.res.count +'位用户领取红包';
121
+					dataArr.forEach(function (item, index) {
122
+						if(item.user_name){
123
+							name = item.user_name;
124
+						}else{
125
+							name = '匿名';
126
+						}
127
+						if(item.user_img){
128
+							img = item.user_img;
129
+						}else{
130
+							img = 'images/moren.png'
131
+						}
132
+						html += '<li><img src='+ img +' /><span class="username">'+ name +'</span><span class="ed">领取了红包</span><span class="day">'+ item.received_time +'</span></li>'
133
+					})
134
+					$('.num').html(numHtml);
135
+					$('.roll-wrap ul').html(html)
136
+				}
137
+				new scrollTxt().init();
138
+			}
139
+		})
140
+	}
104 141
 	
105 142
 	function copyPassword() {
106 143
 		var data=document.getElementById("taokouling").innerHTML;
@@ -127,4 +164,52 @@
127 164
 	    }
128 165
 	    window.location.href="Invitation.html"
129 166
 	}
167
+	
168
+	
169
+	function scrollTxt(){
170
+	    var controls={},
171
+	        values={},
172
+	        t1=200, /*播放动画的时间*/
173
+	        t2=1500, /*播放时间间隔*/
174
+	        si;
175
+	    controls.rollWrap=$("#roll-wrap");
176
+	    controls.rollWrapUl=controls.rollWrap.children();
177
+	    controls.rollWrapLIs=controls.rollWrapUl.children();
178
+	    values.liNums=controls.rollWrapLIs.length;
179
+	    values.liHeight=controls.rollWrapLIs.eq(0).height();
180
+	    values.ulHeight=controls.rollWrap.height();
181
+	    this.init=function(){
182
+	        autoPlay();
183
+	        // pausePlay();
184
+	    }
185
+	    /*滚动*/
186
+	    function play(){
187
+	        controls.rollWrapUl.animate({"margin-top" : "-"+values.liHeight}, t1, function(){
188
+	            $(this).css("margin-top" , "0").children().eq(0).appendTo($(this));
189
+	        });
190
+	    }
191
+	    /*自动滚动*/
192
+	    function autoPlay(){
193
+	        /*如果所有li标签的高度和大于.roll-wrap的高度则滚动*/
194
+	        if(values.liHeight*values.liNums > values.ulHeight){
195
+	            si=setInterval(function(){
196
+	                play();
197
+	            },t2);
198
+	        }
199
+	    }
200
+	    /*鼠标经过ul时暂停滚动*/
201
+	    function pausePlay(){
202
+	        controls.rollWrapUl.on({
203
+	            "mouseenter":function(){
204
+	                clearInterval(si);
205
+	            }
206
+	            ,
207
+	            "mouseleave":function(){
208
+	                autoPlay();
209
+	            }
210
+	        });
211
+	    }
212
+	}
213
+	
214
+	
130 215
 </script>