portal html css js resource

needIssue.js 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. $(document).ready(function() {
  2. var demandId = GetQueryString("demandId");
  3. var a = new Date();
  4. var c = a.getFullYear() + "-" + (Number(a.getMonth()) + 1) + "-" + (Number(a.getDate()) + 1);
  5. $('.dateBtn').datetimepicker({
  6. language: 'ch',
  7. weekStart: 0,
  8. todayBtn: false,
  9. autoclose: 1,
  10. todayHighlight: 1,
  11. startView: 2,
  12. minView: 2,
  13. forceParse: 0,
  14. startDate: c
  15. });
  16. /*联系电话*/
  17. $("#phone").bind({
  18. focus: function() {
  19. $(this).siblings().find("span").show();
  20. },
  21. blur: function() {
  22. $(this).siblings().find("span").hide();
  23. }
  24. })
  25. queryOnedemand()
  26. function queryOnedemand() {
  27. $.ajax({
  28. "url": "/ajax/demand/qo",
  29. "type": "GET",
  30. "data": {
  31. "id": demandId,
  32. },
  33. "contentType": "application/x-www-form-urlencoded",
  34. "traditional": true,
  35. "dataType": "json",
  36. "success": function(data) {
  37. if(data.success) {
  38. var $data = data.data;
  39. var demandTit =$data.title + "-科袖网";
  40. document.title = demandTit;
  41. UnauthorizedUser($data.creator)
  42. if($data.state == 0) {
  43. $('.overdue').removeClass("displayNone")
  44. }
  45. $("#demandTitle").text($data.title);
  46. $("#publishTime").text(commenTime($data.createTime));
  47. $("#pageView").text($data.pageViews);
  48. $("#demandContent").text($data.descp);
  49. $("#oprovince").text($data.province);
  50. $("#ocity").text($data.city);
  51. $("#spendCost").val($data.cost);
  52. $("#budget").val($data.duration);
  53. $("#createTime").val(changeTime($data.invalidDay));
  54. $("#phone").val($data.contactNum);
  55. $("#org").val($data.orgName);
  56. cmpFun($data.orgName);
  57. if($data.cost == 0) {
  58. $("#spendCost").css("color", "#999");
  59. }
  60. if($data.duration ==0) {
  61. $("#budget").css("color", "#999");
  62. }
  63. //省份城市颜色
  64. if($("#oprovince").text() == "请选择省/直辖市") {
  65. $("#oprovince").removeClass("mr_select");
  66. } else {
  67. $("#oprovince").addClass("mr_select");
  68. }
  69. if($("#ocity").text() == "请选择城市") {
  70. $("#ocity").removeClass("mr_select");
  71. } else {
  72. $("#ocity").addClass("mr_select");
  73. }
  74. }
  75. },
  76. "error": function() {
  77. $.MsgBox.Alert('提示', '服务器连接超时');
  78. }
  79. });
  80. }
  81. function cmpFun(par) {
  82. $.ajax({
  83. "url": "/ajax/org/queryByName",
  84. 'data': {
  85. name: par
  86. },
  87. "type": "get",
  88. "async": true,
  89. "success": function(data) {
  90. if(data.success) {
  91. if(data.data != null) {
  92. $(".goSpan").show();
  93. if(data.data.forShort) {
  94. $("#Qname").text(data.data.forShort);
  95. }else{
  96. $("#Qname").text(data.data.name);
  97. }
  98. var img="/images/default-icon.jpg";
  99. if(data.data.hasOrgLogo==1){
  100. img="/images/org/" + data.data.id + ".jpg";
  101. }
  102. if(data.data.industry) {
  103. $("#industry").text(data.data.industry.replace(/,/g, " | "));
  104. }
  105. $("#companyImg").attr("src",img);
  106. $("#companyImg").parents(".cmpHead").attr("href","cmpInforShow.html?orgId="+data.data.id);
  107. $("#companyImg").parents(".cmpHead").attr("data-id",data.data.id);
  108. $("#Qname").attr("href","cmpInforShow.html?orgId="+data.data.id);
  109. if(data.data.authStatus==3){
  110. $("#QauthFlag").addClass("authicon-com-ok").attr("title","科袖认证企业")
  111. }
  112. } else {
  113. $("#companyImg").attr("src",'/images/default-icon.jpg');
  114. $("#Qname").text(par);
  115. $("#companyImg").parents(".cmpHead").removeAttr("href");
  116. $("#Qname").parents(".cmpHead").removeAttr("href");
  117. }
  118. }else {
  119. $("#companyImg").attr("src",'/images/default-icon.jpg');
  120. $("#Qname").text(par);
  121. $("#companyImg").parents(".cmpHead").removeAttr("href");
  122. $("#Qname").parents(".cmpHead").removeAttr("href");
  123. }
  124. },
  125. "error": function() {
  126. $.MsgBox.Alert('提示', '链接服务器超时')
  127. }
  128. });
  129. }
  130. function UnauthorizedUser(par) {
  131. $.ajax({
  132. url: "/ajax/professor/qaOrgAuth",
  133. type: "GET",
  134. timeout: 10000,
  135. dataType: "json",
  136. async:"false",
  137. data: {
  138. "orgId": $.cookie('orgId'),
  139. "orgAuth": 1
  140. },
  141. success: function(data, textState) {
  142. if(data.success) {
  143. console.log(data);
  144. unauthUser(data.data,par);
  145. if(data.data.length ==0) {
  146. $(".seRe").removeClass("displayNone")
  147. }
  148. }
  149. },
  150. error: function(XMLHttpRequest, textStats, errorThrown) {
  151. $.MsgBox.Alert('提示', '服务器请求失败')
  152. }
  153. })
  154. }
  155. function unauthUser($res,par) {
  156. var osting=""
  157. for(var i = 0; i < $res.length; i++) {
  158. var img;
  159. var oClass = autho($res[i].authType, $res[i].orgAuth, $res[i].authStatus);
  160. var oTitle="";
  161. if($res[i].title) {
  162. oTitle=$res[i].title;
  163. }else{
  164. if($res[i].office) {
  165. oTitle=$res[i].office;
  166. }
  167. }
  168. var cls='';
  169. if($res[i].id == par) {
  170. cls = 'selectAdd'
  171. }
  172. if($res[i].hasHeadImage) {
  173. img = "/images/head/" + $res[i].id + "_l.jpg";
  174. } else {
  175. img = "../images/default-photo.jpg"
  176. }
  177. var oSt = '<li class="flexCenter" style="cursor:pointer;" id="'+$res[i].id+'">'
  178. oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url('+img+');"></div>'
  179. oSt += '<div class = "madiaInfo">'
  180. oSt += '<p class = "ellipsisSty">'
  181. oSt += '<span class = "h1Font" id="name">'+$res[i].name+'</span><em class="authicon '+oClass.sty+'" title="'+oClass.title+'"></em >'
  182. oSt += '</p>'
  183. oSt += '<p class="h2Font ellipsisSty">'+oTitle+'</p>'
  184. oSt += '</div>'
  185. oSt += '<div class="selectNull '+cls+'" flag=1></div>'
  186. oSt += '</li>'
  187. osting+=oSt;
  188. }
  189. $("#expertli").html(osting);
  190. }
  191. function formatDate(date) {
  192. var y = date.getFullYear();
  193. var m = date.getMonth() + 1;
  194. m = m < 10 ? '0' + m : m;
  195. var d = date.getDate();
  196. d = d < 10 ? ('0' + d) : d;
  197. return y + '-' + m + '-' + d;
  198. };
  199. function test() {
  200. if($("#oprovince").text() == "请选择省/直辖市") {
  201. $.MsgBox.Alert('提示', '请选择省/直辖市');
  202. return;
  203. }
  204. if($("#ocity").text() == "请选择城市") {
  205. $.MsgBox.Alert('提示', '请选择城市');
  206. return;
  207. }
  208. if($("#createTime").val() == "") {
  209. $.MsgBox.Alert('提示', '请选择需求有效期');
  210. return;
  211. } else {
  212. if(formatDate(a) > $("#createTime").val()) {
  213. $.MsgBox.Alert('提示', '该需求已过期,请修改有效期,若已解决请点击「需求已完成」按钮');
  214. return;
  215. }
  216. }
  217. if($("#phone").val().trim() == "") {
  218. $.MsgBox.Alert('提示', '请填写联系电话');
  219. return;
  220. } else if($("#phone").val().length > 50) {
  221. $.MsgBox.Alert('提示', '联系电话不得超过50个字');
  222. return;
  223. }
  224. return 1;
  225. }
  226. $("#modia").click(function() {
  227. if(test()) {
  228. $.MsgBox.Confirm("提示", "确认修改需求?", pDemand);
  229. }
  230. });
  231. $("#complete").click(function() {
  232. $.MsgBox.Confirm("提示", "确认需求已完成?", com);
  233. });
  234. $("#closeDemand").click(function() {
  235. $.MsgBox.Confirm("提示", "确认关闭该需求?", closeDe);
  236. });
  237. function com() {
  238. $.ajax({
  239. "url": "/ajax/demand/over",
  240. "type": "POST",
  241. "data": {
  242. "id": demandId
  243. },
  244. "contentType": "application/x-www-form-urlencoded",
  245. "traditional": true,
  246. "dataType": "json",
  247. "success": function(data) {
  248. if(data.success) {
  249. location.href = "cmp-needList.html";
  250. }
  251. },
  252. "error": function() {
  253. $.MsgBox.Alert('提示', '服务器连接超时');
  254. }
  255. });
  256. }
  257. function closeDe() {
  258. $.ajax({
  259. "url": "/ajax/demand/close",
  260. "type": "POST",
  261. "data": {
  262. "id": demandId
  263. },
  264. "contentType": "application/x-www-form-urlencoded",
  265. "traditional": true,
  266. "dataType": "json",
  267. "success": function(data) {
  268. if(data.success) {
  269. location.href = "cmp-needList.html";
  270. }
  271. },
  272. "error": function() {
  273. $.MsgBox.Alert('提示', '服务器连接超时');
  274. }
  275. });
  276. }
  277. /*时间转换成6位传给后台*/
  278. function st6(osr) {
  279. var tim = osr.substring(0, 4) + osr.substring(5, 7) + osr.substring(8, 10);
  280. return tim;
  281. }
  282. function pDemand() {
  283. var time=new Date(),
  284. y=time.getFullYear();
  285. m=time.getMonth()+1;
  286. if(m<10) {
  287. m="0"+m;
  288. }
  289. d=time.getDate();
  290. if(d<10) {
  291. d="0"+d;
  292. }
  293. var oTime=Number(y+""+m+""+d);
  294. var seleTime=Number(st6($("#createTime").val()));
  295. if(oTime>seleTime) {
  296. $.MsgBox.Alert('提示', '该需求已过期,请修改有效期,若已解决请点击「需求已完成」按钮');
  297. return;
  298. }
  299. $.ajax({
  300. "url": "/ajax/demand/modify/org",
  301. "type": "POST",
  302. "data": {
  303. "province": $("#oprovince").text(),
  304. "city": $("#ocity").text(),
  305. "cost": $("#spendCost").val() != "0" ? $("#spendCost").val() : "",
  306. "duration": $("#budget").val() != "0" ? $("#budget").val() : "",
  307. "invalidDay": st6($("#createTime").val()),
  308. "contactNum": $("#phone").val(),
  309. "creator":$("#expertli").find(".selectAdd").parents('li').attr('id'),
  310. "id": demandId,
  311. 'orgName': $.cookie("orgName"),
  312. 'source': 'ekexiuWeb'
  313. },
  314. "contentType": "application/x-www-form-urlencoded",
  315. "traditional": true,
  316. "dataType": "json",
  317. "success": function(data) {
  318. if(data.success) {
  319. location.href = "cmp-needList.html";
  320. }
  321. },
  322. "error": function() {
  323. $.MsgBox.Alert('提示', '服务器连接超时');
  324. }
  325. });
  326. }
  327. $("#expertli").on("click","li",function(){
  328. var userL=$("#expertli").find(".selectAdd").length;
  329. console.log($(this).find('.selectNull').hasClass("selectAdd"))
  330. if($(this).find('.selectNull').hasClass("selectAdd")) {
  331. $(this).find('.selectNull').removeClass("selectAdd");
  332. return;
  333. }
  334. $("#linkman").text("");
  335. if(userL ==1) {
  336. $("#linkman").text("最多选择1位联系人");
  337. return;
  338. }
  339. $(this).find('.selectNull').addClass("selectAdd");
  340. });
  341. });