説明なし

serviceIssue.js 30KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. $(function() {
  2. var baseUrl = "http://www.ekexiu.com";
  3. loginStatus();
  4. // var orgId = $.cookie('orgId');
  5. var oProfessor = [];
  6. var sevriceId = GetQueryString("serviceId");
  7. var re, reEnd, ue = UE.getEditor('editor', {}),
  8. temp = [];
  9. // if(orgId == "" || orgId == null || orgId == "null") {
  10. // location.href = "cmp-settled-log.html";
  11. // }
  12. if(sevriceId) {
  13. $("#deleteResource").removeClass("disableLi").addClass("deleteResource");
  14. getRecourceMe();
  15. }
  16. function loginStatus() {
  17. $.ajax({
  18. type: "get",
  19. async:false,
  20. url:"/ajax/sys/user",
  21. success:function (data) {
  22. if(data.success == true) {
  23. var userid = data.data.id;
  24. if (userid == undefined || userid.length == 0 || userid == "null") {
  25. location.href = "http://"+window.location.host+"/html/index.html";
  26. }
  27. }else {
  28. location.href = "http://"+window.location.host+"/html/index.html";
  29. }
  30. }
  31. });
  32. }
  33. function GetQueryString(name) {
  34. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  35. var r = window.location.search.substr(1).match(reg);
  36. var context = "";
  37. if(r != null)
  38. context = r[2];
  39. reg = null;
  40. r = null;
  41. return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
  42. }
  43. function hotKey(sel, num) {
  44. $(sel).bind({
  45. paste: function(e) {
  46. var pastedText;
  47. if (window.clipboardData  &&  window.clipboardData.getData)  {  // IE
  48. pastedText  = $(this).val() +  window.clipboardData.getData('Text');
  49. }else{
  50. pastedText  = $(this).val() +  e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
  51. }
  52. $(this).val(pastedText);
  53. var $this = $(this);
  54. setTimeout(function() {
  55. if($this.val().trim()) {
  56. $this.siblings("button").show();
  57. } else {
  58. $this.siblings("button").hide();
  59. }
  60. }, 1);
  61. e.preventDefault();
  62. },
  63. cut: function(e) {
  64. var $this = $(this);
  65. setTimeout(function() {
  66. if($this.val().trim()) {
  67. $this.siblings("button").show();
  68. } else {
  69. $this.siblings("button").hide();
  70. }
  71. }, 1);
  72. },
  73. blur: function() {
  74. var $this = $(this);
  75. setTimeout(function() {
  76. $this.siblings(".keydrop").hide();
  77. }, 500)
  78. },
  79. focus: function() {
  80. $(this).siblings(".keydrop").show();
  81. },
  82. keyup: function(e) {
  83. var ti=$(this).val();
  84. var $t=this;
  85. $t.comr=ti;
  86. var $this=$(this);
  87. if($(this).val().trim()) {
  88. $(this).siblings("button").show();
  89. var lNum = $.trim($(this).val()).length;
  90. if(0 < lNum) {
  91. setTimeout(function(){
  92. if( ti===$t.comr && ti!== $t.comrEnd) {
  93. var tt=ti;
  94. $t.comrEnd=tt;
  95. $("#addKeyword").show();
  96. $.ajax({
  97. "url": "/ajax/article/qaHotKey",
  98. "type": "GET",
  99. "success": function(data) {
  100. console.log(data);
  101. if(data.success) {
  102. if($t.comrEnd==tt) {
  103. if(data.data.length == 0) {
  104. $this.siblings(".keydrop").addClass("displayNone");
  105. $this.siblings(".keydrop").find("ul").html("");
  106. } else {
  107. $this.siblings(".keydrop").removeClass("displayNone");
  108. var oSr = "";
  109. for(var i = 0; i < Math.min(data.data.length,5); i++) {
  110. oSr += '<li>' + data.data[i].caption + '<div class="closeThis"></div></li>';
  111. }
  112. $this.siblings(".keydrop").find("ul").html(oSr);
  113. }
  114. }
  115. } else {
  116. $this.siblings(".keydrop").addClass("displayNone");
  117. $this.siblings(".keydrop").find("ul").html("");
  118. }
  119. },
  120. "data": {
  121. "key": $this.val()
  122. },
  123. dataType: "json",
  124. 'error': function() {
  125. $.MsgBox.Alert('提示', '服务器连接超时!');
  126. }
  127. });
  128. }
  129. },500);
  130. }
  131. } else {
  132. $(this).siblings("button").hide();
  133. $(this).siblings(".keydrop").addClass("displayNone");
  134. $(this).siblings(".keydrop").find("ul").html("");
  135. }
  136. }
  137. })
  138. $(".keydrop").on("click", "li", function() {
  139. var oValue = $(this).text();
  140. var oJudge = $(this).parents(".col-w-12").siblings().find("ul.ulspace li");
  141. var addNum = $(this).parents(".keydrop").siblings("input").attr("data-num");
  142. for(var i = 0; i < oJudge.length; i++) {
  143. if(oValue == oJudge[i].innerText) {
  144. $.MsgBox.Alert('提示', '添加内容不能重复');
  145. return;
  146. }
  147. }
  148. $(this).parents(".col-w-12").siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  149. $(this).parents(".keydrop").siblings("input").val("");
  150. $(this).parents(".keydrop").siblings("button").hide();
  151. if(oJudge.length == addNum - 1) {
  152. $(this).parents(".keydrop").siblings("input").val("");
  153. $(this).parents(".col-w-12").hide();
  154. }
  155. $(this).parent("ul").html("")
  156. })
  157. if(num == 1) {
  158. return;
  159. } else {
  160. $(".addButton").siblings("input").keypress(function(){/*添加*/
  161. var e = event || window.event;
  162. if(e.keyCode == 13) {
  163. var oValue = $(this).val().trim();
  164. var oJudge = $(this).parent().siblings().find("ul.ulspace li");
  165. var addContent = $(this).attr("data-pro");
  166. var addNum = $(this).attr("data-num");
  167. var addfontSizeNum = $(this).attr("data-fontSizeN");
  168. if(!oValue) {
  169. $.MsgBox.Alert('提示', '请先填写内容');
  170. return;
  171. }
  172. if(oValue.length > addfontSizeNum) {
  173. $.MsgBox.Alert('提示', addContent);
  174. return;
  175. }
  176. for(var i = 0; i < oJudge.length; i++) {
  177. if(oValue == oJudge[i].innerText) {
  178. $.MsgBox.Alert('提示', '添加内容不能重复');
  179. return;
  180. }
  181. }
  182. $(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  183. $(this).siblings(".addButton").hide();
  184. $(this).val("");
  185. if(oJudge.length == addNum - 1) {
  186. $(this).val("").parents(".col-w-12").hide();
  187. }
  188. $(this).siblings(".keydrop").find("ul").html("");
  189. }
  190. })
  191. $(".addButton").click(function() {
  192. var oValue = $(this).siblings("input").val().trim();
  193. var oJudge = $(this).parent().siblings().find("ul.ulspace li");
  194. var addContent = $(this).siblings("input").attr("data-pro");
  195. var addNum = $(this).siblings("input").attr("data-num");
  196. var addfontSizeNum = $(this).siblings("input").attr("data-fontSizeN");
  197. if(!oValue) {
  198. $.MsgBox.Alert('提示', '请先填写内容');
  199. return;
  200. }
  201. if(oValue.length > addfontSizeNum) {
  202. $.MsgBox.Alert('提示', addContent);
  203. return;
  204. }
  205. for(var i = 0; i < oJudge.length; i++) {
  206. if(oValue == oJudge[i].innerText) {
  207. $.MsgBox.Alert('提示', '添加内容不能重复');
  208. return;
  209. }
  210. }
  211. $(this).parent().siblings().find("ul.ulspace").append('<li>' + oValue + '<div class="closeThis"></div></li>');
  212. $(this).hide();
  213. $(this).siblings("input").val("");
  214. if(oJudge.length == addNum - 1) {
  215. $(this).val("").parents(".col-w-12").hide();
  216. }
  217. $(this).siblings(".keydrop").find("ul").html("");
  218. })
  219. }
  220. }
  221. function limitObj(obj,maxNum){
  222. $(obj).bind({
  223. paste: function(e) {
  224. if($(this).val().length==""){
  225. $(this).parent().siblings(".btnModel").attr("disabled", true);
  226. }else{
  227. $(this).parent().siblings(".btnModel").attr("disabled", false);
  228. }
  229. var pastedText;
  230. if (window.clipboardData  &&  window.clipboardData.getData)  {  // IE
  231. pastedText  = $(this).val() +  window.clipboardData.getData('Text');
  232. }
  233. else  {
  234. pastedText  = $(this).val() +  e.originalEvent.clipboardData.getData('Text'); //e.clipboardData.getData('text/plain');
  235. }
  236. $(this).val(pastedText);
  237. setTimeout(function() {
  238. $(this).siblings().find("em").text($(obj).val().length);
  239. }, 1);
  240. e.preventDefault();
  241. },
  242. cut: function(e) {
  243. if($(this).val().length==""){
  244. $(this).parent().siblings(".btnModel").attr("disabled", true);
  245. }else{
  246. $(this).parent().siblings(".btnModel").attr("disabled", false);
  247. }
  248. setTimeout(function() {
  249. $(obj).siblings().find("em").text($(obj).val().length);
  250. }, 1);
  251. },
  252. focus: function(e) {
  253. $(obj).parents("li").find(".frmconmsg").show();
  254. $(obj).siblings().find("em").text($(obj).val().length);
  255. },
  256. blur: function(e) {
  257. $(obj).parents("li").find(".frmconmsg").hide();
  258. },
  259. keyup: function(e) {
  260. if($(this).val().length==""){
  261. $(this).parent().siblings(".btnModel").attr("disabled", true);
  262. }else{
  263. $(this).parent().siblings(".btnModel").attr("disabled", false);
  264. }
  265. if($(this).val().length > maxNum) {
  266. $(obj).val($(obj).val().substring(0, maxNum));
  267. e.preventDefault();
  268. }
  269. setTimeout(function() {
  270. $(obj).siblings().find("em").text($(obj).val().length);
  271. }, 1);
  272. }
  273. });
  274. }
  275. function ajaxRequist(url, obj, type, fn) {
  276. $.ajax({
  277. url: url,
  278. data: obj,
  279. dataType: 'json', //服务器返回json格式数据
  280. type: type, //支持'GET'和'POST'
  281. traditional: true,
  282. success: function(data) {
  283. if(data.success) {
  284. fn(data)
  285. }
  286. },
  287. error: function(xhr, type, errorThrown) {
  288. $.MsgBox.Alert('提示', '服务器请求失败');
  289. }
  290. });
  291. } /*获取资源信息*/
  292. function getRecourceMe() {
  293. $.ajax({
  294. "url": baseUrl+"/ajax/ware/qo",
  295. "type": "GET",
  296. "success": function(data) {
  297. if(data.success) {
  298. $("#uploadDd").siblings().remove();
  299. $("#fileList").append("<dd></dd><dd></dd>");
  300. temp = [];
  301. resourceHtml(data.data);
  302. }
  303. },
  304. "data": {
  305. "id": sevriceId
  306. },
  307. dataType: "json",
  308. 'error': function() {
  309. $.MsgBox.Alert('提示', '服务器连接超时!');
  310. }
  311. });
  312. }
  313. /*处理资源html代码*/
  314. function resourceHtml($da) {
  315. $("#resourceName").val($da.name); //名字
  316. if($da.cnt) { //厂商型号
  317. $("#modelNumber").val($da.cnt);
  318. autoGrow.call($("#modelNumber")[0])
  319. }
  320. if($da.cooperation) { //合作备注
  321. $("#remarkContent").val($da.cooperation);
  322. }
  323. if($da.keywords) {
  324. var oSub = $da.keywords.split(",");
  325. var oSt = "";
  326. for(var i = 0; i < oSub.length; i++) {
  327. oSt += '<li>' + oSub[i] + '<div class="closeThis"></div></li>'
  328. }
  329. $("#keyWordlist").html(oSt);
  330. if(oSub.length > 4) {
  331. $("#KeyWord").parent().addClass("displayNone");
  332. }
  333. } else {
  334. $("#keyWordlist").html("");
  335. }
  336. if($da.descp) { //编辑器
  337. ue.ready(function() {
  338. ue.setContent($da.descp);
  339. });
  340. }
  341. if($da.images) {
  342. var arr = [];
  343. var oImg = $da.images.split(",");
  344. for(var i = 0; i < oImg.length; i++) {
  345. var oString = '<dd>' +
  346. '<div class="imgItem">' +
  347. '<img src="' + "http://www.ekexiu.com/data/ware" + oImg[i] + '"/>' +
  348. '</div>' +
  349. '<div class="file-panel">' +
  350. '<span class="cancel" flag=1></span>' +
  351. '</div>' +
  352. '</dd>'
  353. arr[i] = oString;
  354. temp[i] = oImg[i];
  355. }
  356. $("#fileList dd").eq(2).remove();
  357. if(oImg.length == 1) {
  358. $("#fileList").prepend(arr[0]);
  359. } else if(oImg.length == 2) {
  360. $("#fileList dd").eq(1).remove();
  361. $("#fileList").prepend(arr[1]);
  362. $("#fileList").prepend(arr[0]);
  363. } else if(oImg.length == 3) {
  364. $("#fileList dd").eq(1).remove();
  365. $("#fileList").prepend(arr[2]);
  366. $("#fileList").prepend(arr[1]);
  367. $("#fileList").prepend(arr[0]);
  368. }
  369. }
  370. }
  371. var uploader = WebUploader.create({
  372. auto: true,
  373. fileNumLimit: 3,
  374. swf: '../js/webuploader/Uploader.swf',
  375. server: baseUrl+'/ajax/ware/upload',
  376. fileSingleSizeLimit: 2 * 1024 * 1024,
  377. pick: {
  378. id: "#filePicker",
  379. multiple: false
  380. },
  381. accept: {
  382. title: 'Images',
  383. extensions: 'jpg,jpeg,png',
  384. mimeTypes: 'image/jpg,image/png,image/jpeg'
  385. }
  386. });
  387. // 当有文件添加进来的时候
  388. uploader.on('fileQueued', function(file) {
  389. var $len = $("#fileList").find("img").length;
  390. fileId = file.id;
  391. if($len == 0 || $len == 1) {
  392. var oRemove = $("#fileList").find("dd");
  393. oRemove.eq(oRemove.length - 1).remove();
  394. }
  395. var $li = $(
  396. '<dd>' +
  397. '<div class="imgItem" id="' + file.id + '">' +
  398. '<img />' +
  399. '</div>' +
  400. //'<div class="info">' + file.name + '</div>' +
  401. '</dd>'
  402. ),
  403. $btns = $('<div class="file-panel">' +
  404. '<span class="cancel"></span>' +
  405. '</div>').appendTo($li),
  406. $img = $li.find('img');
  407. var $list = $("#fileList");
  408. if($len == 1) {
  409. $list.find("dd").eq(0).after($li)
  410. } else if($len == 2) {
  411. $list.find("dd").eq(1).after($li)
  412. } else {
  413. $list.prepend($li);
  414. }
  415. // 创建缩略图
  416. // 如果为非图片文件,可以不用调用此方法。
  417. // thumbnailWidth x thumbnailHeight 为 100 x 100
  418. uploader.makeThumb(file, function(error, src) {
  419. if(error) {
  420. $img.replaceWith('<span>不能预览</span>');
  421. return;
  422. }
  423. $img.attr('src', src);
  424. }, 1, 1);
  425. });
  426. uploader.onError = function(code) {
  427. $.MsgBox.Alert('提示', '请上传jpg、jpeg、png格式的图片,大小不超过2M')
  428. };
  429. uploader.on('uploadSuccess', function(file, data) {
  430. if(data.success) {
  431. temp.push(data.data[0].uri);
  432. uploader.removeFile(fileId);
  433. } else {
  434. $.MsgBox.Alert('提示', '只支持jpeg/jpg/png格式的图片');
  435. }
  436. });
  437. /*删除图片*/
  438. $("#fileList").on("click", ".cancel", function() {
  439. var flag = $(this).attr("flag");
  440. var oNum = $(this).parents("dd").index();
  441. temp.splice(oNum, 1);
  442. $(this).parent().parent().remove();
  443. var $len = $("#fileList").find("img").length;
  444. if($len != 2) {
  445. $("#fileList").append("<dd></dd>")
  446. }
  447. });
  448. /*服务名称*/
  449. $("#resourceName").bind({
  450. focus: function() {
  451. $("#resourceNamePrompt").show();
  452. },
  453. blur: function() {
  454. $("#resourceNamePrompt").hide();
  455. },
  456. keyup: function() {
  457. if($(this).val().length > 30) {
  458. $(this).val($(this).val().substr(0, 30));
  459. }
  460. }
  461. })
  462. hotKey(".oinput");
  463. //校验关键字
  464. $("#KeyWord").on({
  465. focus: function() {
  466. $("#keyPrompt").text("最多可添加5个关键词,每个关键词15字以内");
  467. },
  468. blur: function() {
  469. $("#keyPrompt").text("");
  470. }
  471. })
  472. $("#keyWordlist").on("click", ".closeThis", function() {
  473. $(this).parent().remove();
  474. var liNum = $("#keyWordlist").find("li").length;
  475. if(liNum < 5) {
  476. $("#keyWordlist").parents(".keyResult").siblings("div.col-w-12").show();
  477. }
  478. })
  479. /*厂商型号*/
  480. $("#modelNumber").bind({
  481. focus: function() {
  482. $("#model").show();
  483. },
  484. blur: function() {
  485. $("#model").hide();
  486. },
  487. keyup: function() {
  488. if($(this).val().length > 250) {
  489. $(this).val($(this).val().substr(0, 250));
  490. }
  491. },
  492. input: function() {
  493. autoGrow.call(this);
  494. }
  495. });
  496. function autoGrow() {
  497. document.getElementById("tt").style.width = this.scrollWidth + "px";
  498. document.getElementById("tt").value = this.value;
  499. this.style.height = document.getElementById("tt").scrollHeight + "px";
  500. }
  501. $("#remarkContent").bind({
  502. focus: function() {
  503. $("#remark").show();
  504. },
  505. blur: function() {
  506. $("#remark").hide();
  507. }
  508. });
  509. /*合作备注*/
  510. limitObj("#remarkContent", 1000);
  511. /*发布*/
  512. $(".goFabu").click(function() {
  513. var oYes = term();
  514. if(oYes == 0) {
  515. return;
  516. }
  517. $.MsgBox.Confirm("提示", "确认发布该服务?", ajsPost);
  518. })
  519. // /*预览*/
  520. // $("#oPreview").click(function() {
  521. // var oYes = term();
  522. // if(oYes == 0) {
  523. // return;
  524. // }
  525. // if(sevriceId) {
  526. // ajsPost("/ajax/ware/draft/org/update", 1);
  527. // } else {
  528. // ajsPost("/ajax/ware/draft/org", 1);
  529. // }
  530. // })
  531. // /*存草稿*/
  532. // $("#oDraft").click(function() {
  533. // var oYes = term();
  534. // if(oYes == 0) {
  535. // return;
  536. // }
  537. // if(sevriceId) {
  538. // ajsPost("/ajax/ware/draft/org/update", 2);
  539. // } else {
  540. // ajsPost("/ajax/ware/draft/org", 2);
  541. // }
  542. // })
  543. // /*删除*/
  544. // $("#operateBlocko").on("click", ".deleteResource", function() {
  545. // $.MsgBox.Confirm("提示", "确认删除该服务?", deleResource);
  546. // })
  547. // /*删除函数*/
  548. // function deleResource() {
  549. // $.ajax({
  550. // "url": "/ajax/ware/delete",
  551. // "type": "POST",
  552. // "success": function(data) {
  553. // if(data.success) {
  554. // location.href = "cmp-serviceList.html"
  555. // }
  556. // },
  557. // "data": {
  558. // "id": sevriceId
  559. // },
  560. // "beforeSend": function() { /*console.log(this.data)*/ },
  561. // "contentType": "application/x-www-form-urlencoded",
  562. // dataType: "json"
  563. // });
  564. // }
  565. /*条件是否匹配*/
  566. function term() {
  567. var reName = $.trim($("#resourceName").val());
  568. var len=$("#expertli").find(".selectAdd");
  569. if(reName == "") {
  570. $.MsgBox.Alert('提示', '请输入服务名称。');
  571. return 0;
  572. }
  573. // if(len.length==0) {
  574. // $.MsgBox.Alert('提示', '请至少选择一个联系人。');
  575. // return 0;
  576. // }
  577. }
  578. function keyW() {
  579. var industrys = $("#keyWordlist li");
  580. var industryAll = "";
  581. if(industrys.size() > 0) {
  582. for(var i = 0; i < industrys.size(); i++) {
  583. industryAll += industrys[i].innerText.trim();
  584. industryAll += ',';
  585. };
  586. industryAll = industryAll.substring(0, industryAll.length - 1);
  587. }
  588. return industryAll;
  589. }
  590. /*发布函数*/
  591. function ajsPost(pa1, pa2) {
  592. var oUrl;
  593. if(sevriceId) {
  594. oUrl = baseUrl+"/ajax/ware/publish/conUpdate";
  595. }
  596. // else {
  597. // oUrl = "/ajax/ware/publish/org";
  598. // }
  599. if(pa1) {
  600. oUrl = pa1
  601. }
  602. console.log(oProfessor)
  603. //return;
  604. var $data = {
  605. name: $("#resourceName").val(),
  606. cooperation: $("#remarkContent").val(),
  607. keywords: keyW(),
  608. cnt: $("#modelNumber").val(),
  609. descp: ue.getContent(),
  610. images: temp.join(",")
  611. // resource: resourcesli(),
  612. // professor: oProfessor
  613. };
  614. if(sevriceId) {
  615. $data.id = sevriceId;
  616. }
  617. ajaxRequist(oUrl, $data, "POST", function(data) {
  618. if(data.success) {
  619. if(pa2 == 1) {
  620. if(!sevriceId)
  621. sevriceId = data.data;
  622. $("#deleteResource").removeClass("disableLi").addClass("deleteResource");
  623. window.open("../sevricePreview.html?sevriceId=" + sevriceId);
  624. getRecourceMe();
  625. //弹出预览
  626. } else if(pa2 == 2) {
  627. $("#deleteResource").removeClass("disableLi").addClass("deleteResource");
  628. if(!sevriceId)
  629. sevriceId = data.data;
  630. $.MsgBox.Alert('提示', '服务已保存草稿。');
  631. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  632. getRecourceMe();
  633. } else {
  634. $.MsgBox.Alert('提示', '服务发布成功!');
  635. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  636. // location.href = "cmp-serviceList.html"
  637. }
  638. } else {
  639. if(data.code == 90) {
  640. $.MsgBox.Alert('提示', '由于操作时间过久,上传图片已失效,请重新上传。');
  641. }
  642. }
  643. })
  644. }
  645. // function UnauthorizedUser() {
  646. // $.ajax({
  647. // url: "/ajax/professor/qaOrgAuth",
  648. // type: "GET",
  649. // timeout: 10000,
  650. // dataType: "json",
  651. // async: "false",
  652. // data: {
  653. // "orgId": orgId,
  654. // "orgAuth": 1
  655. // },
  656. // success: function(data, textState) {
  657. // if(data.success) {
  658. // unauthUser(data.data);
  659. // }
  660. // },
  661. // error: function(XMLHttpRequest, textStats, errorThrown) {
  662. // $.MsgBox.Alert('提示', '服务器请求失败')
  663. // }
  664. // })
  665. // }
  666. // UnauthorizedUser();
  667. //
  668. // function unauthUser($res) {
  669. // if(sevriceId) {
  670. // selUse();
  671. // }
  672. // var osting = ""
  673. // for(var i = 0; i < $res.length; i++) {
  674. // var img;
  675. // //var styC="";
  676. // var oClass = autho($res[i].authType, $res[i].orgAuth, $res[i].authStatus);
  677. // var oTitle = "";
  678. // /*if(!resourceId) {
  679. //
  680. // }*/
  681. //
  682. // if($res[i].title) {
  683. // oTitle = $res[i].title;
  684. // } else {
  685. // if($res[i].office) {
  686. // oTitle = $res[i].office;
  687. // }
  688. // }
  689. // if($res[i].hasHeadImage) {
  690. // img = "/images/head/" + $res[i].id + "_l.jpg";
  691. // } else {
  692. // img = "../images/default-photo.jpg"
  693. // }
  694. // var oSt = '<li class="flexCenter" style="cursor:pointer;" id="' + $res[i].id + '">'
  695. // oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url(' + img + ');"></div>'
  696. // oSt += '<div class = "madiaInfo">'
  697. // oSt += '<p class = "ellipsisSty">'
  698. // oSt += '<span class = "h1Font" id="name">' + $res[i].name + '</span><em class="authicon ' + oClass.sty + '" title="' + oClass.title + '"></em >'
  699. // oSt += '</p>'
  700. // oSt += '<p class="h2Font ellipsisSty">' + oTitle + '</p>'
  701. // oSt += '</div>'
  702. // oSt += '<div class="selectNull " flag=1></div>'
  703. // oSt += '</li>'
  704. // osting += oSt;
  705. // }
  706. // $("#expertli").html(osting);
  707. // }
  708. // /*选择用户*/
  709. // $("#expertli").on("click", "li", function() {
  710. // var userL = $("#expertli").find(".selectAdd").length;
  711. // var oSel = $(this).find(".selectAdd").length;
  712. // var oId = $(this).attr("id");
  713. // $("#linkman").text("");
  714. //
  715. // if(oSel == 0) {
  716. // if(userL == 5) {
  717. // $("#linkman").text("最多可选5个负责人");
  718. // return;
  719. // }
  720. // $(this).find('[flag]').addClass("selectAdd");
  721. // oProfessor.push(oId);
  722. // } else {
  723. // $(this).find('[flag]').removeClass("selectAdd");
  724. // for(var i = 0; i < oProfessor.length; i++) {
  725. // if(oId == oProfessor[i]) {
  726. // oProfessor.splice(i, 1);
  727. // }
  728. // }
  729. // }
  730. // });
  731. //
  732. // function selUse() {
  733. // $.ajax({
  734. // url: "/ajax/ware/pro",
  735. // type: "GET",
  736. // timeout: 10000,
  737. // dataType: "json",
  738. // async: true,
  739. // data: {
  740. // "id": sevriceId,
  741. // },
  742. // success: function(data) {
  743. // if(data.success) {
  744. // var arr = [];
  745. // var arr1 = [];
  746. // var oLength = $("#expertli").find("li");
  747. // for(var i = 0; i < data.data.length; i++) {
  748. // arr1.push(data.data[i].professor);
  749. // }
  750. // for(var i = 0; i < oLength.length; i++) {
  751. // arr.push(oLength.eq(i).attr("id"));
  752. // }
  753. // for(var i = 0; i < arr1.length; i++) {
  754. // oProfessor.push(arr1[i]);
  755. // oLength.eq(arr.indexOf(arr1[i])).find("[flag]").addClass("selectAdd")
  756. // }
  757. // }
  758. // },
  759. // error: function(XMLHttpRequest, textStats, errorThrown) {
  760. // $.MsgBox.Alert('提示', '服务器请求失败')
  761. // }
  762. // })
  763. // }
  764. // $("#checkZy").on("keyup", function() {
  765. // var ti = $(this).val();
  766. // re = ti;
  767. // if($(this).val() == "") {
  768. // return;
  769. // }
  770. // var _this = this;
  771. // setTimeout(function() {
  772. // if(ti === re && ti !== reEnd) {
  773. // checkZy(_this, ti);
  774. // }
  775. //
  776. // }, 500)
  777. //
  778. // })
  779. // $("#checkZy").on("focus", function() {
  780. // $(this).prev().find("span").text("最多选择5个资源");
  781. // })
  782. // $("#checkZy").on("blur", function() {
  783. // $(this).prev().find("span").text("");
  784. // })
  785. //
  786. // function checkZy(_this, prd) {
  787. // reEnd = prd;
  788. // $.ajax({
  789. // "url": "/ajax/resource/lq/publish/org",
  790. // "type": "get",
  791. // "data": {
  792. // "orgid": orgId,
  793. // "resourceName": $("#checkZy").val(),
  794. // "rows": 5
  795. // },
  796. // "success": function(data) {
  797. // if(data.success) {
  798. // if(data.data != "") {
  799. // if(reEnd == prd) {
  800. // $(_this).next().removeClass("displayNone");
  801. // $("#resouselist").html("");
  802. // for(var i = 0; i < data.data.length; i++) {
  803. // var itemlist = '<li id="usid" class="flexCenter" >' +
  804. // '<p class="h1Font ellipsisSty-2 childElement" id="resourceName"></p>' +
  805. // '<div class="deleteThis"></div></li>'
  806. // $itemlist = $(itemlist);
  807. // $("#resouselist").append($itemlist);
  808. // var datalist = data.data[i];
  809. // $itemlist.attr("data-id", datalist.resourceId);
  810. // $itemlist.find("#resourceName").text(datalist.resourceName);
  811. //
  812. // }
  813. // }
  814. // } else {
  815. // $(_this).next().addClass("displayNone");
  816. // }
  817. // } else {
  818. // $(_this).next().addClass("displayNone");
  819. // }
  820. // },
  821. // "error": function() {
  822. // $.MsgBox.Alert('提示', '链接服务器超时')
  823. // }
  824. // });
  825. // }
  826. // $("#resouselist").on("click", "li", function() {
  827. // var _this = this;
  828. // expertlist(_this, "该资源已选择");
  829. // });
  830. //
  831. // function resourcesli() {
  832. // var resourcesarray = [];
  833. // $("#resources li").each(function(i) {
  834. // var liid = $(this).attr("data-id");
  835. // resourcesarray.push(liid);
  836. // });
  837. // return resourcesarray;
  838. // }
  839. // //点击右侧搜索出的专家和资源列表
  840. // function expertlist(_this, title) {
  841. // var liId = $(_this).html();
  842. // var plength = $(_this).parents(".otherBlock").find(".addexpert li");
  843. // for(var i = 0; i < plength.length; i++) {
  844. // if(plength[i].innerHTML == liId) {
  845. // $(_this).parents(".otherBlock").find(".aboutTit span").text(title);
  846. // $(_this).parents(".otherBlock").find(".form-drop").addClass("displayNone");
  847. // $(_this).parents(".otherBlock").find("input").val("");
  848. // return;
  849. // }
  850. // }
  851. // if(plength.length >= 4) {
  852. // $(_this).parents(".otherBlock").find("input").hide();
  853. // $(_this).parents(".otherBlock").find(".addexpert").append($(_this).clone());
  854. // $(_this).parents(".otherBlock").find("input").val("");
  855. // $(_this).parents(".otherBlock").find(".form-drop").addClass("displayNone");
  856. // } else {
  857. // $(_this).parents(".otherBlock").find(".addexpert").append($(_this).clone());
  858. // $(_this).parents(".otherBlock").find("input").val("");
  859. // $(_this).parents(".otherBlock").find(".form-drop").addClass("displayNone");
  860. // }
  861. // }
  862. //
  863. // //删除右侧搜索出的专家和资源
  864. // $(".addexpert").on("click", ".deleteThis", function() {
  865. // var plength = $(this).parent().parent().find("li").length;
  866. // if(plength < 6) {
  867. // $(this).parents(".otherBlock").find("input").show();
  868. // }
  869. // $(this).parent().remove();
  870. // })
  871. // if(sevriceId) {
  872. // ajaxRequist("/ajax/ware/res", {
  873. // "id": sevriceId
  874. // }, "get", function(data) {
  875. // var $data = data.data;
  876. // if($data.length>=5) {
  877. // $("#checkZy").hide();
  878. // }
  879. // for(var i = 0; i < $data.length; i++) {
  880. // (function(i) {
  881. // ajaxRequist("/ajax/resource/queryOne", {
  882. // "resourceId": $data[i].resource
  883. // }, "get", function(data) {
  884. // var $data = data.data;
  885. // var itemlist = '<li id="usid" class="flexCenter" >' +
  886. // '<p class="h1Font ellipsisSty-2 childElement" id="resourceName"></p>' +
  887. // '<div class="deleteThis"></div></li>'
  888. // var datalist = data.data;
  889. // var $itemlist=$(itemlist);
  890. // $("#resources").append($itemlist);
  891. // $itemlist.attr("data-id", datalist.resourceId);
  892. // $itemlist.find("#resourceName").text(datalist.resourceName);
  893. //
  894. // })
  895. // })(i)
  896. // }
  897. //
  898. // })
  899. // }
  900. })