正在显示
1 个修改的文件
包含
20 行增加
和
4 行删除
@@ -3,20 +3,32 @@ $(function(){ | @@ -3,20 +3,32 @@ $(function(){ | ||
3 | // 点赞 | 3 | // 点赞 |
4 | $('.likes').click(function() { | 4 | $('.likes').click(function() { |
5 | if ($(this).children('img').attr('src') == host+'/themes/simpleboot3/public/assets/starImg/bicon_02.png') { | 5 | if ($(this).children('img').attr('src') == host+'/themes/simpleboot3/public/assets/starImg/bicon_02.png') { |
6 | - operation('/portal/star/like'); | 6 | + var login = operation('/portal/star/like'); |
7 | + if(login == 0){ | ||
8 | + return false; | ||
9 | + } | ||
7 | $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_15.png'); | 10 | $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_15.png'); |
8 | } else { | 11 | } else { |
9 | - operation('/portal/star/cancelLike'); | 12 | + var login = operation('/portal/star/cancelLike'); |
13 | + if(login == 0){ | ||
14 | + return false; | ||
15 | + } | ||
10 | $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_02.png'); | 16 | $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_02.png'); |
11 | } | 17 | } |
12 | }); | 18 | }); |
13 | //收藏 | 19 | //收藏 |
14 | $('.collections').click(function() { | 20 | $('.collections').click(function() { |
15 | if ($(this).children('img').attr('src') == host+'/themes/simpleboot3/public/assets/starImg/bicon_03.png') { | 21 | if ($(this).children('img').attr('src') == host+'/themes/simpleboot3/public/assets/starImg/bicon_03.png') { |
16 | - operation('/portal/star/collection'); | 22 | + var login = operation('/portal/star/collection'); |
23 | + if(login == 0){ | ||
24 | + return false; | ||
25 | + } | ||
17 | $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_16.png'); | 26 | $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_16.png'); |
18 | } else { | 27 | } else { |
19 | - operation('/portal/star/cancelCollection'); | 28 | + var login = operation('/portal/star/cancelCollection'); |
29 | + if(login == 0){ | ||
30 | + return false; | ||
31 | + } | ||
20 | $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_03.png'); | 32 | $(this).children('img').attr('src', host+'/themes/simpleboot3/public/assets/starImg/bicon_03.png'); |
21 | } | 33 | } |
22 | }); | 34 | }); |
@@ -120,6 +132,7 @@ $(function(){ | @@ -120,6 +132,7 @@ $(function(){ | ||
120 | //点赞收藏 | 132 | //点赞收藏 |
121 | function operation(url){ | 133 | function operation(url){ |
122 | var article_id = getUrlParam('id'); | 134 | var article_id = getUrlParam('id'); |
135 | + var is_login = 1; | ||
123 | $.ajax({ | 136 | $.ajax({ |
124 | type: 'POST', | 137 | type: 'POST', |
125 | url: url, | 138 | url: url, |
@@ -127,14 +140,17 @@ function operation(url){ | @@ -127,14 +140,17 @@ function operation(url){ | ||
127 | 'article_id':article_id, | 140 | 'article_id':article_id, |
128 | }, | 141 | }, |
129 | dataType: 'json', | 142 | dataType: 'json', |
143 | + async : false, | ||
130 | success: function (data) { | 144 | success: function (data) { |
131 | if (data.code == 1) { | 145 | if (data.code == 1) { |
132 | mask(data.msg); | 146 | mask(data.msg); |
133 | } else { | 147 | } else { |
134 | mask(data.msg); | 148 | mask(data.msg); |
149 | + is_login = data.code; | ||
135 | } | 150 | } |
136 | } | 151 | } |
137 | }); | 152 | }); |
153 | + return is_login; | ||
138 | } | 154 | } |
139 | //弹框 | 155 | //弹框 |
140 | function mask(msg) { | 156 | function mask(msg) { |
-
请 注册 或 登录 后发表评论