portal html css js resource

search.js 28KB

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