星火官网,前端页面(前台)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

news_detail.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. $(function () {
  2. // $(".header_root").load("./comm/header.html");
  3. $(".footer_root").load("./comm/footer.html");
  4. // nav传值显示下划线
  5. // $(".header_root").data("nav_info", 5);
  6. // 请求新闻详情
  7. function getNewsDetail() {
  8. let _url = $.baseUrl + "n/detail";
  9. $.ajax({
  10. type: "POST",
  11. url: _url,
  12. dataType: "json",
  13. contentType: "application/json; charset=utf-8",
  14. data: JSON.stringify({
  15. newsid: $.getQueryVariable("newsid")
  16. }),
  17. success: function (data) {
  18. if (data.code === 0) {
  19. loadNewsDetail(data.obj);
  20. } else {
  21. alert(data.msg);
  22. }
  23. },
  24. });
  25. }
  26. // 加载详情页面
  27. function loadNewsDetail(params) {
  28. if (!params) {
  29. $(".news_detail_header .detail_title").html("");
  30. $(".news_detail_header .detail_stitle").html("发布时间:");
  31. $(".news_detail_content").html("");
  32. return;
  33. }
  34. $(".news_detail_header .detail_title").html(params.newstitle);
  35. $(".news_detail_header .detail_stitle").html("发布时间:" + $.msToDateString(params.createtime * 1000));
  36. $(".news_detail_content").html(params.newscontent);
  37. }
  38. getNewsDetail();
  39. });