7a32dcaf8ac041fd778d31e2d5f73d8f21afa62a.svn-base 20 KB

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