|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- 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)
- }
- })
- };
-
- //新闻列表
- 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;
- }
- 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;
- })
|