/**
 * Created by Administrator on 2021/4/5.
 */
define(['jquery', "template", "Tools", "echarts", 'swiper' , 'LeftNav'], function ($, template, Tools, echarts, swiper , LeftNav) {
    //数据存储
    var module = {
        data: {
            //服务器地址
            serverApi:'',
            //焦点图数据
            focusList: [],
            communicateList: [],
            noticeList: [],
            policyList: [],
            newList: [],
            dataList:{
                children: [],
                haschildren: true,
                isopen: false,
                level: "0",
                name: "",
                url: "#",
            }
        },
    };
    var tools = new Tools();

    module.init = function (page) {
        //新闻管理列表
        tools.doGet(projectClassification, {}, module.projectList , true);
        tools.doPost(guideQuery, {}, module.guideQueryList , true);

    };

    //新闻列表
    module.projectList = function (data) {
        if (data.code == 200) {
            var content = data.data;
            content.forEach(res=>{
                module.data.dataList.children.push(res)
            })
            leftNav(".left",module.data.dataList);
        }
    }

    //新闻列表
    module.guideQueryList = function (data) {
        if (data.code == 200) {
            var content = data.data;
            module.data.directoriesList = content;
            var directoriesData = template('directoriesData', module.data);
            $("#directoriesContent").html(directoriesData);
        }
    }

    goSearch = function () {
        console.log($("#searchInput").val())
        tools.doPost(guideQuery, {projectTitle:$("#searchInput").val()}, module.guideQueryList , true);
    }

    searchType = function (id) {
        console.log(id)
        tools.doPost(guideQuery, {projectType:id}, module.guideQueryList , true);
    }

    return module;
});