bd2a342b6b1dbe6dae2a078de0022edd48e48971.svn-base 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. var userId=$.urlParam("userId");
  2. var cname=$.urlParam("cName");
  3. var userType=$.urlParam("userType");
  4. var articleCategoryIds="";
  5. var pageIndex=0;
  6. var pageSize = 10;
  7. var articleCategoryId;
  8. var CON_ARTICLE="ALL";
  9. $(function(){
  10. myLayer.load("加载中,请稍后");
  11. initUserSubscribe();//加载导航菜单信息
  12. // 底部菜单栏
  13. $('.index-bot').on('click','div',function(){
  14. var names = $(this).data('name'),
  15. sibname = $(this).siblings().data('name');
  16. $(this).addClass('curr').siblings().removeClass('curr');
  17. $('.'+names).removeClass('c-hide');
  18. $('.'+sibname).addClass('c-hide');
  19. myLayer.load("加载中,请稍后");
  20. if(names == 'dingyue' ){
  21. initUserSubscribe();//加载导航菜单信息
  22. }else if(names == 'shoucang'){
  23. initUserScSubscribe();//加载收藏导航菜单信息
  24. }
  25. });
  26. // 收藏按钮
  27. $('.shoucang-box').off().on('click',function(e){
  28. e.stopPropagation();
  29. var ck = $(this).hasClass('active'),
  30. con = '<i class="iconfont icon-shoucang c-f22 c-fff ml15 mr5 c-vam"></i>';
  31. if(ck) {
  32. $(this).removeClass('active');
  33. myLayer.alert(con + '<span class="c-f15 c-vam mr15">取消收藏</span>','2000');
  34. }else {
  35. $(this).addClass('active');
  36. myLayer.alert(con + '<span class="c-f15 c-vam mr15">收藏成功</span>','2000');
  37. }
  38. });
  39. })
  40. /*****************************************订阅开始************************************************************/
  41. function initUserSubscribe(){//查询订阅一级类别
  42. var url= jkzl.common.path+"/subscribe/querySubscribeByUserId";
  43. var param = {};
  44. param.userId=userId;
  45. sendPost(url,param, "json", "post", initUserSubscribeFailed, initUserSubscribeSuccess);
  46. }
  47. function initUserSubscribeFailed(res) {//失败处理
  48. myLayer.clear();
  49. if (res && res.Message) {
  50. myLayer.alert(res.Message);
  51. return;
  52. } else {
  53. myLayer.alert("请求失败,请重新刷新页面");
  54. return;
  55. }
  56. }
  57. function initUserSubscribeSuccess(res) {//成功处理
  58. articleCategoryIds="";
  59. if (res.Code == 10000) {
  60. if(res.Result.result){
  61. var result=res.Result.result;
  62. $("#artcle_dy_index").html('');
  63. articleCategoryIds="";
  64. var htmlstr ="<li id='article_all' class='curr' onClick='javascript:queryIndexAricle(\""+CON_ARTICLE+"\")' >全部</li>";
  65. for(var i=0;i<result.length;i++){
  66. articleCategoryIds +=result[i].categoryid+",";
  67. htmlstr +="<li id="+result[i].categoryid+" onClick='javascript:queryIndexAricle("+result[i].categoryid+")'>"+result[i].categoryname+"</li>";
  68. }
  69. $("#artcle_dy_index").append(htmlstr);
  70. articleCategoryIds=articleCategoryIds.substring(0,articleCategoryIds.length-1);
  71. initUserArticle(articleCategoryIds,0); //加载文章列表
  72. }
  73. myLayer.clear();
  74. } else {
  75. initUserSubscribeFailed(res);
  76. }
  77. }
  78. function queryIndexAricle(index){//订阅大类查询不同文章
  79. if(index == CON_ARTICLE){
  80. $("#article_all").addClass('curr').siblings().removeClass('curr');
  81. var _this =$("#article_all"),
  82. wWidth = _this.parent().width(),
  83. sLeft = _this.parent().scrollLeft(),
  84. tLeft = _this.position().left;
  85. if(tLeft > wWidth/2) {
  86. $(".index-lab ul").animate({
  87. 'scrollLeft': sLeft + _this.innerWidth() + 20
  88. }, 300);
  89. }else {
  90. $(".index-lab ul").animate({
  91. 'scrollLeft': sLeft - _this.innerWidth() - 20
  92. }, 300);
  93. }
  94. initUserArticle(articleCategoryIds,0);
  95. }else{
  96. $("#"+index).addClass('curr').siblings().removeClass('curr');
  97. var _this = $("#"+index),
  98. wWidth = _this.parent().width(),
  99. sLeft = _this.parent().scrollLeft(),
  100. tLeft = _this.position().left;
  101. if(tLeft > wWidth/2) {
  102. $(".index-lab ul").animate({
  103. 'scrollLeft': sLeft + _this.innerWidth() + 20
  104. }, 300);
  105. }else {
  106. $(".index-lab ul").animate({
  107. 'scrollLeft': sLeft - _this.innerWidth() - 20
  108. }, 300);
  109. }
  110. initUserArticle(index,0);
  111. }
  112. }
  113. function initUserArticle(AcId,index){//订阅文章列表
  114. pageIndex=index;
  115. articleCategoryId=AcId;
  116. var url= jkzl.common.path+"/article/queryArticleList";
  117. var param = {};
  118. param.pageIndex=index;
  119. param.pageSize=pageSize;
  120. param.articleCategoryId=AcId;
  121. sendPost(url,param, "json", "post", initUserArticleFailed, initUserArticleSuccess);
  122. }
  123. function initUserArticleFailed(res) {//失败处理
  124. myLayer.clear();
  125. if (res && res.Message) {
  126. $("#artcle_dy_content").html('');
  127. var htmlstr =" <div id='gxqwz' class='norecord nodata'> <i class='icon-nopast'></i>";
  128. htmlstr +="<p>看看其他感兴趣的文章吧</p></div>";
  129. $("#artcle_dy_content").append(htmlstr);
  130. myLayer.alert(res.Message);
  131. return;
  132. } else {
  133. $("#artcle_dy_content").html('');
  134. var htmlstr =" <div id='gxqwz' class='norecord nodata'> <i class='icon-nopast'></i>";
  135. htmlstr +="<p>看看其他感兴趣的文章吧</p></div>";
  136. $("#artcle_dy_content").append(htmlstr);
  137. myLayer.alert("请求失败,请重新刷新页面");
  138. return;
  139. }
  140. }
  141. function initUserArticleSuccess(res) {//成功处理
  142. if (res.Code == 10000) {
  143. var checked= $("#artcle_dy_content").find('div').hasClass("ckgd");
  144. if(checked){
  145. $("#articlepage").remove();
  146. }
  147. var total = res.Count;
  148. if(total==0 || res.Result.length==0){//没有数据情况
  149. $("#artcle_dy_content").html('');
  150. var htmlstr =" <div id='gxqwz' class='norecord nodata'> <i class='icon-nopast'></i>";
  151. htmlstr +="<p>看看其他感兴趣的文章吧</p></div>";
  152. $("#artcle_dy_content").append(htmlstr);
  153. myLayer.clear();
  154. return;
  155. }
  156. if(res.Result && total>0){
  157. if(pageIndex == 0){
  158. $("#artcle_dy_content").html('');
  159. }else{
  160. var nochecked= $("#artcle_dy_content").find('div').hasClass("nodata");
  161. if(nochecked){
  162. $("#gxqwz").remove();
  163. }
  164. }
  165. var result=res.Result;
  166. var htmlstr ="<ul class='index-list'>";
  167. for(var i=0;i<result.length;i++){
  168. htmlstr +="<li><a href='javascript:queryArticleDetail(\""+result[i].articleId+"\")' class='list-a'>";
  169. htmlstr +=" <div class='ilist-con'><h4 class='c-nowrap-multi'>";
  170. if(result[i].articleType == 1){
  171. htmlstr +="<i class='ilstate st-blue'><i>视频</i></i>"+result[i].articleTitle+"</h4>";
  172. }
  173. if(result[i].articleType == 2){
  174. htmlstr +="<i class='ilstate st-org'><i>图文</i></i>"+result[i].articleTitle+"</h4>";
  175. }
  176. if(result[i].articleType == 3){
  177. htmlstr +="<i class='ilstate st-radio'><i>音频</i></i>"+result[i].articleTitle+"</h4>";
  178. }
  179. if(result[i].articleType == 4){
  180. htmlstr +="<i class='ilstate st-qa'><i>问答</i></i>"+result[i].articleTitle+"</h4>";
  181. }
  182. htmlstr +="<ul class='clearfix'>";
  183. htmlstr +="<li class='fl width-33'><i class='iconfont icon-xianshikejian c-f16'></i><em>"+result[i].browseNumbere+"</em></li>";
  184. htmlstr +="<li class='fl width-33'><i class='iconfont icon-zan1 c-f10'></i><em>"+result[i].pointNumber+"</em></li>";
  185. htmlstr +="<li class='fl width-33'><i class='iconfont icon-bianji c-f12'></i><em>"+result[i].commentNumber+"</em></li>";
  186. htmlstr +="</ul></div><div class='ilist-img'><img src="+result[i].articleCover+" alt='' /></div></a></li>";
  187. }
  188. if((pageIndex+1) * pageSize < total){
  189. htmlstr +="</ul><div id='articlepage' class='c-t-center ptb10 ckgd'><a href='javascript:queryArticlePage()' class='c-f12 c-aaa'>查看更多</a> </div>";
  190. }else{
  191. htmlstr +="</ul><div id='articlepage' class='c-t-center ptb10 ckgd'><a class='c-f12 c-aaa'>没有更多了</a> </div>";
  192. }
  193. $("#artcle_dy_content").append(htmlstr);
  194. }
  195. myLayer.clear();
  196. } else {
  197. initUserArticleFailed(res);
  198. }
  199. }
  200. function queryArticlePage(){//文章分页
  201. pageIndex++;
  202. initUserArticle(articleCategoryId,pageIndex);
  203. }
  204. function queryArticleDetail(articelId){
  205. window.location.href='artcleDetail.html?articelId='+articelId+"&userId="+userId;
  206. }
  207. //展开收起栏目
  208. function columnHide(){
  209. $('.lab-more').removeClass('ashow');
  210. $('.more-choo').slideUp(200);
  211. $('.more-choo-mb').fadeOut(200);
  212. }
  213. $('.c-main').on('click','.lab-more',function(){
  214. var show = $(this).hasClass('ashow');
  215. if(show){
  216. columnHide();
  217. }else{
  218. $(this).addClass('ashow');
  219. $('.more-choo').slideDown(200);
  220. $('.more-choo-mb').fadeIn(200);
  221. initAllUserSubscribe();//加载用户订阅大类
  222. }
  223. $('.more-choo-mb').click(function(){
  224. columnHide();
  225. });
  226. });
  227. function initAllUserSubscribe(){//订阅类别下拉数据加载
  228. var url= jkzl.common.path+"/subscribe/querySubscribe";
  229. var param = {};
  230. param.userId=userId;
  231. myLayer.load("加载中,请稍后");
  232. sendPost(url,param, "json", "post", initSubscribeFailed, initSubscribeSuccess);
  233. }
  234. function initSubscribeFailed(res){
  235. myLayer.clear();
  236. if (res && res.Message) {
  237. myLayer.alert(res.Message);
  238. return;
  239. } else {
  240. myLayer.alert("请求失败,请重新刷新页面");
  241. return;
  242. }
  243. }
  244. function initSubscribeSuccess(res){
  245. if (res.Code == 10000) {
  246. if(res.Result.result){
  247. $("#more_dy_artcle").html('');
  248. var result=res.Result.result;
  249. var checked=false;
  250. var htmlstr ="<h4>订阅频道<span class='c-f12 c-999'>(我们会根据订阅信息为您推荐)</span></h4><div class='mchoo-list clearfix'>";
  251. for(var i=0;i<result.length;i++){
  252. if(result[i].issubscrive == 0 ){
  253. checked=true;
  254. htmlstr +="<a name="+result[i].categoryid+" title="+result[i].categoryname+" class='curr'>"+result[i].categoryname+"</a>";
  255. }else{
  256. htmlstr +="<a name="+result[i].categoryid+" title="+result[i].categoryname+">"+result[i].categoryname+"</a>";
  257. }
  258. }
  259. if(checked){
  260. htmlstr +="</div><div class='mchoo-btn mt5'><a href='javascript:;' class='inter-btn'>选好了!</a></div>";
  261. }else{
  262. htmlstr +="</div><div class='mchoo-btn mt5'><a href='javascript:;' class='inter-btn disable'>请选择</a></div>";
  263. }
  264. $("#more_dy_artcle").append(htmlstr);
  265. }
  266. myLayer.clear();
  267. } else {
  268. initSubscribeFailed(res);
  269. }
  270. }
  271. //选择栏目
  272. $('.c-main').on('click','.mchoo-list a',function(){
  273. $(this).toggleClass('curr');
  274. var checked = $('.mchoo-list').find('a').hasClass('curr');
  275. if(checked){
  276. $('.inter-btn').removeClass('disable').html('选好了!');
  277. }else{
  278. $('.inter-btn').addClass('disable').html('请选择');
  279. }
  280. });
  281. $('.c-main').on('click','.inter-btn',function(){
  282. var disable = $('.inter-btn').hasClass('disable');
  283. if(disable){
  284. myLayer.alert('请至少选择一个感兴趣的分类','2000');
  285. }else{
  286. var morelists =$('.mchoo-list').find('.curr');
  287. if(morelists.length>0){
  288. var categoryIds="";
  289. var categoryNames="";
  290. morelists.each(function (i) {
  291. categoryIds +=morelists.eq(i).attr("name")+",";
  292. categoryNames +=morelists.eq(i).attr("title")+",";
  293. });
  294. categoryIds =categoryIds.substring(0,categoryIds.length-1);
  295. categoryNames=categoryNames.substring(0,categoryNames.length-1);
  296. var url= jkzl.common.path+"/subscribe/saveSubscribe";
  297. var param = {};
  298. param.userId=userId;
  299. param.cname=cname;
  300. param.categoryIds=categoryIds;
  301. param.categoryNames=categoryNames;
  302. myLayer.load("保存中,请稍后");
  303. sendPost(url,param, "json", "post", saveSubscribeFailed, saveSubscribeSuccess);
  304. }else{
  305. myLayer.alert('请至少选择一个感兴趣的分类','2000');
  306. }
  307. }
  308. });
  309. function saveSubscribeFailed(res) {
  310. myLayer.clear();
  311. if (res && res.Message) {
  312. myLayer.alert(res.Message);
  313. return;
  314. } else {
  315. myLayer.alert("请求失败,请重新刷新页面");
  316. return;
  317. }
  318. }
  319. function saveSubscribeSuccess(res) {
  320. if (res.Code == 10000) {
  321. myLayer.clear();
  322. var con = '<div class="plr20 c-f15">'+
  323. '<i class="iconfont icon-dagou c-f22 c-fff mr5 c-vam"></i>' +
  324. '订阅成功' +
  325. '</div>';
  326. myLayer.alert(con,'2000');
  327. columnHide();
  328. initUserSubscribe();//加载导航菜单信息
  329. } else {
  330. saveSubscribeFailed(res);
  331. }
  332. }
  333. /*****************************************订阅结束************************************************************/
  334. /*****************************************收藏开始************************************************************/
  335. function initUserScSubscribe(){//查询收藏一级类别
  336. var url= jkzl.common.path+"/subscribe/querySubscribeByUserId";
  337. var param = {};
  338. param.userId=userId;
  339. sendPost(url,param, "json", "post", initUserScSubscribeFailed, initUserScSubscribeSuccess);
  340. }
  341. function initUserScSubscribeFailed(res) {//失败处理
  342. myLayer.clear();
  343. if (res && res.Message) {
  344. myLayer.alert(res.Message);
  345. return;
  346. } else {
  347. myLayer.alert("请求失败,请重新刷新页面");
  348. return;
  349. }
  350. }
  351. function initUserScSubscribeSuccess(res) {//成功处理
  352. articleCategoryIds="";
  353. if (res.Code == 10000) {
  354. if(res.Result.result){
  355. var result=res.Result.result;
  356. $("#artcle_sc_index").html('');
  357. articleCategoryIds="";
  358. var htmlstr ="<li id='article_sc_all' class='curr' onClick='javascript:queryIndexScAricle(\""+CON_ARTICLE+"\")' >全部</li>";
  359. for(var i=0;i<result.length;i++){
  360. articleCategoryIds +=result[i].categoryid+",";
  361. htmlstr +="<li id='"+result[i].categoryid+"_sc' onClick='javascript:queryIndexScAricle("+result[i].categoryid+")'>"+result[i].categoryname+"</li>";
  362. }
  363. $("#artcle_sc_index").append(htmlstr);
  364. articleCategoryIds=articleCategoryIds.substring(0,articleCategoryIds.length-1);
  365. initUserScArticle(articleCategoryIds,0); //加载文章列表
  366. }
  367. myLayer.clear();
  368. } else {
  369. initUserScSubscribeFailed(res);
  370. }
  371. }
  372. function queryIndexScAricle(index){//收藏大类不同文章
  373. if(index == CON_ARTICLE){
  374. $("#article_sc_all").addClass('curr').siblings().removeClass('curr');
  375. var _this =$("#article_sc_all"),
  376. wWidth = _this.parent().width(),
  377. sLeft = _this.parent().scrollLeft(),
  378. tLeft = _this.position().left;
  379. if(tLeft > wWidth/2) {
  380. $(".index-lab ul").animate({
  381. 'scrollLeft': sLeft + _this.innerWidth() + 20
  382. }, 300);
  383. }else {
  384. $(".index-lab ul").animate({
  385. 'scrollLeft': sLeft - _this.innerWidth() - 20
  386. }, 300);
  387. }
  388. initUserScArticle(articleCategoryIds,0);
  389. }else{
  390. $("#"+index+"_sc").addClass('curr').siblings().removeClass('curr');
  391. var _this = $("#"+index+"_sc"),
  392. wWidth = _this.parent().width(),
  393. sLeft = _this.parent().scrollLeft(),
  394. tLeft = _this.position().left;
  395. if(tLeft > wWidth/2) {
  396. $(".index-lab ul").animate({
  397. 'scrollLeft': sLeft + _this.innerWidth() + 20
  398. }, 300);
  399. }else {
  400. $(".index-lab ul").animate({
  401. 'scrollLeft': sLeft - _this.innerWidth() - 20
  402. }, 300);
  403. }
  404. initUserScArticle(index,0);
  405. }
  406. }
  407. function initUserScArticle(AcId,index){//收藏文章列表
  408. pageIndex=index;
  409. articleCategoryId=AcId;
  410. var url= jkzl.common.path+"/article/queryCollectionArticalList";
  411. var param = {};
  412. param.pageIndex=index;
  413. param.pageSize=pageSize;
  414. param.articleCategoryId=AcId;
  415. param.userId=userId;
  416. param.userType=userType;
  417. sendPost(url,param, "json", "post", initUserScArticleFailed, initUserScArticleSuccess);
  418. }
  419. function initUserScArticleFailed(res) {//失败处理
  420. myLayer.clear();
  421. if (res && res.Message) {
  422. $("#artcle_sc_content").html('');
  423. var htmlstr =" <div id='sc_gxqwz' class='norecord nodata'> <i class='icon-nopast'></i>";
  424. htmlstr +="<p>看看其他感兴趣的文章吧</p></div>";
  425. $("#artcle_sc_content").append(htmlstr);
  426. myLayer.alert(res.Message);
  427. return;
  428. } else {
  429. $("#artcle_sc_content").html('');
  430. var htmlstr =" <div id='sc_gxqwz' class='norecord nodata'> <i class='icon-nopast'></i>";
  431. htmlstr +="<p>看看其他感兴趣的文章吧</p></div>";
  432. $("#artcle_sc_content").append(htmlstr);
  433. myLayer.alert("请求失败,请重新刷新页面");
  434. return;
  435. }
  436. }
  437. function initUserScArticleSuccess(res) {//成功处理
  438. if (res.Code == 10000) {
  439. var checked= $("#artcle_sc_content").find('div').hasClass("ckgd");
  440. if(checked){
  441. $("#sc_articlepage").remove();
  442. }
  443. var total = res.Count;
  444. if(total==0 || res.Result.length==0){//没有数据情况
  445. $("#artcle_sc_content").html('');
  446. var htmlstr =" <div id='sc_gxqwz' class='norecord nodata'> <i class='icon-nopast'></i>";
  447. htmlstr +="<p>看看其他感兴趣的文章吧</p></div>";
  448. $("#artcle_sc_content").append(htmlstr);
  449. myLayer.clear();
  450. return;
  451. }
  452. if(res.Result && total>0){
  453. if(pageIndex == 0){
  454. $("#artcle_sc_content").html('');
  455. }else{
  456. var nochecked= $("#artcle_sc_content").find('div').hasClass("nodata");
  457. if(nochecked){
  458. $("#sc_gxqwz").remove();
  459. }
  460. }
  461. var result=res.Result;
  462. var htmlstr ="<ul class='index-list'>";
  463. for(var i=0;i<result.length;i++){
  464. htmlstr +="<li><span id='"+result[i].articleId+"_active' class='fl shoucang-box active' onClick='javascript:switchArticle(\""+result[i].articleId+"\")'><i class='iconfont icon-collection c-f18 c-999'></i></span>";
  465. htmlstr +="<a href='javascript:queryArticleDetail(\""+result[i].articleId+"\")' class='list-a'>";
  466. htmlstr +=" <div class='ilist-con'><h4 class='c-nowrap-multi'>";
  467. if(result[i].articleType == 1){
  468. htmlstr +="<i class='ilstate st-blue'><i>视频</i></i>"+result[i].articleTitle+"</h4>";
  469. }
  470. if(result[i].articleType == 2){
  471. htmlstr +="<i class='ilstate st-org'><i>图文</i></i>"+result[i].articleTitle+"</h4>";
  472. }
  473. if(result[i].articleType == 3){
  474. htmlstr +="<i class='ilstate st-radio'><i>音频</i></i>"+result[i].articleTitle+"</h4>";
  475. }
  476. if(result[i].articleType == 4){
  477. htmlstr +="<i class='ilstate st-qa'><i>问答</i></i>"+result[i].articleTitle+"</h4>";
  478. }
  479. htmlstr +="<ul class='clearfix'>";
  480. htmlstr +="<li class='fl width-33'><i class='iconfont icon-xianshikejian c-f16'></i><em>"+result[i].browseNumbere+"</em></li>";
  481. htmlstr +="<li class='fl width-33'><i class='iconfont icon-zan1 c-f10'></i><em>"+result[i].pointNumber+"</em></li>";
  482. htmlstr +="<li class='fl width-33'><i class='iconfont icon-bianji c-f12'></i><em>"+result[i].commentNumber+"</em></li>";
  483. htmlstr +="</ul></div><div class='ilist-img'><img src="+result[i].articleCover+" alt='' /></div></a></li>";
  484. }
  485. if((pageIndex+1) * pageSize < total){
  486. htmlstr +="</ul><div id='sc_articlepage' class='c-t-center ptb10 ckgd'><a href='javascript:queryArticleScPage()' class='c-f12 c-aaa'>查看更多</a> </div>";
  487. }else{
  488. htmlstr +="</ul><div id='sc_articlepage' class='c-t-center ptb10 ckgd'><a class='c-f12 c-aaa'>没有更多了</a> </div>";
  489. }
  490. $("#artcle_sc_content").append(htmlstr);
  491. }
  492. myLayer.clear();
  493. } else {
  494. initUserScArticleFailed(res);
  495. }
  496. }
  497. function queryArticleScPage(){//文章分页
  498. pageIndex++;
  499. initUserScArticle(articleCategoryId,pageIndex);
  500. }
  501. function switchArticle(aId){
  502. myLayer.confirm({
  503. title:'提示',
  504. con:'确定要取消收藏吗?',
  505. cancel: function(){},
  506. cancelValue:'取消',
  507. ok: function(){
  508. myLayer.load("取消中,请稍后");
  509. var url= jkzl.common.path+"/article/cancelArticle";
  510. var param = {};
  511. param.articleId=aId;
  512. param.userId=userId;
  513. param.userType=userType;
  514. sendPost(url,param, "json", "post", cancelArticleFailed, cancelArticleSuccess);
  515. },
  516. okValue:'确定'
  517. });
  518. }
  519. function cancelArticleFailed(res) {//失败处理
  520. myLayer.clear();
  521. if (res && res.Message) {
  522. myLayer.alert(res.Message);
  523. return;
  524. } else {
  525. myLayer.alert("请求失败,请重新刷新页面");
  526. return;
  527. }
  528. }
  529. function cancelArticleSuccess(res) {//成功处理
  530. myLayer.clear();
  531. if (res.Code == 10000) {
  532. var con = '<i class="iconfont icon-shoucang c-f22 c-fff ml15 mr5 c-vam"></i>';
  533. myLayer.alert(con + '<span class="c-f15 c-vam mr15">取消收藏</span>','2000');
  534. initUserScArticle(articleCategoryId,pageIndex); //加载文章列表
  535. } else {
  536. cancelArticleFailed(res);
  537. }
  538. }