businessGuideDeatil.js 2.98 KB
$(function () {
    $('.layui-breadcrumb a').eq(1).attr('href',GetQueryString('href'));
    $('.layui-breadcrumb a').eq(1).attr('title', decodeURI(GetQueryString('title')));
    $('.layui-breadcrumb a').eq(1).text(decodeURI(GetQueryString('title')));
    //模板点击下载
    downLoad()
})
function downLoad() {
    $('.download-attachment a').click(function () {
        var url  = $(this).attr('url')
        var ua = navigator.userAgent;
        if (/chrome/i.test(ua)) {
            window.open(`${portal.api_url}/hlwj/accessoryDO/download?url=${url}`, '_self')
        } else if ("ActiveXObject" in window) {
            url = encodeURI(url)
            var gotolink = document.createElement('a');
            var urlLink = `${portal.api_url}/hlwj/accessoryDO/download?url=${url}`;
            gotolink.href = urlLink;
            gotolink.setAttribute("target", "_self");
            document.body.appendChild(gotolink);
            gotolink.click();
        }
    })
}

layui.use('element', function () {
    var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
});
// 办事指南详情数据
function _initData() {
    var newsDetail = $("#newsDetail");
    newsDetail.empty();
    $.ajax({
        type: "get",  //提交方式  
        url: portal.api_url + "/portal/MhGuide/getBsznDetailById",//路径
        data: {
            "bsznId": GetQueryString('id'),
        },
        dataType: "json",
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理           
            if (result.code == 200 && result.data != null) {
                $('.source p').html(result.data.source);
                $('.newsTitle').html(result.data.headline)
                $('.releaseTime').html(result.data.addtime)
                newsDetail.append(result.data.content)
            }
        }
    });
}
// 通过业务ID获取对应的办事指南明细

function _getBsznDetailByYwid() {
    var newsDetail = $("#newsDetail");
    newsDetail.empty();
    $.ajax({
        type: "get",  //提交方式  
        url: portal.api_url + "/portal/MhGuide/getBsznDetailByYwid",//路径
        data: {
            "ywid": GetQueryString('ywid'),
        },
        dataType: "json",
        //数据,这里使用的是Json格式进行传输  
        success: function (result) {//返回数据根据结果进行相应的处理           
            if (result.code == 200 && result.data != null) {
                $('.source p').html(result.data.source);
                $('.newsTitle').html(result.data.headline);
                $('.releaseTime').html(result.data.publishTime);
                newsDetail.append(result.data.content);
            }
        }
    });
}


function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURIComponent(r[2]).replace(/\"/g, "");
    return null;
}