portal html css js resource

demandShow.js 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. $(document).ready(function() {
  2. loginStatus(); //判断个人是否登录
  3. var userid=$.cookie("userid");
  4. var demandId = GetQueryString("demandId");
  5. var consuId, demandTitle, demandContent;
  6. getDemandinfo();
  7. pageViewsVal();
  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=="null"||userid==undefined){
  39. // location.href="login.html";
  40. // }
  41. // $.ajax({
  42. // url: "/ajax/consult/byDemand",
  43. // type: "GET",
  44. // timeout: 10000,
  45. // dataType: "json",
  46. // data: {
  47. // "demandId": demandId,
  48. // "professorId": userid
  49. // },
  50. // success: function(data, textState) {
  51. // if(data.success) {
  52. // //console.log(data)
  53. // if(data.data == null) {
  54. // $.MsgBox.Confirm("消息", "确认回复该需求?", createConsult)
  55. // $("#mb_msg").append('<span style="color:#999;font-size:12px;margin:20px;">确认后开始本次合作,将使用「我的工作台 - 咨询」功能与联系人进行沟通,由对方确认合作是否完成。</span>')
  56. // } else {
  57. // location.href="diloags.html?sendId="+userid+"&attrParams=professorId&consultId="+data.data+"&consultStatus=0&assessStatus=0&thanksStatus=0"
  58. // }
  59. // }
  60. // },
  61. // error: function() {
  62. //
  63. // }
  64. // })
  65. //
  66. // })
  67. $(".showStatus").on('click',".meSendBack",function(){
  68. if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
  69. location.href="tidings.html?id="+consuId
  70. } else {
  71. quickLog();
  72. operatTab();
  73. closeLog();
  74. }
  75. });
  76. $("#expertli").on("click","li",function(){
  77. var dataId=$(this).attr("data-id");
  78. location.href="userInforShow.html?professorId="+dataId;
  79. })
  80. function getDemandinfo(){
  81. $.ajax({
  82. "url": "/ajax/demand/qo",
  83. "type": "GET",
  84. "data": {
  85. "id": demandId
  86. },
  87. "dataType": "json",
  88. "success": function(data) {
  89. console.log(data);
  90. if(data.success) {
  91. var $da=data.data;
  92. $("#demandTit").text($da.title); //名字
  93. var thisNum="";
  94. thisNum+='<li><span>'+commenTime($da.createTime)+'</span></li>';
  95. if($da.pageViews!=0){
  96. thisNum+='<li><span>浏览量</span> <span>'+$da.pageViews+'</span></li>';
  97. }
  98. $("#demandNum").prepend(thisNum);
  99. $("#demandDesp")[0].innerText=$da.descp; //内容
  100. var weibopic = "http://" + window.location.host + "/images/default-paper.jpg"
  101. var weibotitle = $da.title;
  102. var weibourl = window.location.href;
  103. $("#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");
  104. var demandTit = $da.title + "-科袖网";
  105. document.title = demandTit;
  106. var strCon="";
  107. if($da.city){ strCon+='<li>所在城市:'+$da.city+'</li>' }
  108. if($da.duration!=0){ strCon+='<li>预期时长:'+demandDuration[$da.duration]+'</li>' }
  109. if($da.cost!=0){ strCon+='<li>费用预算:'+demandCost[$da.cost]+'</li>' }
  110. if($da.invalidDay){ strCon+='<li>有效期至:'+TimeTr($da.invalidDay)+'</li>' }
  111. $(strCon).appendTo($("#demandInf"));
  112. if($da.state==0){
  113. $(".showStatus").html('已过期');
  114. }else if($da.state==1){
  115. if(userid==$da.creator){
  116. $(".showStatus").html('发布中');
  117. }else{
  118. $(".showStatus").html('<input type="button" class="frmconbtn btnModel meSendBack" value="立即回复">')
  119. }
  120. }else if($da.state==2){
  121. $(".showStatus").html('已完成');
  122. }else if($da.state==3){
  123. $(".showStatus").html('已关闭');
  124. }
  125. cmpFun($da.orgId);
  126. userFun($da.creator);
  127. consuId = $da.creator;
  128. demandTitle = $da.title;
  129. demandContent = $da.descp;
  130. }
  131. },
  132. 'error': function() {
  133. $.MsgBox.Alert('提示', '服务器连接超时!');
  134. }
  135. });
  136. }
  137. //浏览量
  138. function pageViewsVal() {
  139. $.ajax({
  140. "url": "/ajax/demand/incPageViews",
  141. "type": "POST",
  142. "dataType": "json",
  143. "data": {
  144. "id": demandId
  145. },
  146. "success": function(data) {
  147. console.log(data);
  148. if(data.success) {}
  149. },
  150. "error": function() {
  151. $.MsgBox.Alert('提示', '链接服务器超时')
  152. }
  153. });
  154. }
  155. /*企业用户信息*/
  156. function cmpFun(id) {
  157. $.ajax({
  158. "url": "/ajax/org/" + id,
  159. "type": "get",
  160. "async": true,
  161. "success": function(data) {
  162. if(data.success && data.data) {
  163. if(data.data.forShort) {
  164. $("#Qname").text(data.data.forShort);
  165. }else{
  166. $("#Qname").text(data.data.name);
  167. }
  168. var img="/images/default-icon.jpg";
  169. if(data.data.hasOrgLogo==1){
  170. img="/images/org/" + data.data.id + ".jpg";
  171. }
  172. $("#companyImg").attr("src",img);
  173. $("#companyImg").parents(".cmpHead").attr("href","cmpInforShow.html?orgId="+data.data.id);
  174. $("#companyImg").parents(".cmpHead").attr("data-id",data.data.id);
  175. $("#Qname").attr("href","cmpInforShow.html?orgId="+data.data.id);
  176. if(data.data.authStatus==3){
  177. $("#QauthFlag").addClass("authicon-com-ok").attr("title","科袖认证企业")
  178. }
  179. if(userid){
  180. ifcollectionAbout(data.data.id,$(".goSpan").find(".attenSpan"), 6)
  181. }
  182. }
  183. },
  184. "error": function() {
  185. $.MsgBox.Alert('提示', '链接服务器超时')
  186. }
  187. });
  188. }
  189. function userFun(id) {
  190. $.ajax({
  191. "url": "/ajax/professor/editBaseInfo/" + id,
  192. "type": "get",
  193. "async": true,
  194. "datatype":"json",
  195. "success": function(data) {
  196. if(data.success && data.data) {
  197. console.log(data)
  198. var $data=data.data;
  199. var img;
  200. var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
  201. var oTitle = "";
  202. if($data.title) {
  203. oTitle = $data.title;
  204. } else {
  205. if($data.office) {
  206. oTitle = $data.office;
  207. }
  208. }
  209. if($data.hasHeadImage==1) {
  210. img = "/images/head/" + $data.id + "_l.jpg";
  211. } else {
  212. img = "../images/default-photo.jpg"
  213. }
  214. var oSt = '<li class="flexCenter" style="cursor:pointer" data-id="'+$data.id +'">'
  215. oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url(' + img + ');"></div>'
  216. oSt += '<div class = "madiaInfo" style="padding-right:0">'
  217. oSt += '<p class = "ellipsisSty">'
  218. oSt += '<span class = "h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em >'
  219. oSt += '</p>'
  220. oSt += '<p class="h2Font ellipsisSty">' + oTitle + '</p>'
  221. oSt += '</div>'
  222. oSt += '</li>'
  223. var $oSt=$(oSt);
  224. $("#expertli").append($oSt);
  225. }
  226. },
  227. "error": function() {
  228. $.MsgBox.Alert('提示', '链接服务器超时')
  229. }
  230. });
  231. }
  232. // function createConsult() {
  233. // $.ajax({
  234. // url: "/ajax/consult",
  235. // type: "POST",
  236. // timeout: 10000,
  237. // data: {
  238. // "consultType": "其他咨询",
  239. // "consultTitle": demandTitle,
  240. // "consultContant": demandContent,
  241. // "professorId": userid,
  242. // "consultantId": consuId,
  243. // "demandId": demandId
  244. // },
  245. // success: function(data) {
  246. // if(data.success) {
  247. // console.log(data)
  248. // location.href="diloags.html?sendId="+userid+"&attrParams=professorId&consultId="+data.data+"&consultStatus=0&assessStatus=0&thanksStatus=0"
  249. // }
  250. // },
  251. // error: function() {
  252. //
  253. // }
  254. // })
  255. // }
  256. //纠错反馈
  257. $(".correctSubmit").on("click",function(){
  258. var cntCon=$(this).siblings(".correctCon").val();
  259. var cntUser="";
  260. if(userid && userid != null && userid != "null") {
  261. cntUser = userid;
  262. }
  263. if(cntCon.length>500){
  264. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  265. return;
  266. }else{
  267. $.ajax({
  268. "url": "/ajax/feedback/error/demand",
  269. "type": "POST",
  270. "dataType": "json",
  271. "async": true,
  272. "data": {
  273. "id": demandId,
  274. "cnt":cntCon,
  275. "user":cntUser
  276. },
  277. "success": function(data) {
  278. if(data.success) {
  279. backSuccessed();
  280. }
  281. },
  282. "error": function() {
  283. $.MsgBox.Alert('提示', '链接服务器超时')
  284. }
  285. });
  286. }
  287. })
  288. })