portal html css js resource

demandShow.js 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. $("#companyImg").attr("src",img);
  130. $("#companyImg").parents(".cmpHead").attr("href","cmpInforShow.html?orgId="+data.data.id);
  131. $("#companyImg").parents(".cmpHead").attr("data-id",data.data.id);
  132. $("#Qname").attr("href","cmpInforShow.html?orgId="+data.data.id);
  133. if(data.data.authStatus==3){
  134. $("#QauthFlag").addClass("authicon-com-ok").attr("title","科袖认证企业")
  135. }
  136. if(userid){
  137. ifcollectionAbout(data.data.id,$(".goSpan").find(".attenSpan"), 6)
  138. }
  139. } else {
  140. $("#companyImg").attr("src",'/images/default-icon.jpg');
  141. $("#Qname").text(par);
  142. $("#companyImg").parents(".cmpHead").removeAttr("href");
  143. $("#Qname").parents(".cmpHead").removeAttr("href");
  144. }
  145. }else {
  146. $("#companyImg").attr("src",'/images/default-icon.jpg');
  147. $("#Qname").text(par);
  148. $("#companyImg").parents(".cmpHead").removeAttr("href");
  149. $("#Qname").parents(".cmpHead").removeAttr("href");
  150. }
  151. },
  152. "error": function() {
  153. $.MsgBox.Alert('提示', '链接服务器超时')
  154. }
  155. });
  156. }
  157. function userFun(id) {
  158. $.ajax({
  159. "url": "/ajax/professor/editBaseInfo/" + id,
  160. "type": "get",
  161. "async": true,
  162. "datatype":"json",
  163. "success": function(data) {
  164. if(data.success && data.data) {
  165. console.log(data)
  166. var $data=data.data;
  167. var img;
  168. var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
  169. var oTitle = "";
  170. if($data.title) {
  171. oTitle = $data.title;
  172. } else {
  173. if($data.office) {
  174. oTitle = $data.office;
  175. }
  176. }
  177. if($data.hasHeadImage==1) {
  178. img = "/images/head/" + $data.id + "_l.jpg";
  179. } else {
  180. img = "../images/default-photo.jpg"
  181. }
  182. var oSt = '<li class="flexCenter" style="cursor:pointer" data-id="'+$data.id +'">'
  183. oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url(' + img + ');"></div>'
  184. oSt += '<div class = "madiaInfo" style="padding-right:0">'
  185. oSt += '<p class = "ellipsisSty">'
  186. oSt += '<span class = "h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em >'
  187. oSt += '</p>'
  188. oSt += '<p class="h2Font ellipsisSty">' + oTitle + '</p>'
  189. oSt += '</div>'
  190. oSt += '</li>'
  191. var $oSt=$(oSt);
  192. $("#expertli").append($oSt);
  193. }
  194. },
  195. "error": function() {
  196. $.MsgBox.Alert('提示', '链接服务器超时')
  197. }
  198. });
  199. }
  200. //纠错反馈
  201. $(".correctSubmit").on("click",function(){
  202. var cntCon=$(this).siblings(".correctCon").val();
  203. var cntUser="";
  204. if(userid && userid != null && userid != "null") {
  205. cntUser = userid;
  206. }
  207. if(cntCon.length>500){
  208. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  209. return;
  210. }else{
  211. $.ajax({
  212. "url": "/ajax/feedback/error/demand",
  213. "type": "POST",
  214. "dataType": "json",
  215. "async": true,
  216. "data": {
  217. "id": demandId,
  218. "cnt":cntCon,
  219. "user":cntUser
  220. },
  221. "success": function(data) {
  222. if(data.success) {
  223. backSuccessed();
  224. }
  225. },
  226. "error": function() {
  227. $.MsgBox.Alert('提示', '链接服务器超时')
  228. }
  229. });
  230. }
  231. })
  232. })