portal html css js resource

search.js 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908
  1. $(function() {
  2. var userid = $.cookie("userid");
  3. if(userid && userid != "null" && userid != null) {
  4. $(".myWorkspace").attr("href", "workspaces.html?" + userid);
  5. loginStatus();
  6. }
  7. //登陆个人信息下拉菜单
  8. $('.head-portrait').hover(function() {
  9. $(".personal-infor").stop(true, false).slideDown(500);
  10. }, function() {
  11. $(".personal-infor").stop(true, false).slideUp(500);
  12. });
  13. $(document).scroll(function() {
  14. var top = $(document).scrollTop();
  15. if(top != 0) {
  16. $(".searchbox").fadeIn(1000);
  17. } else {
  18. $(".searchbox").fadeOut(1000);
  19. }
  20. });
  21. var newc = GetQueryString("lookFor");
  22. if(newc == 0 || newc == "") {
  23. var c = 0;
  24. } else {
  25. var c = 1;
  26. // $(".lookwho option[value='1']").attr("selected","selected");
  27. $("#div_select").text("找资源");
  28. }
  29. /*
  30. * var lookFor2 = 0; $("#lookFor2 ul li").on("click",function(){
  31. * lookFor2=$(this).index(); }); //enter绑定时间
  32. * $("#searchContent").keydown(function(e){ if(e.which==13) { synContent(2);
  33. * synContent(1); var searchContent = $("#searchContent").val(); if(lookFor2 =
  34. * 1){ $("#div_select").text("找资源"); location.href =
  35. * "search.html?searchContent=" + encodeURI(searchContent); } }
  36. * })
  37. */
  38. var userid = $.cookie("userid");
  39. var subject;
  40. var subb = $.trim(GetQueryString("subject"));
  41. var industry;
  42. var pageSize;
  43. var sub = "SUBJECT";
  44. var indu = "INDUSTRY";
  45. var address = $("#address .colorbg")[0].title;
  46. $("#searchContent").val(GetQueryString("searchContent"));
  47. $("#hsearchContent").val(GetQueryString("searchContent"));
  48. var key = $("#searchContent").val();
  49. var getData = function(key, subject, industry, pageSize, pageNo, isbind,
  50. add) {
  51. if(c == 0) {
  52. $
  53. .ajax({
  54. "url": "/ajax/professor/pqBaseInfo",
  55. "type": "GET",
  56. "data": {
  57. "key": key,
  58. "subject": subject,
  59. "industry": industry,
  60. "pageSize": pageSize,
  61. "pageNo": pageNo,
  62. "address": add
  63. },
  64. "contentType": "application/x-www-form-urlencoded",
  65. "success": function($data) {
  66. if($data.success) {
  67. // console.log($data);
  68. $("#professorList").html("");
  69. for(var i = 0; i < $data.data.data.length; i++) {
  70. // 创建HTML标签
  71. var dataHtml = "<div class='item'>";
  72. dataHtml += "<a class='infoi' href='information-brow.html?professorId=" +
  73. $data.data.data[i].id +
  74. "' ><div class='photo1 headRadius'>"
  75. if($data.data.data[i].hasHeadImage) {
  76. dataHtml += "<img class='images' style='width:100%;' src='/images/head/" +
  77. $data.data.data[i].id +
  78. "_l.jpg'/></div></a>";
  79. } else {
  80. dataHtml += "<img class='images' style='width:100%;' src='/images/default-photo.jpg'/></div></a>";
  81. }
  82. dataHtml += "<div class='synopsis'>";
  83. dataHtml += "<a href='javascript:void();' class='named'>";
  84. if(typeof($data.data.data[i].name) !== "undefined") {
  85. dataHtml += $data.data.data[i].name;
  86. }
  87. dataHtml += "</a><a href='information-brow.html?professorId=" +
  88. $data.data.data[i].id +
  89. "' class='modify'></a>";
  90. dataHtml += "<div class='position'>";
  91. if($data.data.data[i].office) {
  92. dataHtml += $data.data.data[i].office +
  93. ", ";
  94. }
  95. if($data.data.data[i].title) {
  96. dataHtml += $data.data.data[i].title +
  97. ", ";
  98. }
  99. if($data.data.data[i].department) {
  100. dataHtml += $data.data.data[i].department +
  101. ", ";
  102. }
  103. if($data.data.data[i].orgName) {
  104. dataHtml += $data.data.data[i].orgName;
  105. }
  106. if($data.data.data[i].address) {
  107. dataHtml += " | " +
  108. $data.data.data[i].address;
  109. }
  110. dataHtml += "</div>";
  111. dataHtml += "<div class='ellipsisbox science'>";
  112. if(typeof($data.data.data[i].subject) !== "undefined") {
  113. dataHtml += "<p>学术领域:" +
  114. $data.data.data[i].subject +
  115. "</p>";
  116. }
  117. dataHtml += "</div>";
  118. dataHtml += "<div class='ellipsisbox industry'>";
  119. if(typeof($data.data.data[i].industry) !== "undefined") {
  120. dataHtml += "<p>应用行业:" +
  121. $data.data.data[i].industry +
  122. "</p>";
  123. }
  124. if($data.data.data[i].researchAreas.length) {
  125. dataHtml += "<p>研究方向:"
  126. for(var m = 0; m < $data.data.data[i].researchAreas.length; m++) {
  127. dataHtml += $data.data.data[i].researchAreas[m].caption;
  128. if(m<$data.data.data[i].researchAreas.length-1){
  129. dataHtml += " , "
  130. }
  131. }
  132. dataHtml += "</p>";
  133. }
  134. dataHtml += "</div>";
  135. dataHtml += "</div>";
  136. if($data.data.data[i].id != userid) {
  137. dataHtml += "<div class='operbox'><span class='operbtn onlyConsultbtn' id='" +
  138. $data.data.data[i]['id'] +
  139. "'>咨询</span></div>";
  140. }
  141. var $datahtml = $(dataHtml);
  142. $("#professorList").append(dataHtml);
  143. var photoHeight = $(".photo1").eq(i).height();
  144. var middleHeight = $(".synopsis").eq(i).height();
  145. if(middleHeight < photoHeight) {
  146. $(".synopsis").eq(i).height(photoHeight);
  147. }
  148. if($data.data.data[i].authType) {
  149. $(".modify").eq(i).addClass("authicon authicon-cu");
  150. } else {
  151. if($data.data.data[i].authStatus==3) {
  152. if($data.data.data[i].authentication == 1) {
  153. $(".modify").eq(i).addClass("authicon2 authicon-mana");
  154. //$(".modify").eq(i).html("<span>科研</span>");
  155. } else if($data.data.data[i].authentication == 2) {
  156. $(".modify").eq(i).addClass("authicon2 authicon-staff");
  157. //$(".modify").eq(i).html("<span>企业</span>");
  158. } else {
  159. $(".modify").eq(i).addClass("authicon2 authicon-stu");
  160. //$(".modify").eq(i).html("<span>学生</span>");
  161. }
  162. }
  163. }
  164. // 点击查看当前信息
  165. (function(i) {
  166. $('.synopsis')
  167. .eq(i)
  168. .click(
  169. function() {
  170. location.href = 'information-brow.html?professorId=' +
  171. $data.data.data[i].id;
  172. })
  173. }
  174. )(i);
  175. }
  176. //找专家点击咨询
  177. $(".onlyConsultbtn").bind("click", clickSeachProConsultHandler);
  178. if(isbind == true) {
  179. $(".tcdPageCode").createPage({
  180. pageCount: Math.ceil($data.data.total / pageSize),
  181. current: $data.data.pageNo,
  182. backFn: function(p) {
  183. getData(key, subject, industry, pageSize, p, false);
  184. }
  185. });
  186. }
  187. } else {
  188. $.MsgBox.Alert("message", $data.msg);
  189. }
  190. }
  191. });
  192. } else {
  193. //查询我的所有资源
  194. $.ajax({
  195. "url": "/ajax/resource/pq",
  196. "type": "get",
  197. "data": {
  198. "key": key,
  199. "subject": subject,
  200. "industry": industry,
  201. "pageSize": pageSize,
  202. "pageNo": pageNo,
  203. "address": add
  204. },
  205. "contentType": "application/x-www-form-urlencoded",
  206. "success": function(data) {
  207. console.log(data);
  208. if(data.success) {
  209. $("#professorList").html("");
  210. var $da = data.data.data;
  211. for(var i = 0; i < $da.length; i++) {
  212. var add = '<div class="item"><div class="remess" resourceId=' + $da[i].resourceId + '>'
  213. add += '<div class="clearfix"><a class="resourcephoto headRadius" ><div class="ResImgBox" style="background:#ffffff;"><img class="resImg headRadius resourceImg" src="" /></div></a>'
  214. add += '<div class="synopsis" style="width:66%;">'
  215. add += '<div class="cousultName"><a class="resouname" href="javascript:void();">' + $da[i].resourceName + '</a></div>'
  216. if($da[i].editProfessor.name) {
  217. add += '<div class="belongname"><a style="float:left;display:block;">' + $da[i].editProfessor.name + '</a><a class="modicon" style="display:block;top:2px;left:2px;"></a></div>'
  218. }
  219. if($da[i].editProfessor.title == undefined) {
  220. $da[i].editProfessor.title = "";
  221. }
  222. if($da[i].editProfessor.department == undefined) {
  223. $da[i].editProfessor.department = "";
  224. }
  225. if($da[i].editProfessor.orgName == undefined) {
  226. $da[i].editProfessor.orgName = "";
  227. }
  228. add += '<div style="clear:both"></div><div class="positionbox">'
  229. if($da[i].editProfessor.title && $da[i].editProfessor.department && $da[i].editProfessor.orgName) {
  230. add += $da[i].editProfessor.title + "," + $da[i].editProfessor.department + "," + $da[i].editProfessor.orgName;
  231. } else if(!$da[i].editProfessor.title && $da[i].editProfessor.department && $da[i].editProfessor.orgName) {
  232. add += $da[i].editProfessor.department + "," + $da[i].editProfessor.orgName;
  233. } else if($da[i].editProfessor.title && !$da[i].editProfessor.department && $da[i].editProfessor.orgName) {
  234. add += $da[i].editProfessor.title + "," + $da[i].editProfessor.orgName;
  235. } else if($da[i].editProfessor.title && $da[i].editProfessor.department && !$da[i].editProfessor.orgName) {
  236. add += $da[i].editProfessor.title + "," + $da[i].editProfessor.department;
  237. } else if(!$da[i].editProfessor.title && !$da[i].editProfessor.department && $da[i].editProfessor.orgName) {
  238. add += $da[i].editProfessor.orgName
  239. } else if(!$da[i].editProfessor.title && $da[i].editProfessor.department && !$da[i].editProfessor.orgName) {
  240. add += $da[i].editProfessor.department
  241. } else if($da[i].editProfessor.title && !$da[i].editProfessor.department && !$da[i].editProfessor.orgName) {
  242. add += $da[i].editProfessor.title
  243. }
  244. add += '</div>'
  245. if($da[i].subject) {
  246. add += '<div class="ellipsisbox sciencebox"><p>学术领域:' + $da[i].subject + '</p></div>'
  247. }
  248. if($da[i].industry) {
  249. add += '<div class="ellipsisbox industrybox"><p>应用行业:' + $da[i].industry + '</p></div>'
  250. }
  251. if($da[i].supportedServices) {
  252. add += '<div class="ellipsisbox provideservice"><p>应用用途:' + $da[i].supportedServices + '</p></div></div>'
  253. }
  254. add += "</div>"
  255. if(userid == $da[i]["editProfessor"]["id"]) {
  256. add += '<div class="operbox"><span class="operbtn consultbtn" id="' + $da[i]["editProfessor"]["id"] + '" style="display:none;">咨询</span><span style="display: none;" class="operbtn applybtn appl" resourceId=' + $da[i].resourceId + ' resourceName=' + $da[i].resourceName + ' editProfessor=' + $da[i].editProfessor.name + '>申请</span></div>'
  257. } else {
  258. add += '<div class="operbox"><span class="operbtn consultbtn" id="' + $da[i]["editProfessor"]["id"] + '">咨询</span><span style="display: none;" class="operbtn applybtn appl" resourceId=' + $da[i].resourceId + ' resourceName=' + $da[i].resourceName + ' editProfessor=' + $da[i].editProfessor.name + '>申请</span></div>'
  259. }
  260. add += '</div></div>'
  261. var $add = $(add);
  262. $("#professorList").append($add);
  263. if($da[i].editProfessor.authType) {
  264. $add.find(".modicon").addClass("authicon authicon-cu");
  265. } else {
  266. if($da[i].editProfessor.authStatus==3) {
  267. if($da[i].editProfessor.authentication == 1) {
  268. $add.find(".modicon").addClass("authicon2 authicon-mana");
  269. //$add.find(".modicon").html("<span style='top:35%'>科研</span>");
  270. } else if($da[i].editProfessor.authentication == 2) {
  271. $add.find(".modicon").addClass("authicon2 authicon-staff");
  272. //$add.find(".modicon").html("<span style='top:35%'>企业</span>");
  273. } else {
  274. $add.find(".modicon").addClass("authicon2 authicon-stu");
  275. //$add.find(".modicon").html("<span style='top:35%'>学生</span>");
  276. }
  277. }
  278. }
  279. if(data.data.data[i].images.length) {
  280. $add.find(".resourceImg").attr("src", "/images/resource/" + $da[i].resourceId + ".jpg");
  281. } else {
  282. $add.find(".resourceImg").attr("src", "/images/default-resource.jpg");
  283. }
  284. }
  285. if(isbind == true) {
  286. $(".tcdPageCode").createPage({
  287. pageCount: Math.ceil(data.data.total / pageSize),
  288. current: data.data.pageNo,
  289. backFn: function(p) {
  290. getData(key, subject, industry, pageSize, p, false);
  291. }
  292. });
  293. }
  294. } else {
  295. $.MsgBox.Alert("消息提醒", "请先登录再进行咨询");
  296. $("#mb_btn_ok").val("去登录");
  297. }
  298. //资源中点击咨询
  299. //$(".consultbtn").bind("click",clickResouceConsultHandler);
  300. },
  301. });
  302. }
  303. }
  304. $(".about").on("click", '.consultbtn', function(e) {
  305. e.stopPropagation(); //阻止事件冒泡,影响点击咨询
  306. e.cancelBubble = true; // ie下阻止冒泡
  307. clickResouceConsultHandler($(this), $(this).attr('id'));
  308. });
  309. var subjectList = function() {
  310. $.get("../ajax/dataDict/qaDictCode", {
  311. dictCode: "SUBJECT"
  312. }, function(data) {
  313. if(data.success) {
  314. console.log(data);
  315. /*if (data.data.length <= 10) {
  316. $(".andmore").eq(0).hide();
  317. }*/
  318. $("#subject").find(".sub").remove();
  319. for(var i = 0; i < data.data.length; i++) {
  320. $("#subject").append(
  321. "<a href='#' class='sub'title='" +
  322. data.data[i].caption + "'>" +
  323. data.data[i].caption + "</a>");
  324. if(subb) {
  325. if(subb == data.data[i].caption) {
  326. $('.sub').eq(i).addClass('colorbg').siblings()
  327. .removeClass("colorbg");
  328. }
  329. }
  330. if(i > 20)
  331. break;
  332. }
  333. } else {
  334. $.MsgBox.Alert("message", data.msg);
  335. }
  336. })
  337. }
  338. var Address = function() {
  339. $.get("../ajax/dataDict/qaCity", {
  340. dictCode: "ADDRESS"
  341. }, function(data) {
  342. if(data.success) {
  343. $("#address").empty();
  344. $("#address").prepend('<a href="#" class="colorbg no3" title="">不限</a>');
  345. /*if (data.data.length <= 10) {
  346. $(".andmore").eq(2).hide();
  347. }*/
  348. for(var i = 0; i < data.data.length; i++) {
  349. $("#address").append(
  350. "<a href='#' title='" + data.data[i].caption + "'>" +
  351. data.data[i].caption + "</a>");
  352. if(i > 20)
  353. break;
  354. }
  355. } else {
  356. $.MsgBox.Alert("message", data.msg);
  357. }
  358. })
  359. }
  360. var industryList = function() {
  361. $.get("../ajax/dataDict/qaDictCode", {
  362. dictCode: "INDUSTRY"
  363. }, function(data) {
  364. console.log(data);
  365. if(data.success) {
  366. /*if (data.data.length <= 10) {
  367. $(".andmore").eq(1).hide();
  368. }*/
  369. $("#industry").find(".indu").remove();
  370. for(var i = 0; i < data.data.length; i++) {
  371. $("#industry").append(
  372. "<a href='#' class='indu'title='" +
  373. data.data[i].caption + "'>" +
  374. data.data[i].caption + "</a>");
  375. if(i > 20)
  376. break;
  377. }
  378. } else {
  379. $.MsgBox.Alert("message", data.msg);
  380. }
  381. })
  382. }
  383. var findProfessor = function() {
  384. if(subb) {
  385. subject = subb;
  386. } else {
  387. subject = $("#subject .colorbg")[0].title;
  388. }
  389. industry = $("#industry .colorbg")[0].title;
  390. pageSize = 10;
  391. getData(key, subject, industry, pageSize, 1, true, address);
  392. }
  393. // enter键搜索
  394. function synContent(type) {
  395. if(type == 1) {
  396. $("#searchContent").val($("#hsearchContent").val());
  397. } else {
  398. $("#hsearchContent").val($("#searchContent").val());
  399. }
  400. }
  401. $("#hsearchContent").blur(function() {
  402. synContent(1);
  403. });
  404. $("#searchContent").blur(function() {
  405. synContent(2);
  406. });
  407. $("#searchContent").keydown(function(e) {
  408. if(e.which == 13) {
  409. synContent(2);
  410. key = $("#searchContent").val();
  411. $("#professorList").remove();
  412. $(".aboutpro").append(
  413. '<div class="about-in" id="professorList"></div>')
  414. $(".tcdPageCode").remove();
  415. $(".aboutpro").append('<div class="tcdPageCode"></div>');
  416. getData(key, subject, industry, 10, 1, true, address);
  417. }
  418. })
  419. $("#hsearchContent").keydown(function(e) {
  420. if(e.which == 13) {
  421. synContent(1);
  422. key = $("#searchContent").val();
  423. $("#professorList").remove();
  424. $(".aboutpro").append(
  425. '<div class="about-in" id="professorList"></div>')
  426. $(".tcdPageCode").remove();
  427. $(".aboutpro").append('<div class="tcdPageCode"></div>');
  428. getData(key, subject, industry, 10, 1, true, address);
  429. }
  430. })
  431. $("#search1").on(
  432. "click",
  433. function() {
  434. $("#hsearchContent").val($("#searchContent").val());
  435. key = $("#searchContent").val();
  436. $("#professorList").remove();
  437. $(".aboutpro").append(
  438. '<div class="about-in" id="professorList"></div>')
  439. $(".tcdPageCode").remove();
  440. $(".aboutpro").append('<div class="tcdPageCode"></div>');
  441. getData(key, subject, industry, 10, 1, true, address);
  442. })
  443. $("#hsearch1").on(
  444. "click",
  445. function() {
  446. $("#searchContent").val($("#hsearchContent").val());
  447. key = $("#hsearchContent").val();
  448. $("#professorList").remove();
  449. $(".aboutpro").append(
  450. '<div class="about-in" id="professorList"></div>')
  451. $(".tcdPageCode").remove();
  452. $(".aboutpro").append('<div class="tcdPageCode"></div>');
  453. getData(key, subject, industry, 10, 1, true, address);
  454. })
  455. subjectList();
  456. industryList();
  457. findProfessor();
  458. Address();
  459. $(".class1").eq(0).on(
  460. "click",
  461. "a",
  462. function() {
  463. $(this).addClass("colorbg").siblings().removeClass("colorbg");
  464. key = $("#searchContent").val();
  465. subject = $(this).attr('title');
  466. $("#professorList").remove();
  467. $(".aboutpro").append(
  468. '<div class="about-in" id="professorList"></div>')
  469. $(".tcdPageCode").remove();
  470. $(".aboutpro").append('<div class="tcdPageCode"></div>');
  471. getData(key, subject, industry, 10, 1, true, address);
  472. });
  473. $(".class1").eq(1).on(
  474. "click",
  475. "a",
  476. function() {
  477. $(this).addClass("colorbg").siblings().removeClass("colorbg");
  478. industry = $(this).attr('title');
  479. key = $("#searchContent").val();
  480. $("#professorList").remove();
  481. $(".aboutpro").append(
  482. '<div class="about-in" id="professorList"></div>')
  483. $(".tcdPageCode").remove();
  484. $(".aboutpro").append('<div class="tcdPageCode"></div>');
  485. getData(key, subject, industry, 10, 1, true, address);
  486. });
  487. $(".class1").eq(2).on(
  488. "click",
  489. "a",
  490. function() {
  491. $(this).addClass("colorbg").siblings().removeClass("colorbg");
  492. address = $(this).attr('title');
  493. key = $("#searchContent").val();
  494. $("#professorList").remove();
  495. $(".aboutpro").append(
  496. '<div class="about-in" id="professorList"></div>')
  497. $(".tcdPageCode").remove();
  498. $(".aboutpro").append('<div class="tcdPageCode"></div>');
  499. getData(key, subject, industry, 10, 1, true, address);
  500. });
  501. /* 搜索分类展开 */
  502. var listi = 0;
  503. $(".andmore").click(function() {
  504. $(this).find(".updown").css("background-position", "left");
  505. $(this).parent().css("height", "48px");
  506. if(listi % 2 == 0) {
  507. } else {
  508. $(this).find(".updown").css("background-position", "right");
  509. $(this).parent().css("height", "auto");
  510. }
  511. listi++;
  512. })
  513. /*搜索分类背景切换*/
  514. $(".class1").on("click", "a", function() {
  515. $(this).addClass("colorbg").siblings().removeClass("colorbg");
  516. })
  517. /*专家、资源菜单切换*/
  518. // $(".lookwho").change(function(){
  519. // //$(this).addClass("tabcurrent").siblings().removeClass("tabcurrent");
  520. // //$(".aboutcon").eq($(this).index()).show().siblings().hide();
  521. // if($(this).value == "0"){
  522. // $(".aboutpro").show();
  523. // $(".aboutresou").hide();
  524. // }
  525. // else{
  526. // $(".aboutresou").show();
  527. // $(".aboutpro").hide();
  528. // }
  529. //
  530. // })
  531. //判断是搜寻专家还是资源
  532. $(".lishow li").on(
  533. "click",
  534. function() {
  535. c = $(this).index();
  536. $("#industry").find(".no2").addClass("colorbg").siblings()
  537. .removeClass("colorbg");
  538. $("#subject").find(".nox").addClass("colorbg").siblings()
  539. .removeClass("colorbg");
  540. key = $("#searchContent").val();
  541. industry = "";
  542. subject = "";
  543. address = "";
  544. if(c == 0) {
  545. sub = "SUBJECT";
  546. indu = "INDUSTRY";
  547. } else {
  548. sub = "SUBJECT";
  549. indu = "INDUSTRY";
  550. }
  551. industryList();
  552. subjectList();
  553. Address();
  554. $("#professorList").remove();
  555. $(".aboutpro").append(
  556. '<div class="about-in" id="professorList"></div>')
  557. $(".tcdPageCode").remove();
  558. $(".aboutpro").append('<div class="tcdPageCode"></div>');
  559. getData(key, subject, industry, pageSize, 1, true, address);
  560. });
  561. // 查询资源详细信息
  562. $('.about')
  563. .on(
  564. "click",
  565. '.remess',
  566. function() {
  567. var resourceID = $(this).attr("resourceId");
  568. location.href = "resourceInfo.html?resourceId=" + resourceID;
  569. //ResourceMessage();
  570. // $
  571. // .ajax({
  572. // "url": "/ajax/resource/" + resourceID,
  573. // "type": "get",
  574. // "async": true,
  575. // "success": function(info) {
  576. // if(info.success) {
  577. // $("#resourceName").text(
  578. // info.data.resourceName);
  579. // $("#supportedServices")
  580. // .text(
  581. // info.data.supportedServices);
  582. // $("#hopePayMethod").text(
  583. // info.data.hopePayMethod);
  584. // $("#cooperationNotes").text(
  585. // info.data.cooperationNotes);
  586. // $("#subject").text(
  587. // info.data.subject);
  588. // $("#industry").text(
  589. // info.data.industry);
  590. // $("#descp").text(info.data.descp);
  591. // $("#professor").text(
  592. // info.data.professor.name);
  593. // $(".resouImage").attr(
  594. // "src",
  595. // "/images/resource/" +
  596. // resourceID +
  597. // ".jpg");
  598. // $(".resouImage")
  599. // .load(function() {})
  600. // .error(
  601. // function() {
  602. // $(this)
  603. // .attr(
  604. // "src",
  605. // "/images/default-resource.jpg");
  606. // });
  607. // limitHeight();
  608. // } else {
  609. // $.MsgBox.Alert('消息提醒', "系统异常!");
  610. // }
  611. // },
  612. // "error": function() {
  613. // $.MsgBox.Alert('message', 'failed')
  614. // }
  615. // });
  616. })
  617. // 资源申请
  618. function getIdentity(professorId) {
  619. $
  620. .ajax({
  621. "url": "ajax/professor/" + professorId,
  622. "type": "get",
  623. "async": false,
  624. "success": function(data) {
  625. if(data.success) {
  626. $(".frmtype option")[0].value = data.data.name;
  627. $(".frmtype option")[1].value = data.data.organization.name;
  628. } else {
  629. $.MsgBox.Alert("消息提醒", "系统异常!");
  630. }
  631. },
  632. "error": function() {
  633. $.MsgBox.Alert('message', 'failddd')
  634. }
  635. })
  636. }
  637. function replaceStr(s) {
  638. var pattern = new RegExp("-");
  639. var rs = "";
  640. for(var i = 0; i < s.length; i++) {
  641. rs = rs + s.substr(i, 1).replace(pattern, '');
  642. }
  643. return rs;
  644. }
  645. $('.aboutpro')
  646. .on(
  647. "click",
  648. '.appl',
  649. function() {
  650. ResourceApply(); // 调用资源申请HTML创建函数
  651. $(".limitBox").removeClass("limitBox");
  652. $(".limitwords").removeClass("limitwords");
  653. $(".limitwordbox").removeClass("limitwordbox");
  654. // 获取当前时间并且格式化时间
  655. var myDate = new Date();
  656. var nowYear = myDate.getFullYear();
  657. var nowMonth = myDate.getMonth() + 1;
  658. var nowDate = myDate.getDate();
  659. if(nowMonth < 10) {
  660. nowMonth = "0" + nowMonth.toString();
  661. }
  662. if(nowDate < 10) {
  663. nowDate = "0" + nowDate.toString();
  664. }
  665. var now = nowYear + "-" + nowMonth + "-" + nowDate;
  666. $("#datepicker").val(now);
  667. $("#datepicker").datepicker({
  668. "dateFormat": " yy-mm-dd"
  669. });
  670. $(".timelo").css("display", "none");
  671. var resName = $(this).attr("resourcename");
  672. var name = $(this).attr("professor");
  673. var resourceID = $(this).attr("resourceId");
  674. $
  675. .ajax({
  676. "url": "/ajax/resource/" + resourceID,
  677. "type": "get",
  678. "async": false,
  679. "success": function(info) {
  680. if(info.success) {
  681. if(info.data.images.length) {
  682. $(".resouImage").attr(
  683. "src",
  684. "/images/resource/" +
  685. resourceID +
  686. ".jpg");
  687. } else {
  688. $(".resouImage")
  689. .attr("src",
  690. "/images/default-resource.jpg");
  691. }
  692. }
  693. }
  694. })
  695. $(".namecon").text(name);
  696. $(".applysure").hide();
  697. $(".btnboxup").hide();
  698. $(".log").text(resName);
  699. getIdentity(userid);
  700. $("#deliver")
  701. .on(
  702. "click",
  703. function() {
  704. var $data = {};
  705. $data.demandId = userid;
  706. $data.resourceId = resourceID;
  707. $data.detailDemand = $(".detail")
  708. .val();
  709. // 去除时间里面的- 和字符串前后的空格
  710. $data.deliverTime = replaceStr($
  711. .trim($(".dealTime").val()));
  712. $data.operationStatus = 1;
  713. $data.applysquare = $(
  714. ".frmtype option:selected")
  715. .val();
  716. $
  717. .ajax({
  718. "url": "/ajax/operation",
  719. "type": "POST",
  720. "success": function(
  721. rdata) {
  722. if(rdata.success) {
  723. $.MsgBox
  724. .Alert(
  725. '消息提醒',
  726. '资源"' +
  727. resName +
  728. '"申请发送成功!');
  729. $(".blackcover")
  730. .remove();
  731. $("body")
  732. .css(
  733. "position",
  734. "");
  735. // location.reload(true);
  736. } else {
  737. $.MsgBox
  738. .Alert(
  739. '消息提醒',
  740. '资源"' +
  741. resName +
  742. '"申请发送失败,请重新申请!');
  743. }
  744. },
  745. "data": $data,
  746. "beforeSend": function() { /* console.log(this.data) */ },
  747. "contentType": "application/x-www-form-urlencoded",
  748. dataType: "json"
  749. });
  750. });
  751. });
  752. // 找专家中 点击咨询处理函数
  753. function clickSeachProConsultHandler() {
  754. if(userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
  755. var professorId = $(this).attr("id");
  756. ConsultApply();
  757. //点击的发送
  758. $("#sendConsultBtn").click(function() {
  759. sendConsultHandler($(this).attr("proId"))
  760. });
  761. concultProInfo(professorId);
  762. } else {
  763. $.MsgBox.Alert("消息提醒", "请先登录再进行咨询");
  764. $("#mb_btn_ok").val("去登录");
  765. var aele = document.createElement('a');
  766. $("#mb_btnbox").append(aele);
  767. $("#mb_btnbox a").css({
  768. 'display': "block",
  769. 'width': '100%',
  770. 'height': '40px',
  771. 'position': 'absolute',
  772. 'bottom': '-6px',
  773. 'left': '0'
  774. });
  775. aele.setAttribute('href', '../login.html');
  776. }
  777. };
  778. //找资源中 点击咨询 obj点击对象
  779. function clickResouceConsultHandler(obj, professorId) {
  780. if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
  781. // var professorId = $(this).attr("id");
  782. ConsultApply();
  783. //默认选中资源咨询和标题
  784. for(var i = 0; i < $("ul.menucon").children().length; i++) {
  785. $("ul.menucon").children().eq(i).removeClass("clicknow");
  786. $("ul.menucon").children().eq(1).addClass("clicknow");
  787. }
  788. var item = obj.parent().parent().parent();
  789. var consultTitleVal = item.find(".resouname").text();
  790. $("#consultTitle").val("关于" + consultTitleVal + "的咨询");
  791. //点击的发送
  792. $("#sendConsultBtn").click(function() {
  793. sendConsultHandler($(this).attr("proId")); //common.js中
  794. });
  795. concultProInfo(professorId); //common.js中
  796. } else {
  797. $.MsgBox.Alert("消息提醒", "请先登录再进行咨询");
  798. $("#mb_btn_ok").val("去登录");
  799. var aele = document.createElement('a');
  800. $("#mb_btnbox").append(aele);
  801. $("#mb_btnbox a").css({
  802. 'display': "block",
  803. 'width': '100%',
  804. 'height': '40px',
  805. 'position': 'absolute',
  806. 'bottom': '-6px',
  807. 'left': '0'
  808. });
  809. aele.setAttribute('href', '../login.html');
  810. }
  811. };
  812. /* function sendConsultHandler(){
  813. var professorId = $(this).attr("proId");
  814. var consult_type = $(".clicknow").text();//咨询类型
  815. var consult_title = $("#consultTitle").val();//咨询主题
  816. var consult_content = $("#consultcontent").val();//咨询内容
  817. var consultStr = {
  818. "consultType":consult_type,
  819. "consultTitle":consult_title,
  820. "consultContant":consult_content,
  821. "professorId":professorId,
  822. "consultantId":userid
  823. };
  824. if(consult_type == '' || consult_title == '' || consult_content == ''){
  825. $.MsgBox.Alert("message","请填写完整");
  826. };
  827. if(consult_type == ''){
  828. $.MsgBox.Alert("消息","请选择联系目的");
  829. }
  830. if(consult_title == ''){
  831. $.MsgBox.Alert("消息","请填写咨询目的");
  832. }
  833. if(consult_content == ''){
  834. $.MsgBox.Alert("消息","请填写咨询内容");
  835. }
  836. if(userid && userid != null && userid != "null" && consult_type != '' &&
  837. consult_title != '' && consult_content != ''
  838. ){
  839. $.ajax({
  840. "url" :"/ajax/consult",
  841. "type" : "post",
  842. //传值:咨询类型、主题、内容、专家id、申请人id
  843. "data" : consultStr,
  844. "contentType" : "application/x-www-form-urlencoded",
  845. "dataType" : "json",
  846. "success" : function(response) {
  847. consultId = response.data;//咨询id
  848. },
  849. "error":function (){
  850. $.MsgBox.Alert("消息","咨询申请失败");
  851. },
  852. "complete":function(){
  853. //$(".consultapply").remove();
  854. $(".blackcover").remove();
  855. $("body").css("position","");
  856. $.MsgBox.Alert("消息","咨询申请成功");
  857. },
  858. });
  859. }
  860. }*/
  861. });