Browse Source

获取用户授权

xiuli.gao 6 years ago
parent
commit
93c611b50a
2 changed files with 17 additions and 18 deletions
  1. 4 3
      share/js/index.js
  2. 13 15
      share/js/invitation.js

+ 4 - 3
share/js/index.js

@@ -17,9 +17,10 @@ function Lead() {
17 17
 	$.ajax({
18 18
 		type:"post",
19 19
 		url:"/api/V2/returnRedPacket",
20
+		dataType:'json',
20 21
 		success: function (res) {
21
-			var data =JSON.parse(res)
22
-//				console.log(data)
22
+			var data =res;
23
+				console.log(data)
23 24
 			if(data.code == 0){
24 25
 				var dataArr = data.res.list,html = '',numHtml = '', name = '' , img = '';
25 26
 				numHtml +='已有'+ data.res.count +'位用户领取红包';
@@ -34,7 +35,7 @@ function Lead() {
34 35
 					}else{
35 36
 						img = 'images/moren.png'
36 37
 					}
37
-					html += '<li><img src='+ img +' /><span class="username">'+ name +'</span><span class="ed">领取了红包</span><span class="day">'+ item.received_time +'</span></li>'
38
+					html += '<li><img src='+ img +' /><span class="username">'+ name +'</span><span class="ed">领取了红包</span><span class="day">'+ item.shared_time +'</span></li>'
38 39
 				})
39 40
 				$('.num').html(numHtml);
40 41
 				$('.roll-wrap ul').html(html)

+ 13 - 15
share/js/invitation.js

@@ -51,12 +51,11 @@ $(".shareHongbao").click(function () {
51 51
 		if(navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == "micromessenger"){
52 52
 			//微信
53 53
 			$(".shareWechat").css('display','block')
54
-			shareFriend ();
54
+			shareRedPacket ();
55 55
 		}else{
56 56
 			//app端
57 57
 			$(".shareMask").css('display','block')
58 58
 		}
59
-	collarRed();
60 59
 	share();
61 60
 })
62 61
 //带你几取消分享
@@ -76,8 +75,9 @@ function share() {
76 75
 			type:1,
77 76
 			count: num
78 77
 		},
78
+		dataType:'json',
79 79
 		success: function (res) {
80
-			var data =JSON.parse(res)
80
+			var data =res;
81 81
 			num = data.res.count;
82 82
 		}
83 83
 	})
@@ -145,20 +145,18 @@ function showMsg(msg) {
145 145
     }, 3000);
146 146
 }
147 147
 
148
-$('.shareCopy').click(function () {
149
-	copyPassword()
150
-})
151
-
152
-//记录用户  领红包
153
-function collarRed() {
148
+//分享用户授权
149
+function shareRedPacket () {
154 150
 	$.ajax({
155 151
 		type:"post",
156
-		url:"/api/V2/receiveRedPacket",
152
+		url:"/api/V2/shareRedPacket",
157 153
 		dataType:"json",
158
-		data:{
159
-			user_id:userId
160
-		},
161
-		success: function (res) {
154
+		success: function () {
155
+			shareFriend ();
162 156
 		}
163 157
 	})
164
-}
158
+}
159
+
160
+$('.shareCopy').click(function () {
161
+	copyPassword()
162
+})