portal html css js resource

demandShow.js 6.8KB

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