xwxq.js 1.81 KB
$(function () {
    let Mydate = new Date()
    let year = Mydate.getFullYear();
    let minutes = Mydate.getMinutes()
    let hour = Mydate.getHours();
    let date = Mydate.getDate()
    let month = Mydate.getMonth();
    $('.date div:first-child').text(year)
    $('.date div:nth-child(2)').text(month + 1 + "/" + date)
    $('.date div:last-child').text(hour + ":" + minutes)
    LawsData()
})
// 新闻详情数据
function LawsData() {
    var newsList = $("#newsList");
    newsList.empty();
    var li;
    $.ajax({
        type: "get",  //提交方式  
        url: portal.api_url + "/hlwj/MhNews/getDetailById",//路径
        data:{
            "id":GetQueryString('id'),
        },  
        dataType: "json",
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理           
            if (result.code == 200 && result.data != null) {
                console.log(result.data)
                $('.newsTitle').html(result.data.title)
                newsList.append(result.data.content)
            }
        }
    });
}
$(window).scroll(function () {
    let juli = $(document).scrollTop();
    if (juli > 360) {
        $('.left-left').addClass('middle_active');
    } else {
        $('.left-left').removeClass('middle_active');
    }
})
layui.use('element', function () {
    var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
    //监听导航点击
    element.on('nav(demo)', function (elem) {
        //console.log(elem)
        layer.msg(elem.text());
    });
});
function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURIComponent(r[2]);
    return null;
}