portal html css js resource

search.js 28KB

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