portal html css js resource

serviceList.js 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. $(".issueSpan").click(function(e){
  10. UnauthorizedUser()
  11. e.preventDefault();
  12. })
  13. function UnauthorizedUser() {
  14. $.ajax({
  15. url: "/ajax/professor/qaOrgAuth",
  16. type: "GET",
  17. timeout: 10000,
  18. dataType: "json",
  19. async:"true",
  20. data: {
  21. "orgId": orgId,
  22. "orgAuth": 1
  23. },
  24. success: function(data, textState) {
  25. if(data.success) {
  26. if(data.data.length==0) {
  27. $.MsgBox.Confirm("提示", "请至少认证1位员工?", function(){
  28. location.href="cmp-UnstaffList.html";
  29. });
  30. $("#mb_btn_no").val("稍后再说");
  31. $("#mb_btn_ok").val("去认证");
  32. }else if(data.data.length>0){
  33. window.open("cmp-sevriceIssue.html")
  34. }
  35. }
  36. },
  37. error: function(XMLHttpRequest, textStats, errorThrown) {
  38. $.MsgBox.Alert('提示', '服务器请求失败')
  39. }
  40. })
  41. }
  42. /*资源列表查询*/
  43. function getRecourceMe(n,isbind,num) {
  44. var resourceNameVa=$("#resouceName").val();
  45. var $info={};
  46. $info.oid=orgId;
  47. $info.pageSize=10;
  48. if(resourceNameVa !="") {
  49. $info.key=resourceNameVa;
  50. }
  51. $info.pageNo=n;
  52. $.ajax({
  53. "url": "/ajax/ware/pq/org/search",
  54. "type": "GET",
  55. "success": function(data) {
  56. if(data.success) {
  57. $("#resourceList").html("");
  58. if(num==1) {
  59. if(data.data.total==0) {
  60. $("#noresource").removeClass("displayNone");
  61. $(".noContip").text("您还未发布任何服务");
  62. return;
  63. }else{
  64. $("#noresource").addClass("displayNone");
  65. }
  66. }else{
  67. if(data.data.data.length==0) {
  68. $("#noresource").removeClass("displayNone");
  69. $(".noContip").text("没有符合该搜索条件的内容");
  70. return;
  71. }else{
  72. $("#noresource").addClass("displayNone");
  73. }
  74. }
  75. resourceHtml(data.data.data);
  76. if(isbind == true) {
  77. $(".tcdPageCode").createPage({
  78. pageCount: Math.ceil(data.data.total / 10),
  79. current: data.data.pageNo,
  80. backFn: function(p) {
  81. getRecourceMe(p,false);
  82. }
  83. });
  84. }
  85. }
  86. },
  87. "data": $info,
  88. dataType: "json",
  89. 'error': function() {
  90. $.MsgBox.Alert('提示', '服务器连接超时!');
  91. }
  92. });
  93. }
  94. getRecourceMe(1,true,1);
  95. function resourceHtml($data) {
  96. for(var i = 0; i < $data.length; i++) {
  97. var imgSrc="../images/default-service.jpg";
  98. var oTime,pageview="",draftLable="",oHtml,oLi='';
  99. if($data[i].images) {
  100. imgSrc="/data/ware"+$data[i].images.split(",")[0]
  101. }
  102. if($data[i].state=='2') {
  103. console.log($data[i].modifyTime)
  104. oTime="修改于 "+TimeTr($data[i].modifyTime);
  105. draftLable='<span class="draftLable">草稿</span>';
  106. oHtml="cmp-sevriceIssue.html";
  107. oLi="class='draftList'"
  108. }else if($data[i].state=='1'){
  109. console.log($data[i].createTime)
  110. oTime="发布于 "+TimeTr($data[i].createTime);
  111. pageview='<li><span>浏览量 '+$data[i].pageViews+'</span></li>';
  112. oHtml="../sevriceShow.html"
  113. }
  114. var oStr='<li '+oLi+'>'+
  115. '<a href="'+oHtml+'?sevriceId='+$data[i].id+'" target="_blank">'+
  116. '<div class="madiaHead resouseHead" style="background-image: url('+imgSrc+');"></div>' +
  117. '<div class="madiaInfo">'+
  118. '<p class="h1Font ellipsisSty">'+$data[i].name+'</p>'+
  119. '<ul class="showliTop h2Font clearfix">'+
  120. '<li><span>'+oTime+'</span></li>'+pageview+'<li><span id="oop" style="color:#e03b43;"></span></li>' +
  121. '</ul><p><span>'+draftLable+'</span><span class="crel" style="margin-left:10px"></span></p>' +
  122. '</div>'+
  123. '</a>'+
  124. '<ul class="madiaEdit">'+
  125. '<li><span class="deteleThis2" data-id="'+$data[i].id+'"></span></li>'+
  126. '<li><span class="editThis" data-id="'+$data[i].id+'"></span></li>'+
  127. '</ul>'+
  128. '</li>'
  129. var $os = $(oStr);
  130. $("#resourceList").append($os);
  131. if($data[i].status == 2) {
  132. if($data[i].num==0)
  133. $os.find(".crel").text("未设置联系人");
  134. } else {
  135. if($data[i].num==0)
  136. $os.find("#oop").text("未设置联系人");
  137. }
  138. }
  139. }
  140. /*点击修改跳转修改页面*/
  141. $("#resourceList").on("click",".editThis",function(){
  142. location.href="cmp-sevriceIssue.html?sevriceId="+$(this).attr("data-id");
  143. })
  144. /*点击删除跳转修改页面*/
  145. $("#resourceList").on("click",".deteleThis2",function(){
  146. resourceId=$(this).attr("data-id");
  147. $.MsgBox.Confirm("提示", "确认删除该资源?",deleResource);
  148. })
  149. /*删除函数*/
  150. function deleResource() {
  151. $.ajax({
  152. "url": "/ajax/ware/delete",
  153. "type": "POST",
  154. "success": function(data) {
  155. if(data.success) {
  156. getRecourceMe(1,false);
  157. }
  158. },
  159. "data": {"id":resourceId},
  160. "beforeSend": function() { },
  161. "contentType": "application/x-www-form-urlencoded",
  162. dataType: "json"
  163. });
  164. }
  165. /*输入资源名称限制字数*/
  166. $("#resouceName").bind({
  167. keyup: function() {
  168. if($(this).val().length > 30) {
  169. $(this).val($(this).val().substr(0, 30));
  170. }
  171. }
  172. });
  173. /*点击搜索*/
  174. $(".searchSpan").click(function(){
  175. $(".tcdPageCode").remove();
  176. $(".aboutRes").append('<div class="tcdPageCode"></div>');
  177. getRecourceMe(1,true);
  178. })
  179. })