portal html css js resource

workindex.js 12KB

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