portal html css js resource

demandShow.js 8.5KB

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