portal html css js resource

workindex.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. $(function() {
  2. var userid = $.cookie("userid");
  3. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  4. $(".workmenu>ul>li").eq(0).addClass("nowLi");
  5. loginStatus();//判断个人是否登录
  6. valUser();
  7. var oAuthType=0;
  8. /*工作台专家的数据*/
  9. getProfessorData(userid);
  10. /*工作台未读的咨询消息*/
  11. queryUnreadConsultFn(userid);
  12. /*工作台最新咨询*/
  13. getConsultData(userid);
  14. /*工作台最新回复*/
  15. getReplyData(userid);
  16. /*工作台我的资源*/
  17. // getDataResource();
  18. /*工作台我的文章*/
  19. // myNews();
  20. /*最新回复中的发送*/
  21. $("#myFlatSendReplyBtn").bind("click", newReplySendFn);
  22. /*点击未读咨询消息查看*/
  23. $("#lookMyConsult").on("click", function() {
  24. if(ifuser.authType2 == 0) {
  25. window.location.href = "myConsult.html";
  26. } else {
  27. window.location.href = "consult.html";
  28. }
  29. })
  30. /*点击未读咨询消息查看*/
  31. $("#lookconsu").on("click", function() {
  32. var consultid = $("#myFlatConsultTime").attr("consultid");
  33. window.location.href = "consultSure.html?consultid="+consultid;
  34. })
  35. function getProfessorData(professorId) {
  36. $.ajax({
  37. "url": "/ajax/professor/editBaseInfo/" + professorId,
  38. "type": "get",
  39. "async": true,
  40. "success": function(data) {
  41. if(data.success) {
  42. oAuthType=data.data.authType;
  43. //if(oAuthType==0){
  44. // $("#ponUm").text("个我正在发布的需求");
  45. // $("#searchDemand").text(">>点击查看");
  46. demandNumMy();
  47. if(oAuthType==1){
  48. $("#consultf").removeClass("nohide")
  49. // demandNum();
  50. }
  51. $("#nameS").text(data.data.name);
  52. $("#allConsultCount").text(data.data.consultCount);
  53. var oSty=autho(data.data.authType,data.data.orgAuth,data.data.authStatus);
  54. $("#nameIcon").addClass(oSty.sty);
  55. $("#nameIcon").attr("title",oSty.title);
  56. if(data.data.office) {
  57. if(data.data.title) {
  58. $("#office").text(data.data.office + ",");
  59. } else {
  60. $("#office").text(data.data.office);
  61. }
  62. }
  63. if(data.data.title) {
  64. $("#title").text(data.data.title);
  65. }
  66. if(data.data.department) {
  67. if(data.data.orgName) {
  68. $("#department").text(data.data.department + ",");
  69. } else {
  70. $("#department").text(data.data.department);
  71. }
  72. }
  73. if(data.data.orgName) {
  74. $("#organization").text(data.data.orgName);
  75. }
  76. if(data.data.address) {
  77. $("#address").text(data.data.address);
  78. }
  79. if(data.data.hasHeadImage) {
  80. $(".imgProfess").attr("src", "/images/head/" + userid + "_l.jpg");
  81. } else {
  82. $(".imgProfess").attr("src", "/images/default-photo.jpg");
  83. }
  84. var startLeval = parseInt(data.data.starLevel);
  85. for(var i = 0; i < startLeval; i++) {
  86. $(".evastar2").eq(i).addClass("startStyle");
  87. }
  88. } else {
  89. $.MsgBox.Alert("消息", "获取专家数据失败!");
  90. }
  91. },
  92. "error": function() {
  93. $.MsgBox.Alert('message', '获取专家数据失败')
  94. }
  95. })
  96. }
  97. function queryUnreadConsultFn(professorId) {
  98. var params = {
  99. "professorId": professorId
  100. };
  101. $.ajax({
  102. "url": "/ajax/consult/qaReadStatus",
  103. "type": "get",
  104. "async": false,
  105. "data": params,
  106. "success": function(response) {
  107. $("#unreadConsult").html(response["data"]);
  108. },
  109. "error": function() {
  110. $.MsgBox.Alert('message', '总的未读咨询条数请求失败');
  111. }
  112. });
  113. };
  114. function getConsultData(professorId) {
  115. var params = {
  116. "professorId": professorId
  117. };
  118. $.ajax({
  119. "url": "/ajax/consult/qaNewConsult",
  120. "type": "get",
  121. "async": false,
  122. "data": params,
  123. "success": function(response) {
  124. if(response.success) {
  125. if(response.data != null) {
  126. var newConsultData = response["data"];
  127. $("#myFlatConsultTime").attr("consultId", newConsultData["consultId"]);
  128. $("#myFlatProName").text(newConsultData["professor"]["name"]);
  129. if(newConsultData["professor"]["office"]) {
  130. $("#myReplyProOffice").html(newConsultData["professor"]["office"] + ",");
  131. }
  132. if(newConsultData["professor"]["title"]) {
  133. $("#myReplyProTitle").html(newConsultData["professor"]["title"]);
  134. }
  135. if(newConsultData["professor"]["department"]) {
  136. $("#myReplyProDepartment").html(newConsultData["professor"]["department"] + ",");
  137. }
  138. if(newConsultData["professor"]["orgName"]) {
  139. $("#myReplyProOrgName").html(newConsultData["professor"]["orgName"]);
  140. }
  141. if(newConsultData["professor"]["address"]) {
  142. $("#myReplyAddress").html(newConsultData["professor"]["address"]);
  143. }
  144. $("#myFlatConsultTime").html(newConsultData["createTime"].substr(0, 4) + "-" + newConsultData["createTime"].substr(4, 2) + "-" + newConsultData["createTime"].substr(6, 2) + " " +
  145. newConsultData["createTime"].substr(8, 2) + ":" + newConsultData["createTime"].substr(10, 2));
  146. $("#myFlatConsultTitle").html(newConsultData["consultTitle"]);
  147. $("#myFlatConsultContent").html(newConsultData["consultContant"]);
  148. if(response.data.professor.hasHeadImage) {
  149. $("#proImage").attr("src", "images/head/" + response.data.professor.id + "_m.jpg");
  150. } else {
  151. $("#proImage").attr("src", "images/default-photo.jpg");
  152. }
  153. $("#imgusr").attr("href", "userInforShow.html?professorId="+response.data.professor.id);
  154. } else {
  155. $("#wbcon1").empty("");
  156. var height = $("#repalyf").outerHeight(true);
  157. $("#wbcon1").append('<span id="wbcen">暂无最新咨询消息</span>').css("height", height);
  158. var oHeight = ($("#wbcon1").height() - $("#wbcen").height()) / 2;
  159. $("#wbcen").css({
  160. "color": "#999",
  161. "display": "block",
  162. "margin-top": oHeight,
  163. "text-align": "center"
  164. });
  165. }
  166. } else {
  167. $.MsgBox.Alert("消息", "最新咨询数据请求失败");
  168. }
  169. },
  170. "error": function() {
  171. $.MsgBox.Alert('message', '最新咨询数据请求失败');
  172. }
  173. })
  174. }
  175. function getReplyData(consultantId) {
  176. var params = {
  177. "consultantId": consultantId
  178. };
  179. $.ajax({
  180. "url": "/ajax/tidings/qaNewReply",
  181. "type": "get",
  182. "async": true,
  183. "data": params,
  184. "success": function(response) {
  185. if(response.success) {
  186. if(response["data"] != null) {
  187. var newReplyData = response["data"];
  188. $("#myFlatRelpyTime").attr("consultId", newReplyData["consult"]["consultId"]);
  189. $("#myFlatReplyProName").html(newReplyData["professor"]["name"]);
  190. if(newReplyData["professor"]["office"]) {
  191. $("#myProOffice").html(newReplyData["professor"]["office"] + ",");
  192. }
  193. if(newReplyData["professor"]["title"]) {
  194. $("#myProTitle").html(newReplyData["professor"]["title"]);
  195. }
  196. if(newReplyData["professor"]["department"]) {
  197. $("#myProDepartment").html(newReplyData["professor"]["department"] + ",");
  198. }
  199. if(newReplyData["professor"]["orgName"]) {
  200. $("#myProOrgName").html(newReplyData["professor"]["orgName"]);
  201. }
  202. if(newReplyData["professor"]["address"]) {
  203. $("#myAddress").html(newReplyData["professor"]["address"]);
  204. }
  205. $("#myFlatRelpyTime").html(newReplyData["createTime"].substr(0, 4) + "-" + newReplyData["createTime"].substr(4, 2) + "-" + newReplyData["createTime"].substr(6, 2) + " " +
  206. newReplyData["createTime"].substr(8, 2) + ":" + newReplyData["createTime"].substr(10, 2));
  207. $("#myFlatRelpyTitle").html(newReplyData["consult"]["consultTitle"]);
  208. $("#myFlatRelpyContent").html(newReplyData["tidingsContant"]);
  209. if(response.data.professor.hasHeadImage) {
  210. $("#proreplayImage").attr("src", "images/head/" + response.data.professor.id + "_m.jpg");
  211. } else {
  212. $("#proreplayImage").attr("src", "images/default-photo.jpg");
  213. }
  214. $("#imgusr2").attr("href", "userInforShow.html?professorId="+response.data.professor.id);
  215. } else {
  216. $("#wbcon2").empty("")
  217. var height = $("#wbcon1").outerHeight(true);
  218. $("#wbcon2").append('<span id="wbcent">暂无最新回复消息</span>').css("height", height);
  219. var oHeight = ($("#wbcon2").height() + 16 - $("#wbcent").height()) / 2;
  220. $("#wbcent").css({
  221. "color": "#999",
  222. "display": "block",
  223. "margin-top": oHeight,
  224. "text-align": "center"
  225. });
  226. }
  227. } else {
  228. $.MsgBox.Alert('message', '最新回复数据请求失败');
  229. }
  230. },
  231. "error": function() {
  232. $.MsgBox.Alert('message', '最新回复数据请求失败');
  233. }
  234. })
  235. }
  236. function newReplySendFn() {
  237. var consultId = $("#myFlatRelpyTime").attr("consultId");
  238. var consultCon = $("#myFlatReplyCon").val();
  239. var params = {
  240. "tidingsContant": consultCon,
  241. "consultId": consultId,
  242. "senderId": userid
  243. }
  244. $.ajax({
  245. url: "/ajax/tidings",
  246. type: "post",
  247. async: false,
  248. "contentType": "application/x-www-form-urlencoded",
  249. data: params,
  250. success: function(response) {
  251. getReplyData(userid);
  252. },
  253. error: function(error) {
  254. }
  255. });
  256. // $.MsgBox.Alert("消息","回复成功!");
  257. $("#myFlatReplyCon").val("");
  258. };
  259. // function getDataResource() {
  260. // $.ajax({
  261. // "url": "/ajax/resource/qaForDesk",
  262. // "type": "get",
  263. // "async": true,
  264. // "data": {
  265. // "professorId": userid
  266. // },
  267. // "success": function(data) {
  268. // if(data.success) {
  269. // var add = '';
  270. // $("#consdcen").html("");
  271. // for(var i = 0; i < data.data.length; i++) {
  272. // var add = '<div class="addworkbtn-list"><a href="resourceShow.html?resourceId=' + data.data[i].resourceId + '"><div class="resoumag">'
  273. // add += '<div class="ResImgBox" style="max-width:200px;width:200px;height: 200px;"><img class="resImg headRadius resourceImg" src="" /></div>'
  274. // add += '<h2>' + data.data[i].resourceName + '</h2>'
  275. // add += '<p>' + data.data[i].supportedServices + '</p>'
  276. // add += '</div></a></div>';
  277. // $add = $(add);
  278. //
  279. // $("#consdcen").append($add);
  280. //
  281. // if(data.data[i].subject == undefined) {
  282. // $(".li1").eq(i).css({
  283. // "display": "none"
  284. // });
  285. // }
  286. //
  287. // $add.find('.resoumag').attr("resourceId", data.data[i].resourceId);
  288. //
  289. // //$('.resoumag').eq(i+1).attr("resourceId",data.data[i].resourceId);
  290. // if(data.data[i].images.length) {
  291. // $add.find(".resourceImg").attr("src", "/data/resource/" + data.data[i].images[0].imageSrc);
  292. // } else {
  293. // $add.find(".resourceImg").attr("src", "/images/default-resource.jpg");
  294. // }
  295. // }
  296. //
  297. // $(".addworkbtn-list:gt(2)").css({
  298. // "display": "none"
  299. // });
  300. //
  301. // } else {
  302. // $.MsgBox.Alert('message', "系统异常!");
  303. // }
  304. // },
  305. // "error": function() {
  306. // $.MsgBox.Alert('message', 'failed')
  307. // }
  308. // });
  309. // }
  310. // function myNews() {
  311. // $.ajax({
  312. // "url": "/ajax/article/qaForDesk",
  313. // "type": "get",
  314. // "async": true,
  315. // "data": {
  316. // "professorId": userid
  317. // },
  318. // "success": function(data) {
  319. // if(data.success) {
  320. //
  321. // var add = '';
  322. // $("#myNews").html("");
  323. // for(var i = 0; i < data.data.length; i++) {
  324. // var add = '<li><a href="articalShow.html?articleId=' + data.data[i].articleId +'">'
  325. // add += '<div class="art_topicBox"><div class="art_img" style=""></div>'
  326. // add += '<div class="art_tbox"><h6 id="artical_topic" >' + data.data[i].articleTitle + '</h6></div>'
  327. // add += '</div><div class="tagsBox"><span></span></div>'
  328. // add += '</a></li>';
  329. // $add = $(add);
  330. // $("#myNews").append($add);
  331. // $add.find('.tagsBox span').text(data.data[i].subject);
  332. // if(data.data[i].articleImg) {
  333. // $add.find(".art_img").attr("style", "background: url(/data/article/" + data.data[i].articleImg + ") 0 0 no-repeat;background-size:cover;");
  334. // }
  335. // }
  336. // $("#myNews li:gt(2)").css({
  337. // "display": "none"
  338. // });
  339. // } else {
  340. // $.MsgBox.Alert('消息', "链接服务器超时!");
  341. // }
  342. // },
  343. // "error": function() {
  344. // $.MsgBox.Alert('消息', '链接服务器超时!')
  345. // }
  346. // });
  347. // }
  348. $("#dett,#searchDemand").click(function(){
  349. location.href="myDemand.html"
  350. // if(oAuthType==0){
  351. // location.href="myDemand.html"
  352. // }else if(oAuthType==1){
  353. // location.href="needList.html"
  354. // }
  355. })
  356. /*登录者需求的数量*/
  357. function demandNumMy(){
  358. $.ajax({
  359. "url":"/ajax/demand/qc" ,
  360. "type": "get",
  361. "async": true,
  362. "data":{
  363. "state":1,
  364. "uid": userid
  365. },
  366. "success": function(data) {
  367. if(data.success) {
  368. $("#demandNumber").text(data.data)
  369. } else {
  370. $.MsgBox.Alert('消息', data.msg);
  371. }
  372. },
  373. "error": function(x) {
  374. $.MsgBox.Alert('消息', '链接服务器超时!')
  375. }
  376. });
  377. }
  378. // function demandNum(){
  379. // $.ajax({
  380. // "url":"/ajax/demand/qc" ,
  381. // "type": "get",
  382. // "async": true,
  383. // "success": function(data) {
  384. //
  385. // if(data.success) {
  386. // $("#demandNumber").text(data.data)
  387. // } else {
  388. // $.MsgBox.Alert('消息', data.msg);
  389. // }
  390. // },
  391. // "error": function() {
  392. // $.MsgBox.Alert('消息', '链接服务器超时!')
  393. // }
  394. // });
  395. // }
  396. });