$(function () { // $(".header_root").load("./comm/header.html"); $(".footer_root").load("./comm/footer.html"); // nav传值显示下划线 // $(".header_root").data("nav_info", 5); // 请求新闻详情 function getNewsDetail() { let _url = $.baseUrl + "n/detail"; $.ajax({ type: "POST", url: _url, dataType: "json", contentType: "application/json; charset=utf-8", data: JSON.stringify({ newsid: $.getQueryVariable("newsid") }), success: function (data) { if (data.code === 0) { loadNewsDetail(data.obj); } else { alert(data.msg); } }, }); } // 加载详情页面 function loadNewsDetail(params) { if (!params) { $(".news_detail_header .detail_title").html(""); $(".news_detail_header .detail_stitle").html("发布时间:"); $(".news_detail_content").html(""); return; } $(".news_detail_header .detail_title").html(params.newstitle); $(".news_detail_header .detail_stitle").html("发布时间:" + $.msToDateString(params.createtime * 1000)); $(".news_detail_content").html(params.newscontent); } getNewsDetail(); });