网站
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

150 rindas
5.1 KiB

  1. define(['jquery', "template", "Tools", 'LeftNav', 'dateTime'], function ($, template, Tools, LeftNav) {
  2. //数据存储
  3. var module = {
  4. data: {
  5. //服务器地址
  6. serverApi: '',
  7. dataList: {
  8. children: [],
  9. haschildren: true,
  10. isopen: false,
  11. level: "0",
  12. name: "",
  13. url: "#",
  14. },
  15. },
  16. };
  17. var tools = new Tools();
  18. module.init = function (page) {
  19. tools.doGet(knowledgeClassification, {}, module.projectList, true);
  20. //新闻管理列表
  21. tools.doGet(dictType + '/training_type', {}, module.dictType , true);
  22. $("#signStartTimeStr").datetime({
  23. type: "date",
  24. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  25. success: function (res) {
  26. //console.log(res)
  27. }
  28. })
  29. $("#signEndTimeStr").datetime({
  30. type: "date",
  31. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  32. success: function (res) {
  33. //console.log(res)
  34. }
  35. })
  36. };
  37. //新闻列表
  38. module.projectList = function (data) {
  39. if (data.code == 200) {
  40. var content = data.data;
  41. content.forEach(res => {
  42. module.data.dataList.children.push(res);
  43. })
  44. leftNav(".left", module.data.dataList);
  45. }
  46. }
  47. module.dictType = function (data) {
  48. module.data.trainingTypeOptions = data.data;
  49. tools.doPost(technologyTraining, {}, module.technologyTrainingList, true);
  50. tools.doPost(technologyConsulting, {}, module.technologyConsultingList, true);
  51. }
  52. //专家列表
  53. module.technologyTrainingList = function (data) {
  54. if (data.code == 200) {
  55. var content = data.data;
  56. for ( var i = 0 ; i < content.length ; i++ ){
  57. content[i].trainingType = module.selectDictLabel(module.data.trainingTypeOptions,content[i].trainingType);
  58. content[i].masterMap = serverApi + content[i].masterMap;
  59. }
  60. module.data.technologyList = content;
  61. var technologyData = template('technologyData', module.data);
  62. $("#technologyContent").html(technologyData);
  63. }
  64. }
  65. //专家列表
  66. module.technologyConsultingList = function (data) {
  67. if (data.code == 200) {
  68. var content = data.data;
  69. module.data.technologyConsultingList = content;
  70. var technologyConsultingData = template('technologyConsultingData', module.data);
  71. $("#technologyConsultingContent").html(technologyConsultingData);
  72. }
  73. }
  74. module.selectDictLabel = function (datas, value) {
  75. var actions = [];
  76. Object.keys(datas).some((key) => {
  77. if (datas[key].dictValue == ('' + value)) {
  78. actions.push(datas[key].dictLabel);
  79. return true;
  80. }
  81. })
  82. return actions.join('');
  83. }
  84. switchTab = function (type) {
  85. $("#"+type+"Btn").addClass("active").siblings().removeClass("active");
  86. $("#"+type+"").css('display','block').siblings().css('display','none');
  87. module.data.switchTab = type;
  88. }
  89. searchType = function (id) {
  90. console.log(id)
  91. $(".left .left_nav_name").removeClass("nav_open");
  92. tools.doPost(technologyConsulting, {techniqueType: id}, module.technologyConsultingList, true);
  93. }
  94. technologySearch = function(){
  95. const data = {}
  96. if ($("input[name='searchType']:checked").val() == 'title'){
  97. data.trainingName = $('#technologyInput').val();
  98. }else{
  99. data.briefIntroduction = $('#technologyInput').val();
  100. }
  101. if ($('#signStartTimeStr').val()){
  102. data.startTime = $('#signStartTimeStr').val() + ' 00:00:00';
  103. }
  104. if ($('#signEndTimeStr').val()){
  105. data.endTime = $('#signEndTimeStr').val() + ' 00:00:00';
  106. }
  107. console.log(data)
  108. tools.doPost(technologyTraining, data, module.technologyTrainingList, true);
  109. }
  110. consultingSearch = function(){
  111. const data = {}
  112. if ($("input[name='consultingType']:checked").val() == 'title'){
  113. data.title = $('#consultingInput').val();
  114. }else{
  115. data.handleName = $('#consultingInput').val();
  116. }
  117. // data.startTime = $('#technologyInput').val();
  118. // data.endTime = $('#technologyInput').val();
  119. console.log(data)
  120. tools.doPost(technologyConsulting, data, module.technologyConsultingList, true);
  121. }
  122. goSearch = function (type) {
  123. if (type == 'expert'){
  124. tools.doPost(expertDatabase, {name: $("#searchInput").val()}, module.expertDatabaseList, true);
  125. }
  126. if (type == 'article'){
  127. tools.doPost(articleLibrary, {headline: $("#articleSearchInput").val()}, module.articleLibraryList, true);
  128. }
  129. if (type == 'video'){
  130. tools.doPost(videoLibrary, {headline: $("#videoSearchInput").val()}, module.videoLibraryList, true);
  131. }
  132. }
  133. return module;
  134. })