define(['jquery', "template", "Tools", 'LeftNav', 'dateTime'], function ($, template, Tools, LeftNav) { //数据存储 var module = { data: { //服务器地址 serverApi: '', dataList: { children: [], haschildren: true, isopen: false, level: "0", name: "", url: "#", }, }, }; var tools = new Tools(); module.init = function (page) { tools.doGet(knowledgeClassification, {}, module.projectList, true); //新闻管理列表 tools.doGet(dictType + '/training_type', {}, module.dictType , true); $("#signStartTimeStr").datetime({ type: "date", value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()], success: function (res) { //console.log(res) } }) $("#signEndTimeStr").datetime({ type: "date", value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()], success: function (res) { //console.log(res) } }) tools.getWebConfig(); }; //新闻列表 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.dictType = function (data) { module.data.trainingTypeOptions = data.data; tools.doPost(technologyTraining, {}, module.technologyTrainingList, true); tools.doPost(technologyConsulting, {}, module.technologyConsultingList, true); } //专家列表 module.technologyTrainingList = function (data) { if (data.code == 200) { var content = data.data; for ( var i = 0 ; i < content.length ; i++ ){ content[i].trainingType = module.selectDictLabel(module.data.trainingTypeOptions,content[i].trainingType); content[i].masterMap = serverApi + ((content[i].masterMap || content[i].masterMap != '')?content[i].masterMap: 'null'); } module.data.technologyList = content; var technologyData = template('technologyData', module.data); $("#technologyContent").html(technologyData); } } //专家列表 module.technologyConsultingList = function (data) { if (data.code == 200) { var content = data.data; module.data.technologyConsultingList = content; var technologyConsultingData = template('technologyConsultingData', module.data); $("#technologyConsultingContent").html(technologyConsultingData); } } module.selectDictLabel = function (datas, value) { var actions = []; Object.keys(datas).some((key) => { if (datas[key].dictValue == ('' + value)) { actions.push(datas[key].dictLabel); return true; } }) return actions.join(''); } switchTab = function (type) { $("#"+type+"Btn").addClass("active").siblings().removeClass("active"); $("#"+type+"").css('display','block').siblings().css('display','none'); module.data.switchTab = type; } searchType = function (id) { console.log(id) $(".left .left_nav_name").removeClass("nav_open"); tools.doPost(technologyConsulting, {techniqueType: id}, module.technologyConsultingList, true); } technologySearch = function(){ const data = {} if ($("input[name='searchType']:checked").val() == 'title'){ data.trainingName = $('#technologyInput').val(); }else{ data.briefIntroduction = $('#technologyInput').val(); } if ($('#signStartTimeStr').val()){ data.startTime = $('#signStartTimeStr').val() + ' 00:00:00'; } if ($('#signEndTimeStr').val()){ data.endTime = $('#signEndTimeStr').val() + ' 00:00:00'; } console.log(data) tools.doPost(technologyTraining, data, module.technologyTrainingList, true); } consultingSearch = function(){ const data = {} if ($("input[name='consultingType']:checked").val() == 'title'){ data.title = $('#consultingInput').val(); }else{ data.handleName = $('#consultingInput').val(); } // data.startTime = $('#technologyInput').val(); // data.endTime = $('#technologyInput').val(); console.log(data) tools.doPost(technologyConsulting, data, module.technologyConsultingList, true); } goSearch = function (type) { if (type == 'expert'){ tools.doPost(expertDatabase, {name: $("#searchInput").val()}, module.expertDatabaseList, true); } if (type == 'article'){ tools.doPost(articleLibrary, {headline: $("#articleSearchInput").val()}, module.articleLibraryList, true); } if (type == 'video'){ tools.doPost(videoLibrary, {headline: $("#videoSearchInput").val()}, module.videoLibraryList, true); } } return module; })