PageRenderTime 152ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 1ms

/upload/template/my/follow_run.htm

https://gitlab.com/wuhang2003/phpwind
HTML | 338 lines | 276 code | 26 blank | 36 comment | 0 complexity | d5b8331441cbdea65226bb6bb325fc51 MD5 | raw file
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <template source='TPL:common.head' load='true' />
  5. <link href="{@theme:css}/fans.css?v={@NEXT_RELEASE}" rel="stylesheet" />
  6. </head>
  7. <body>
  8. <div class="wrap">
  9. <template source='TPL:common.header' load='true' />
  10. <div class="main_wrap">
  11. <div class="bread_crumb">
  12. <a href="{@url:}" class="home" title="{@C:site.info.name}">首页</a><em>&gt;</em>
  13. <a href="{@url:my/follow/run}">我关注的人</a><!--#if($type){#--><em>&gt;</em><a href="{@url:my/follow/run?type=$type}">{$typeArr[$type]}</a><!--#}#-->
  14. </div>
  15. <div class="main cc">
  16. <div class="main_body">
  17. <div class="main_content cc">
  18. <div class="box_wrap fans_page">
  19. <template source="TPL:bbs.mine_tab" load='true' />
  20. <div class="content_type">
  21. <ul class="cc">
  22. <li class="{$classCurrent[0]}"><a href="{@url:my/follow/run}">全部</a></li>
  23. <!--# foreach ($typeArr as $key => $value) { #-->
  24. <li class="line"></li><li class="{$classCurrent[$key]}"><a href="{@url:my/follow/run?type=$key}">{$value}</a></li>
  25. <!--# } #-->
  26. </ul>
  27. </div>
  28. <!--# if ($follows) { #-->
  29. <div class="fans_list">
  30. <!--# foreach ($follows as $key => $value) {
  31. $birthday = $value['byear'] ? '生日:' . $value['byear'] . '年'.$value['bmonth'].'月'.$value['bday'].'日' : '';
  32. $profile = $value['profile'] ? ' 自我介绍:'.$value['profile'] : '';
  33. #-->
  34. <div class="fr">
  35. <div id="J_group_check_list_{$value['touid']}" data-id="{$value['touid']}" class="sort_down J_group_check_list" style="display:none;">
  36. <ul></ul>
  37. <a href="" class="add J_group_creat_show" data-id="{$value['touid']}">创建新分组</a>
  38. </div>
  39. </div>
  40. <dl class="cc J_friends_items">
  41. <dt><a href="{@url:space/index/run?uid=$value['touid']}" data-uid="{$value['touid']}" class="J_user_card_show"><img class="J_avatar" src="{@Pw::getAvatar($value['touid'], 'small')}" data-type="small" width="50" height="50" alt="{$value['username']}" /></a><a href="{@url:message/message/pop?username=$value['username']}" data-name="{$value['username']}" class="called J_send_msg_pop">打招呼</a></dt>
  42. <dd>
  43. <div class="title">
  44. <a href="{@url:space/index/run?uid=$value['touid']}" data-uid="{$value['touid']}" class="name J_user_card_show">{$value['username']}</a>
  45. <!--# $gender = $value['gender'] == 1 ? 'women' : 'man';
  46. $online = Pw::checkOnline($value['lastvisit']) ? 'ol' : 'unol';
  47. #-->
  48. <span class="{$gender}_{$online}"></span>
  49. </div>
  50. <div class="num">
  51. 关注<a href="{@url:space/follows/run?uid=$value['touid']}">{$value['follows']}</a><span>|</span>粉丝<a href="{@url:space/fans/run?uid=$value['touid']}">{$value['fans']}</a><span>|</span>帖子<a href="{@url:space/thread/run?uid=$value['touid']}">{$value['postnum']}</a>
  52. </div>
  53. <div class="action">{$birthday}</div>
  54. <div class="action">{$profile} </div>
  55. <div class="sort">
  56. <a href="" id="J_group_trigger_{$value['touid']}" class="J_group_trigger" data-id="{$value['touid']}">
  57. <!--#
  58. if ($userType[$value['touid']]) {
  59. $userTypeNames = implode(',',$userType[$value['touid']]);
  60. } else {
  61. $userTypeNames = '未分组';
  62. }
  63. #-->
  64. <span class="J_group_names" title="{$userTypeNames}"><!--# if ($userType[$value['touid']]) { #-->{@FollowController::bulidGroup($userType[$value['touid']])}<!--# } else { #-->未分组<!--# } #--></span><em class="core_arrow"></em></a>
  65. </div>
  66. <div class="attribute">
  67. <!--# if (isset($fans[$value['touid']])) { #--><span class="mnfollow" title="互相关注">互相关注</span><!--# } #-->
  68. <a href="{@url:my/follow/delete}" class="core_unfollow J_unfollow_btn J_friends_unfollow" style="display:none;" data-uid="{$value['touid']}">取消关注</a>
  69. </div>
  70. </dd>
  71. </dl>
  72. <!--# } #-->
  73. <div class=""><page tpl="TPL:common.page" page="$page" per="$perpage" count="$count" url="my/follow/run" args="$url" /></div>
  74. </div>
  75. <!--# } elseif ($recommend) { #-->
  76. <form action="{@url:my/follow/batchadd}" method="post" id="J_nofollow_form">
  77. <!--无关注人时-->
  78. <div class="nofollow_list J_check_wrap">
  79. <div class="hd">啊哦你还没有关注任何人赶紧先关注些人</div>
  80. <ul class="cc">
  81. <!--# foreach ($recommend as $value) { #-->
  82. <li><a data-uid="{$value['uid']}" class="J_user_card_show" href="{@url:space/index/run?uid=$value['uid']}"><img class="J_avatar" src="{@Pw::getAvatar($value['uid'], 'middle')}" data-type="middle" width="90" height="90" alt="{$value['username']}" /></a><label title="{$value['username']}"><input class="J_check" type="checkbox" name="uids[]" value="{$value['uid']}">{$value['username']}</label></li>
  83. <!--# } #-->
  84. </ul>
  85. <div class="ft">
  86. <button type="submit" class="btn btn_big btn_submit disabled" disabled="true" id="J_nofollow_btn"><span class="add"></span>关注</button>
  87. <label class="w"><input class="J_check_all" type="checkbox">全选</label>
  88. </div>
  89. </div>
  90. <!--无关注人时结束-->
  91. </form>
  92. <!--# } else { #-->
  93. <div class="nofollow_list J_check_wrap">
  94. <div class="hd">啊哦该分组还没有关注的人试试将关注的人添加到该分组</div>
  95. </div>
  96. <!--# } #-->
  97. </div>
  98. </div>
  99. </div>
  100. <div class="main_sidebar">
  101. <template source='TPL:common.sidebar_1' load='true' />
  102. <!--# if ($follows) { #-->
  103. <div class="box_wrap">
  104. <h2 class="box_title">我关注的人</h2>
  105. <div class="side_cate_list">
  106. <ul id="J_side_group_list" class="cc">
  107. <li>
  108. <a href="{@url:my/follow/run}" class="title"><span class="">全部</span><em>({$loginUser->info['follows']})</em></a>
  109. </li>
  110. <!--# foreach ($typeArr as $key => $value) { #-->
  111. <li id="J_side_group_{$key}">
  112. <!--# if ($key > 0) { #-->
  113. <a href="{@url:my/follow/deleteType}" class="icon_del J_group_del" data-pdata="{'id':'{$key}'}" data-id="{$key}">删除</a>
  114. <a href="{@url:my/follow/editType?id=$key}" class="icon_edit J_group_edit" data-id="{$key}" data-name="{$value}">编辑</a>
  115. <!--# } #-->
  116. <a href="{@url:my/follow/run?type=$key}" class="title"><span class="J_name">{$value}</span><em>(<!--# echo isset($typeCounts[$key]) ? $typeCounts[$key]['count'] : 0; #-->)</em></a>
  117. </li>
  118. <!--# } #-->
  119. </ul>
  120. <a href="" class="add" id="J_creat_group_side">创建新分组</a>
  121. </div>
  122. </div>
  123. <!--# } #-->
  124. </div>
  125. </div>
  126. </div>
  127. <ul style="display:none;" id="J_group_check_ul">
  128. <!--# foreach ($typeArr as $k => $v) { #-->
  129. <li><label><input class="J_group_name" type="checkbox" data-id="{$k}" data-value="{$v}">{$v}</label></li>
  130. <!--# } #-->
  131. </ul>
  132. <template source='TPL:common.footer' load='true' />
  133. </div>
  134. <script>
  135. var GRROUP_DATA = '{@FollowController::bulidUserType($userType)|json}';
  136. Wind.use('jquery', 'global', 'ajaxForm', 'dialog', function(){
  137. <!--# if ($follows) { #-->
  138. //有关注
  139. Wind.js(GV.JS_ROOT +'pages/my/fansFollow.js?v='+ GV.JS_VERSION);
  140. /*
  141. * 取消关注,删除行
  142. */
  143. var f_lock = false;
  144. $('a.J_friends_unfollow').on('click', function(e){
  145. e.preventDefault();
  146. var $this = $(this);
  147. //锁定
  148. if(f_lock) {
  149. return false;
  150. }
  151. f_lock = true;
  152. $.post(this.href, {
  153. uid: $this.data('uid')
  154. }, function(data){
  155. f_lock = false;
  156. if(data.state == 'success') {
  157. $this.parents('dl').slideUp(function(){
  158. $(this).remove();
  159. //删完了
  160. if(!$('.J_friends_items').length) {
  161. location.reload();
  162. }
  163. });
  164. }else if(data.state == 'fail'){
  165. //global.js
  166. Wind.Util.resultTip({
  167. error : true,
  168. msg : data.message,
  169. follow : $this
  170. });
  171. }
  172. }, 'json');
  173. });
  174. $('#J_group_check_ul').data({
  175. 'saveList' : function(elem, type, id){
  176. //保存分组
  177. Wind.Util.ajaxMaskShow();
  178. $.post("{@url:my/follow/savetype}", {
  179. uid : elem.data('id'),
  180. id : id,
  181. type : (type ? 1 : 0)
  182. }, function(data){
  183. Wind.Util.ajaxMaskRemove();
  184. if(data.state === 'success') {
  185. }else if(data.state === 'fail') {
  186. Wind.Util.resultTip({
  187. error : true,
  188. follow : elem,
  189. msg : data.message
  190. });
  191. }
  192. }, 'json');
  193. },
  194. 'saveCreat' : function(btn){
  195. //保存创建
  196. var creat_wrap = $('#J_group_creat_wrap');
  197. $.post("{@url:my/follow/addtype}", { name : $('#J_group_creat_input').val() }, function(data){
  198. if(data.state === 'success') {
  199. var _data = data.data;
  200. creat_wrap.remove();
  201. btn.show();
  202. //所有列表写入新创建分组
  203. var list = $('div.J_group_check_list > ul');
  204. list.append('<li><label><input type="checkbox" data-id="'+ _data.id +'" data-value="'+ _data.name +'" class="J_group_name">'+ _data.name +'</label></li>');
  205. //选中新创建的
  206. var cur_list = btn.parents('.J_group_check_list');
  207. cur_list.find('ul > li:last input:checkbox').prop('checked', true);
  208. //保存列表
  209. $('#J_group_check_ul').data('saveList')($('#J_group_trigger_'+cur_list.data('id')), 1, _data.id);
  210. var newest = cur_list.find('ul > li:last input:checkbox');
  211. newest.prop('checked', true);
  212. //checkListGroup.js
  213. setGroupNames(newest);
  214. //右侧栏写入新分组
  215. $('#J_side_group_list').append('<li id="J_side_group_'+ _data.id +'"><a class="icon_del J_group_del" data-pdata="{\'id\':\''+ _data.id +'\'}" href="{@url:my/follow/deleteType/}" data-id="'+ _data.id +'">删除</a><a data-name="'+ _data.name +'" data-id="'+ _data.id +'" class="icon_edit J_group_edit" href="{@url:my/follow/editType/)}&id='+ _data.id +'">编辑</a><a class="title" href="{@url:my/follow/run/}&type='+ _data.id +'"><span class="J_name">'+ _data.name +'</span><em>(0)</em></a></li>');
  216. }else if(data.state === 'fail'){
  217. Wind.Util.resultTip({
  218. error : true,
  219. follow : creat_wrap,
  220. msg : data.message
  221. });
  222. }
  223. }, 'json');
  224. }
  225. });
  226. $('#J_side_group_list').data({
  227. save : function(elem, url){
  228. var group_edit_input = $('#J_group_edit_input'),
  229. id = elem.data('id');
  230. $.post(url, {
  231. id : elem.data('id'),
  232. name : elem.val()
  233. }, function(data){
  234. if(data.state === 'success') {
  235. var _data = data.data,
  236. li = $('#J_side_group_'+ id);
  237. if(li.length) {
  238. //编辑
  239. li.find('.J_name').text(_data.name);
  240. li.find('.J_group_edit').data('name', _data.name);
  241. }else{
  242. //所有列表写入新创建分组
  243. var list = $('div.J_group_check_list > ul');
  244. list.append('<li><label><input type="checkbox" data-id="'+ _data.id +'" data-value="'+ _data.name +'" class="J_group_name">'+ _data.name +'</label></li>');
  245. //右侧栏写入新分组
  246. $('#J_side_group_list').append('<li id="J_side_group_'+ _data.id +'"><a class="icon_del J_group_del" data-pdata="{\'id\':\''+ _data.id +'\'}" href="{@url:my/follow/deleteType/}" data-id="'+ _data.id +'">删除</a><a data-name="'+ _data.name +'" data-id="'+ _data.id +'" class="icon_edit J_group_edit" href="{@url:my/follow/editType/)}&id='+ _data.id +'">编辑</a><a class="title" href="{@url:my/follow/run/}&type='+ _data.id +'"><span class="J_name">'+ _data.name +'</span><em>(0)</em></a></li>');
  247. }
  248. var group_edit_wrap = $('#J_group_edit_wrap');
  249. group_edit_wrap.siblings('li:hidden').show();
  250. $('#J_creat_group_side').show();
  251. group_edit_wrap.remove();
  252. }else if(data.state === 'fail'){
  253. Wind.Util.resultTip({
  254. error : true,
  255. elem : elem,
  256. follow : true,
  257. msg : data.message
  258. });
  259. }
  260. }, 'json');
  261. },
  262. creatsave : '{@url:my/follow/addtype/}',
  263. editsave : '{@url:my/follow/editType/}',
  264. deltip : '确定要删除该分组吗?<br><span class="gray">此分组下的人不会被取消关注</span>'
  265. });
  266. Wind.js(GV.JS_ROOT +'pages/common/checkListGroup.js?v='+ GV.JS_VERSION);
  267. <!--# } else { #-->
  268. /*
  269. * 无关注
  270. */
  271. var nofollow_btn = $('#J_nofollow_btn');
  272. $('input:checkbox').prop('checked', false);
  273. //复选框
  274. $('input.J_check_all').on('change', function(){
  275. if(this.checked) {
  276. nofollow_btn.prop('disabled', false).removeClass('disabled');
  277. }else{
  278. nofollow_btn.prop('disabled', true).addClass('disabled');
  279. }
  280. });
  281. var checks = $('input.J_check');
  282. checks.on('change', function(){
  283. if (checks.filter(':checked').length > 0) {
  284. nofollow_btn.prop('disabled', false).removeClass('disabled');
  285. }else{
  286. nofollow_btn.prop('disabled', true).addClass('disabled');
  287. }
  288. });
  289. $('#J_nofollow_form').ajaxForm({
  290. dataType : 'json',
  291. beforeSubmit : function(){
  292. //global.js
  293. Wind.Util.ajaxBtnDisable(nofollow_btn);
  294. },
  295. success : function(data){
  296. if(data.state == 'success') {
  297. location.reload();
  298. }else if(data.state == 'fail'){
  299. Wind.Util.ajaxBtnEnable(nofollow_btn, false);
  300. Wind.Util.resultTip({
  301. error : true,
  302. follow : nofollow_btn,
  303. msg : data.message
  304. });
  305. }
  306. }
  307. });
  308. <!--# } #-->
  309. });
  310. </script>
  311. </body>
  312. </html>