/**
 * Created by Administrator on 2021/4/5.
 */
define(['jquery', "template", "Tools", "newApi"], function ($, template, Tools ) {
    //数据存储
    var module = {
        data: {
            newsInformationList:''
        },
    };
    var tools = new Tools();

    module.init = function (page) {

        console.log(getQueryVariable('id'))
        //新闻资讯
        tools.doGet(newDetail + '/'+getQueryVariable('id'), {}, module.NewsInformation,true);

    };

    //获取地址栏参数
    function getQueryVariable(variable){
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }

    //新闻资讯数据
    module.NewsInformation = function (data) {
        console.log(data)
        if (data.code == 200) {
            var content = data.data;
            $("#newTitle").html(content.title);
            $("#newTime").html(content.newsTime);
            $("#newCome").html(content.createBy);
            $("#newContent").html(content.content);
        }
    }

    return module;
});