portal html css js resource

search.js 28KB

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