portal html css js resource

serviceList.js 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. $(document).ready(function() {
  2. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  3. $(".workmenu>ul>li.serIcon").addClass("nowLi");
  4. var orgId = $.cookie('orgId');
  5. if(orgId == "" || orgId == null || orgId == "null") {
  6. location.href = "cmp-settled-log.html";
  7. }
  8. var resourceId;
  9. function companyAuthentState() {
  10. $.ajax({
  11. url: '/ajax/org/authStatus',
  12. type: "GET",
  13. timeout: 10000,
  14. dataType: "json",
  15. data: {
  16. "id": orgId
  17. },
  18. beforeSend: function() {},
  19. success: function(data, textState) {
  20. if(data.success) {
  21. console.log(data);
  22. if(data.data == 3) {
  23. $("#companyDemandList").show();
  24. } else {
  25. $("#identityState").show();
  26. }
  27. }
  28. },
  29. error: function(XMLHttpRequest, textStats, errorThrown) {
  30. $.MsgBox.Alert('提示', '服务器请求失败')
  31. }
  32. })
  33. }
  34. companyAuthentState();
  35. $(".issueSpan").click(function(e){
  36. UnauthorizedUser()
  37. e.preventDefault();
  38. })
  39. function UnauthorizedUser() {
  40. $.ajax({
  41. url: "/ajax/professor/qaOrgAuth",
  42. type: "GET",
  43. timeout: 10000,
  44. dataType: "json",
  45. async:"true",
  46. data: {
  47. "orgId": orgId,
  48. "orgAuth": 1
  49. },
  50. success: function(data, textState) {
  51. if(data.success) {
  52. if(data.data.length==0) {
  53. $.MsgBox.Confirm("提示", "请至少认证1位员工</br><span style='margin-top:20px;font-size:14px;color:#ccc;'>选择认证员工作为联系人,代表企业与对方沟通。</span>", function(){
  54. location.href="cmp-staffList.html";
  55. });
  56. $("#mb_btn_no").val("稍后再说");
  57. $("#mb_btn_ok").val("去认证");
  58. }else if(data.data.length>0){
  59. window.open("cmp-sevriceIssue.html")
  60. }
  61. }
  62. },
  63. error: function(XMLHttpRequest, textStats, errorThrown) {
  64. $.MsgBox.Alert('提示', '服务器请求失败')
  65. }
  66. })
  67. }
  68. /*资源列表查询*/
  69. function getRecourceMe(n,isbind,num) {
  70. var resourceNameVa=$("#resouceName").val();
  71. var $info={};
  72. $info.oid=orgId;
  73. $info.pageSize=10;
  74. if(resourceNameVa !="") {
  75. $info.key=resourceNameVa;
  76. }
  77. $info.pageNo=n;
  78. $.ajax({
  79. "url": "/ajax/ware/pq/org/search",
  80. "type": "GET",
  81. "success": function(data) {
  82. if(data.success) {
  83. $("#resourceList").html("");
  84. if(num==1) {
  85. if(data.data.total==0) {
  86. $("#noresource").removeClass("displayNone");
  87. $(".noContip").text("您还未发布任何服务");
  88. return;
  89. }else{
  90. $("#noresource").addClass("displayNone");
  91. }
  92. }else{
  93. if(data.data.data.length==0) {
  94. $("#noresource").removeClass("displayNone");
  95. $(".noContip").text("没有符合该搜索条件的内容");
  96. return;
  97. }else{
  98. $("#noresource").addClass("displayNone");
  99. }
  100. }
  101. resourceHtml(data.data.data);
  102. if(isbind == true) {
  103. $(".tcdPageCode").createPage({
  104. pageCount: Math.ceil(data.data.total / 10),
  105. current: data.data.pageNo,
  106. backFn: function(p) {
  107. getRecourceMe(p,false);
  108. }
  109. });
  110. }
  111. }
  112. },
  113. "data": $info,
  114. dataType: "json",
  115. 'error': function() {
  116. $.MsgBox.Alert('提示', '服务器连接超时!');
  117. }
  118. });
  119. }
  120. getRecourceMe(1,true,1);
  121. function resourceHtml($data) {
  122. for(var i = 0; i < $data.length; i++) {
  123. var imgSrc="../images/default-service.jpg";
  124. var oTime,pageview="",draftLable="",oHtml,oLi='';
  125. if($data[i].images) {
  126. imgSrc="/data/ware"+$data[i].images.split(",")[0]
  127. }
  128. if($data[i].state=='2') {
  129. console.log($data[i].modifyTime)
  130. oTime="修改于 "+TimeTr($data[i].modifyTime);
  131. draftLable='<span class="draftLable">草稿</span>';
  132. oHtml="cmp-sevriceIssue.html";
  133. oLi="class='draftList'"
  134. }else if($data[i].state=='1'){
  135. console.log($data[i].createTime)
  136. oTime="发布于 "+TimeTr($data[i].createTime);
  137. pageview='<li><span>浏览量 '+$data[i].pageViews+'</span></li>';
  138. oHtml="../sevriceShow.html"
  139. }
  140. var oStr='<li '+oLi+'>'+
  141. '<a href="'+oHtml+'?sevriceId='+$data[i].id+'" target="_blank">'+
  142. '<div class="madiaHead resouseHead" style="background-image: url('+imgSrc+');"></div>' +
  143. '<div class="madiaInfo">'+
  144. '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>'+
  145. '<ul class="showliTop h2Font clearfix">'+
  146. '<li><span>'+oTime+'</span></li>'+pageview+'<li><span class="link-class oop"></span></li>' +
  147. '</ul><p>'+draftLable+'<span class="crel link-class"></span></p>' +
  148. '</div>'+
  149. '</a>'+
  150. '<ul class="madiaEdit">'+
  151. '<li><span class="deteleThis2" data-id="'+$data[i].id+'"></span></li>'+
  152. '<li><span class="editThis" data-id="'+$data[i].id+'"></span></li>'+
  153. '</ul>'+
  154. '</li>'
  155. var $os = $(oStr);
  156. $("#resourceList").append($os);
  157. if($data[i].status == 2) {
  158. resourecRel.call($os.find(".crel"), $data[i].id);
  159. } else {
  160. resourecRel.call($os.find(".oop"), $data[i].id);
  161. }
  162. }
  163. }
  164. /*点击修改跳转修改页面*/
  165. $("#resourceList").on("click",".editThis",function(){
  166. location.href="cmp-sevriceIssue.html?sevriceId="+$(this).attr("data-id");
  167. })
  168. /*点击删除跳转修改页面*/
  169. $("#resourceList").on("click",".deteleThis2",function(){
  170. resourceId=$(this).attr("data-id");
  171. $.MsgBox.Confirm("提示", "确认删除该资源?",deleResource);
  172. })
  173. /*删除函数*/
  174. function deleResource() {
  175. $.ajax({
  176. "url": "/ajax/ware/delete",
  177. "type": "POST",
  178. "success": function(data) {
  179. if(data.success) {
  180. getRecourceMe(1,false);
  181. }
  182. },
  183. "data": {"id":resourceId},
  184. "beforeSend": function() { },
  185. "contentType": "application/x-www-form-urlencoded",
  186. dataType: "json"
  187. });
  188. }
  189. /*输入资源名称限制字数*/
  190. $("#resouceName").bind({
  191. keyup: function() {
  192. if($(this).val().length > 30) {
  193. $(this).val($(this).val().substr(0, 30));
  194. }
  195. }
  196. });
  197. /*点击搜索*/
  198. $(".searchSpan").click(function(){
  199. $(".tcdPageCode").remove();
  200. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  201. getRecourceMe(1,true);
  202. })
  203. function professList(par) {
  204. $.ajax({
  205. "url": "/ajax/professor/qm",
  206. "type": "GET",
  207. "context": this,
  208. "traditional":true,
  209. "success": function(data) {
  210. if(data.success) {
  211. var $data = data.data;
  212. var arr = []
  213. if($data.length) {
  214. for(var i=0;i<$data.length;i++) {
  215. arr.push($data[i].name)
  216. }
  217. this.text("联系人 " + arr.join("、"))
  218. }
  219. }
  220. },
  221. "data": {
  222. "id": par
  223. },
  224. dataType: "json",
  225. 'error': function() {
  226. $.MsgBox.Alert('提示', '服务器连接超时!');
  227. }
  228. });
  229. }
  230. /*判断资源是否设置了资源联系人*/
  231. function resourecRel(rsd) {
  232. $.ajax({
  233. "url": "/ajax/ware/pro",
  234. "type": "GET",
  235. "context": this,
  236. "success": function(data) {
  237. if(data.success) {
  238. var $data = data.data;
  239. if($data.length == 0) {
  240. this.text("未设置联系人").css("color","#e03b43");
  241. }else {
  242. var arr = [];
  243. for(var i =0;i<$data.length;i++) {
  244. arr.push($data[i].professor)
  245. }
  246. professList.call(this,arr);
  247. }
  248. }
  249. },
  250. "data": {
  251. "id": rsd
  252. },
  253. dataType: "json",
  254. 'error': function() {
  255. $.MsgBox.Alert('提示', '服务器连接超时!');
  256. }
  257. });
  258. }
  259. })