group.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. $(function(){
  2. /* group.top */
  3. // 申请加入
  4. $('a[nctype="apply"]').click(function(){
  5. if(_ISLOGIN == 0){
  6. login_dialog();
  7. }else{
  8. CUR_DIALOG = ajax_form('apply_join','申请加入','index.php?act=group&op=apply&c_id='+c_id,520,1);
  9. }
  10. });
  11. // 退出圈子
  12. $('a[nctype="quitGroup"]').click(function(){
  13. showDialog('确定要退出圈子吗?', 'confirm', '', function(){
  14. var _uri = CIRCLE_SITE_URL+"/index.php?act=group&op=quit&c_id="+c_id;
  15. ajaxget(_uri);
  16. });
  17. });
  18. //横高局中比例缩放隐藏显示图片
  19. $(window).load(function () {
  20. $(".theme-intro-pic .t-img").VMiddleImg({"width":90,"height":60});
  21. });
  22. // 展开收起
  23. $('a[nctype="theme_read"],span[nctype="theme_read"]').click(function(){
  24. var $pli = $(this).parents('li:first');
  25. var $this = $pli.find('a[nctype="theme_read"]');
  26. if(!$this.hasClass('t')){
  27. $this.addClass('t');
  28. var $id = $this.attr('data-param');
  29. var $content = $pli.find('.theme-detail-content');
  30. var $reply = $pli.find('.quick-reply-2');
  31. var $reply_box = $pli.find('.quick-reply-box');
  32. $.getJSON(CIRCLE_SITE_URL+'/index.php?act=theme&op=ajax_themeinfo&c_id='+c_id+'&t_id='+$id, function(data){
  33. // 内容部分
  34. $content.append(data.theme_content);
  35. // 商品部分
  36. if(data.goods_list != ''){
  37. var ul = $('<ul></ul>');
  38. $.each(data.goods_list, function(e, d){
  39. $('<li></li>').append('<div class="goods-pic thumb"><a href="javascript:void(0);"><img class="t-img" src="'+d.image+'" /></a></div>')
  40. .append('<div class="goods-name">'+d.goods_name+'</div>')
  41. .append('<div class="goods-price"><em>'+d.goods_price+'</em></div>')
  42. .append('<a class="goto" target="_blank" href="'+d.thg_url+'">商品详情</a>')
  43. .appendTo(ul);
  44. });
  45. $('<div class="theme-content-goods"><h4><i></i>相关商品</h4></div>').append(ul).appendTo($content);
  46. }
  47. // 附件部分
  48. if(data.affix_list != ''){
  49. var div = $('<div class="file-hidden" style="display: none;"></div>');
  50. var ul = $('<ul></ul>');
  51. $.each(data.affix_list, function(e, d){
  52. $('<li></li>').append('<a href="javascript:void(0);"><img src="'+d.affix_filethumb+'" /></a>')
  53. .appendTo(ul);
  54. });
  55. $('<i class="arrow"></i>').appendTo(div);
  56. ul.appendTo(div);
  57. div = $('<div class="theme-content-file clearfix"><h4 class="file-hidden-btn"><i></i>相关附件</h4></div>').append(div);
  58. div.find('.file-hidden-btn').click(function(){
  59. div.find(".file-hidden").slideToggle(100);
  60. });
  61. div.appendTo($content);
  62. }
  63. // 最后编辑时间
  64. if(data.theme_edittime != null){
  65. $('<div class="theme-edittime"><span>'+data.theme_editname+'&nbsp;于&nbsp;'+data.theme_edittime+'&nbsp;最后编辑</span></div>').appendTo($content);
  66. }
  67. var normal = $('<div class="normal"></div>');
  68. if(data.theme_nolike){ // 赞
  69. var _$like = $('<a href="javascript:void(0);">赞(<em nctype="like">'+data.theme_likecount+'</em>)</a>');
  70. _$like.click(function(){
  71. if(_ISLOGIN){
  72. likeYes($(this), {t_id:$id,c_id:c_id});
  73. }else{
  74. login_dialog();
  75. }
  76. });
  77. _$like.appendTo(normal)
  78. }else{ // 取消赞
  79. var _$unlike = $('<a href="javascript:void(0);">取消赞(<em nctype="like">'+data.theme_likecount+'</em>)</a>');
  80. _$unlike.click(function(){
  81. if(_ISLOGIN){
  82. likeNo($(this), {t_id:$id,c_id:c_id});
  83. }else{
  84. login_dialog();
  85. }
  86. });
  87. _$unlike.appendTo(normal);
  88. }
  89. // 回复
  90. var _$reply = $('<a href="javascript:void(0);" nctype="reply">回复('+data.theme_commentcount+')</a>');
  91. _$reply.quick_reply({
  92. reply : $reply,
  93. reply_box : $reply_box,
  94. id : $id,
  95. c_id : c_id,
  96. identity : identity
  97. })
  98. _$reply.appendTo(normal);
  99. $('<a href="javascript:void(0);">收起主题</a>').click(function(){
  100. fold($this);
  101. }).appendTo(normal);
  102. var bar = $('<div class="handle-bar"></div>');
  103. normal.appendTo(bar);
  104. bar.appendTo($content);
  105. unfold($this);
  106. });
  107. }else{
  108. unfold($this);
  109. }
  110. });
  111. /* theme.detail */
  112. // 赞
  113. $('a[nctype="themeLikeYes"]').click(function(){
  114. if(_ISLOGIN){
  115. likeYes($(this), {t_id:t_id,c_id:c_id});
  116. }else{
  117. login_dialog();
  118. }
  119. });
  120. // 取消赞
  121. $('a[nctype="themeLikeNo"]').click(function(){
  122. likeNo($(this), {t_id:t_id,c_id:c_id});
  123. });
  124. // 加精
  125. $('a[nctype="themeDigestYes"]').click(function(){
  126. digestYes($(this));
  127. });
  128. // 取消加精
  129. $('a[nctype="themeDigestNo"]').click(function(){
  130. digestNo($(this));
  131. });
  132. // 置顶
  133. $('a[nctype="themeTopYes"]').click(function(){
  134. topYes($(this));
  135. });
  136. // 取消置顶
  137. $('a[nctype="themeTopNo"]').click(function(){
  138. topNo($(this));
  139. });
  140. // 关闭
  141. $('a[nctype="themeShutYes"]').click(function(){
  142. shutYes($(this));
  143. });
  144. // 开启
  145. $('a[nctype="themeShutNo"]').click(function(){
  146. shutNo($(this));
  147. });
  148. // 禁言
  149. $('a[nctype="themeCloseYes"]').click(function(){
  150. var m_id = $(this).attr('data-param');
  151. var _uri = CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax_nospeak&value=0&c_id='+c_id+'&m_id='+m_id;
  152. ajaxget(_uri);
  153. });
  154. // 解除禁言
  155. $('a[nctype="themeCloseNo"]').click(function(){
  156. var m_id = $(this).attr('data-param');
  157. var _uri = CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax_nospeak&value=1&c_id='+c_id+'&m_id='+m_id;
  158. ajaxget(_uri);
  159. });
  160. // 管理删除主题
  161. $('a[nctype="themeDelManage"]').click(function(){
  162. showDialog('确定要删除主题吗?', 'confirm', '', function(){
  163. var _uri = CIRCLE_SITE_URL+"/index.php?act=manage&op=del_theme&c_id="+c_id+"&t_id="+t_id;
  164. ajaxget(_uri);
  165. });
  166. });
  167. // 管理删除回复
  168. $('a[nctype="replyDelManage"]').click(function(){
  169. var $this = $(this);
  170. showDialog('确定要删除回复吗?', 'confirm', '', function(){
  171. var r_id = $this.attr('data-param');
  172. var _uri = CIRCLE_SITE_URL+'/index.php?act=manage&op=del_reply&c_id='+c_id+'&t_id='+t_id+'&r_id='+r_id;
  173. ajaxget(_uri);
  174. });
  175. });
  176. //管理菜单 隐藏/显示
  177. $(".manage-button").click(function(){
  178. $(this).next().slideToggle(300);
  179. });
  180. // Applied to be an administrator
  181. $('a[nctype="manageApply"]').click(function(){
  182. var _uri = CIRCLE_SITE_URL+'/index.php?act=group&op=manage_apply&c_id='+c_id;
  183. CUR_DIALOG = ajax_form('manage_apply', '申请管理', _uri, 520, 1);
  184. });
  185. });
  186. // 主题展开
  187. function unfold(o){
  188. o.removeClass('read-unfold').addClass('read-fold').html('<i></i>收起主题');
  189. o.parents('li:first').find('.theme-intro').hide()
  190. .end().find('.theme-lastspeak-name').hide()
  191. .end().find('.theme-lastspeak-time').hide()
  192. .end().find('.theme-noreply').hide()
  193. .end().find('.theme-detail-content').show();
  194. o.unbind().click(function(){
  195. fold(o);
  196. });
  197. }
  198. // 主题折叠
  199. function fold(o){
  200. o.removeClass('read-fold').addClass('read-unfold').html('<i></i>展开主题');
  201. o.parents('li:first').find('.theme-detail-content').hide()
  202. .end().find('.quick-reply-box').hide()
  203. .end().find('.theme-intro').show()
  204. .end().find('.theme-lastspeak-name').show()
  205. .end().find('.theme-lastspeak-time').show()
  206. .end().find('.theme-noreply').show();
  207. o.unbind().click(function(){
  208. unfold(o);
  209. });
  210. }
  211. // 加精
  212. function digestYes(o){
  213. $.getJSON(CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax&column=digest&value=1&c_id='+c_id+'&id='+t_id, function(data){
  214. if(data){
  215. o.html('取消精华');
  216. $('.theme-title > i').removeClass().addClass('digest');
  217. o.unbind().click(function(){
  218. digestNo(o);
  219. });
  220. }
  221. });
  222. }
  223. // 取消加精
  224. function digestNo(o){
  225. $.getJSON(CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax&column=digest&value=0&c_id='+c_id+'&id='+t_id, function(data){
  226. if(data){
  227. o.html('精华');
  228. $('.theme-title > i').removeClass().addClass('normal');
  229. o.unbind().click(function(){
  230. digestYes(o);
  231. });
  232. }
  233. });
  234. }
  235. // 置顶
  236. function topYes(o){
  237. $.getJSON(CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax&column=top&value=1&c_id='+c_id+'&id='+t_id, function(data){
  238. if(data){
  239. o.html('取消置顶');
  240. $('.theme-title > i').removeClass().addClass('top');
  241. o.unbind().click(function(){
  242. topNo(o);
  243. });
  244. }
  245. });
  246. }
  247. // 取消置顶
  248. function topNo(o){
  249. $.getJSON(CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax&column=top&value=0&c_id='+c_id+'&id='+t_id, function(data){
  250. if(data){
  251. o.html('置顶');
  252. $('.theme-title > i').removeClass().addClass('normal');
  253. o.unbind().click(function(){
  254. topYes(o);
  255. });
  256. }
  257. });
  258. }
  259. // 关闭
  260. function shutYes(o){
  261. $.getJSON(CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax&column=shut&value=1&c_id='+c_id+'&id='+t_id, function(data){
  262. if(data){
  263. o.html('开启');
  264. $('.theme-title > i').removeClass().addClass('close');
  265. o.unbind().click(function(){
  266. shutNo(o);
  267. });
  268. $('.quick-reply').prepend('<div class="ban">本话题已经关闭</div>');
  269. }
  270. });
  271. }
  272. // 开启
  273. function shutNo(o){
  274. $.getJSON(CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax&column=shut&value=0&c_id='+c_id+'&id='+t_id, function(data){
  275. if(data){
  276. o.html('关闭');
  277. $('.theme-title > i').removeClass().addClass('normal');
  278. o.unbind().click(function(){
  279. shutYes(o);
  280. });
  281. $('.quick-reply').find('.ban:first').remove();
  282. }
  283. });
  284. }
  285. // 禁言
  286. function speakNo(m_id){
  287. _uri = CIRCLE_SITE_URL+'/index.php?act=manage&op=ajax_nospeak&value=0&c_id='+c_id+'&m_id='+m_id;
  288. ajaxget(_uri);
  289. }
  290. // 删除回复