portal html css js resource

demandShow.js 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. $(document).ready(function() {
  2. loginStatus(); //判断个人是否登录
  3. var userid=$.cookie("userid");
  4. var demandId = GetQueryString("demandId");
  5. var consuId, demandTitle, demandContent;
  6. getDemandinfo();
  7. pageViewLog(demandId,7)
  8. ifcollectionAbout(demandId,$("#collectBtn"), 7)
  9. $("#collectBtn").on("click",function() {
  10. if(userid && userid != "null" && userid != null) {
  11. if($(this).is('.icon-collected')) {
  12. cancelCollectionAbout(demandId,$(this), 7);
  13. } else {
  14. collectionAbout(demandId,$(this), 7);
  15. }
  16. } else {
  17. quickLog();
  18. operatTab();
  19. closeLog();
  20. }
  21. })
  22. //点击关注按钮
  23. $(".goSpan").on('click',"span.attenSpan", function() {
  24. var cId=$(this).parent().siblings("a").attr("data-id");
  25. if(userid && userid != null && userid != "null") {
  26. if($(this).is('.attenedSpan')){
  27. cancelCollectionAbout(cId, $(this),6)
  28. } else {
  29. collectionAbout(cId, $(this),6);
  30. }
  31. }else{
  32. quickLog();
  33. operatTab();
  34. closeLog();
  35. }
  36. });
  37. $(".showStatus").on('click',".meSendBack",function(){
  38. if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
  39. location.href="tidings.html?id="+consuId
  40. } else {
  41. quickLog();
  42. operatTab();
  43. closeLog();
  44. }
  45. });
  46. $("#expertli").on("click","li",function(){
  47. var dataId=$(this).attr("data-id");
  48. location.href="userInforShow.html?professorId="+dataId;
  49. })
  50. function getDemandinfo(){
  51. $.ajax({
  52. "url": "/ajax/demand/qo",
  53. "type": "GET",
  54. "data": {
  55. "id": demandId
  56. },
  57. "dataType": "json",
  58. "success": function(data) {
  59. console.log(data);
  60. if(data.success) {
  61. var $da=data.data;
  62. $("#demandTit").text($da.title); //名字
  63. var thisNum="";
  64. thisNum+='<li><span>'+commenTime($da.createTime)+'</span></li>';
  65. if($da.pageViews!=0){
  66. thisNum+='<li><span>浏览量</span> <span>'+$da.pageViews+'</span></li>';
  67. }
  68. $("#demandNum").prepend(thisNum);
  69. $("#demandDesp")[0].innerText=$da.descp; //内容
  70. var weibopic = "http://" + window.location.host + "/images/default-paper.jpg"
  71. var weibotitle = $da.title;
  72. var weibourl = window.location.href;
  73. $("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+encodeURIComponent(weibotitle)+"&url="+encodeURIComponent(weibourl)+"&pic="+encodeURIComponent(weibopic)+"&content=utf-8"+"&ralateUid=6242830109&searchPic=false&style=simple");
  74. var demandTit = $da.title + "-科袖网";
  75. document.title = demandTit;
  76. var strCon="";
  77. if($da.city){ strCon+='<li>所在城市:'+$da.city+'</li>' }
  78. if($da.duration!=0){ strCon+='<li>预计周期:'+demandDuration[$da.duration]+'</li>' }
  79. if($da.cost!=0){ strCon+='<li>费用预算:'+demandCost[$da.cost]+'</li>' }
  80. if($da.invalidDay){ strCon+='<li>有效期至:'+TimeTr($da.invalidDay)+'</li>' }
  81. $(strCon).appendTo($("#demandInf"));
  82. if($da.state==0){
  83. $(".showStatus").html('已过期');
  84. }else if($da.state==1){
  85. if(userid==$da.creator){
  86. $(".showStatus").html('发布中');
  87. }else{
  88. $(".showStatus").html('<input type="button" class="frmconbtn btnModel meSendBack" value="立即回复">')
  89. }
  90. }else if($da.state==2){
  91. $(".showStatus").html('已完成');
  92. }else if($da.state==3){
  93. $(".showStatus").html('已关闭');
  94. }
  95. cmpFun($da.orgName);
  96. userFun($da.creator);
  97. consuId = $da.creator;
  98. demandTitle = $da.title;
  99. demandContent = $da.descp;
  100. }
  101. },
  102. 'error': function() {
  103. $.MsgBox.Alert('提示', '服务器连接超时!');
  104. }
  105. });
  106. }
  107. /*企业用户信息*/
  108. function cmpFun(par) {
  109. $.ajax({
  110. "url": "/ajax/org/queryByName",
  111. 'data': {
  112. name: par
  113. },
  114. "type": "get",
  115. "async": true,
  116. "success": function(data) {
  117. if(data.success) {
  118. if(data.data != null) {
  119. $(".goSpan").show();
  120. if(data.data.forShort) {
  121. $("#Qname").text(data.data.forShort);
  122. }else{
  123. $("#Qname").text(data.data.name);
  124. }
  125. var img="/images/default-icon.jpg";
  126. if(data.data.hasOrgLogo==1){
  127. img="/images/org/" + data.data.id + ".jpg";
  128. }
  129. if(data.data.industry) {
  130. $("#industry").text(data.data.industry.replace(/,/g, " | "));
  131. }
  132. $("#companyImg").attr("src",img);
  133. $("#companyImg").parents(".cmpHead").attr("href","cmpInforShow.html?orgId="+data.data.id);
  134. $("#companyImg").parents(".cmpHead").attr("data-id",data.data.id);
  135. $("#Qname").attr("href","cmpInforShow.html?orgId="+data.data.id);
  136. if(data.data.authStatus==3){
  137. $("#QauthFlag").addClass("authicon-com-ok").attr("title","科袖认证企业")
  138. }
  139. if(userid){
  140. ifcollectionAbout(data.data.id,$(".goSpan").find(".attenSpan"), 6)
  141. }
  142. } else {
  143. $("#companyImg").attr("src",'/images/default-icon.jpg');
  144. $("#Qname").text(par);
  145. $("#companyImg").parents(".cmpHead").removeAttr("href");
  146. $("#Qname").parents(".cmpHead").removeAttr("href");
  147. }
  148. }else {
  149. $("#companyImg").attr("src",'/images/default-icon.jpg');
  150. $("#Qname").text(par);
  151. $("#companyImg").parents(".cmpHead").removeAttr("href");
  152. $("#Qname").parents(".cmpHead").removeAttr("href");
  153. }
  154. },
  155. "error": function() {
  156. $.MsgBox.Alert('提示', '链接服务器超时')
  157. }
  158. });
  159. }
  160. function userFun(id) {
  161. $.ajax({
  162. "url": "/ajax/professor/editBaseInfo/" + id,
  163. "type": "get",
  164. "async": true,
  165. "datatype":"json",
  166. "success": function(data) {
  167. if(data.success && data.data) {
  168. console.log(data)
  169. var $data=data.data;
  170. var img;
  171. var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
  172. var oTitle = "";
  173. if($data.title) {
  174. oTitle = $data.title;
  175. } else {
  176. if($data.office) {
  177. oTitle = $data.office;
  178. }
  179. }
  180. if($data.hasHeadImage==1) {
  181. img = "/images/head/" + $data.id + "_l.jpg";
  182. } else {
  183. img = "../images/default-photo.jpg"
  184. }
  185. var oSt = '<li class="flexCenter" style="cursor:pointer" data-id="'+$data.id +'">'
  186. oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url(' + img + ');"></div>'
  187. oSt += '<div class = "madiaInfo" style="padding-right:0">'
  188. oSt += '<p class = "ellipsisSty">'
  189. oSt += '<span class = "h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em >'
  190. oSt += '</p>'
  191. oSt += '<p class="h2Font ellipsisSty">' + oTitle + '</p>'
  192. oSt += '</div>'
  193. oSt += '</li>'
  194. var $oSt=$(oSt);
  195. $("#expertli").append($oSt);
  196. }
  197. },
  198. "error": function() {
  199. $.MsgBox.Alert('提示', '链接服务器超时')
  200. }
  201. });
  202. }
  203. //纠错反馈
  204. $(".correctSubmit").on("click",function(){
  205. var cntCon=$(this).siblings(".correctCon").val();
  206. var cntUser="";
  207. if(userid && userid != null && userid != "null") {
  208. cntUser = userid;
  209. }
  210. if(cntCon.length>500){
  211. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  212. return;
  213. }else{
  214. $.ajax({
  215. "url": "/ajax/feedback/error/demand",
  216. "type": "POST",
  217. "dataType": "json",
  218. "async": true,
  219. "data": {
  220. "id": demandId,
  221. "cnt":cntCon,
  222. "user":cntUser
  223. },
  224. "success": function(data) {
  225. if(data.success) {
  226. backSuccessed();
  227. }
  228. },
  229. "error": function() {
  230. $.MsgBox.Alert('提示', '链接服务器超时')
  231. }
  232. });
  233. }
  234. })
  235. })