/**
 * Created by Administrator on 2021/4/5.
 */
define(['jquery', "template", "Tools", "echarts", 'swiper'], function ($, template, Tools, echarts, swiper) {
    //数据存储
    var module = {
        data: {
            //服务器地址
            serverApi:'',
            //焦点图数据
            focusList: [],
            communicateList: [],
        },
    };
    var tools = new Tools();

    module.init = function (page) {
        //新闻管理列表
        tools.doGet(news + '/' + getQueryVariable('id'), {}, module.newList , 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.newList = function (data) {
        console.log(data)
        if (data.code == 200) {
            var content = data.data;
            $("#newTitle").html(content.title);
            $("#newTime").html('发布时间：'+content.newsTime);
            $("#newCome").html('来源：'+content.realname);
            $("#newContent").html(content.content);
            if (document.body.scrollHeight > document.body.offsetHeight){
                document.getElementById('bottomInformation').style.position = 'relative';
            }
        }
    }

    goDetail = function(id){
        tools.skip('/agriculturalLawEnforcement/view/workDynamics/workDetail.html?id='+id);
    }
    return module;
});