portal html css js resource

demandShow.js 9.1KB

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