Keine Beschreibung

index.js 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /**
  2. * Created by TT on 2017/7/27.
  3. */
  4. ;
  5. spa_define(function () {
  6. return $.use(["spa", "pagedatagrid", "util"], function (spa, pdgf, util) {
  7. return {
  8. main: function () {
  9. var root = spa.findInMain(".sys_content_index");
  10. var pdg = pdgf.build(root);
  11. pdg.code.shell("showDay", function (env) {
  12. if (env.cd && env.cd[this.k]) {
  13. var day = env.cd[this.k];
  14. return day.substring(0, 4) + "年" + day.substring(4, 6) + "月" + day.substring(6, 8) + "日 " + day.substring(8, 10) + ":" + day.substring(10, 12);
  15. }
  16. return "";
  17. });
  18. pdg.code.listen($.dict.doTransfer);
  19. pdg.code.listen(function(){
  20. var type = pdg.queryParam().contentType;
  21. root.find(".hand-objid").each(function() {
  22. var $e = $(this);
  23. var objid = $e.attr("objid");
  24. if (objid) {
  25. if(type == 3) {
  26. util.get("/ajax/content/lwCount", {articleId: objid}, function (data) {
  27. $e.text(data);
  28. }, {});
  29. $e.removeClass("hand-objid");
  30. }
  31. if (type == 4 ) {
  32. util.get("/ajax/content/lwCount/patent", {patentId: objid}, function (data) {
  33. $e.text(data);
  34. }, {});
  35. $e.removeClass("hand-objid");
  36. }
  37. if (type == 5 ) {
  38. util.get("/ajax/content/lwCount/paper", {paperId: objid}, function (data) {
  39. $e.text(data);
  40. }, {});
  41. $e.removeClass("hand-objid");
  42. }
  43. }
  44. });
  45. root.find(".hand-collectionid").each(function() {
  46. var $e = $(this);
  47. var collectionid = $e.attr("collectionid");
  48. util.get("/ajax/content/countProfessor",{id:collectionid,type:type},function(data){
  49. $e.text(data);
  50. },{});
  51. $e.removeClass("hand-collectionid");
  52. });
  53. root.find(".hand-agreeid").each(function() {
  54. var $e = $(this);
  55. var agreeid = $e.attr("agreeid");
  56. if (type == 4) {
  57. util.get("/ajax/patent/agreeCount",{id:agreeid},function(data){
  58. $e.text(data);
  59. },{});
  60. $e.removeClass("hand-agreeid");
  61. }
  62. if (type == 5) {
  63. util.get("/ajax/paper/agreeCount",{id:agreeid},function(data){
  64. $e.text(data);
  65. },{});
  66. $e.removeClass("hand-agreeid");
  67. }
  68. });
  69. if (type == 3 || type==2 ) {
  70. $(".create").hide();
  71. } else {
  72. $(".publish").hide();
  73. }
  74. });
  75. root.find(".opt-query").on("click", function () {
  76. pdg.load();
  77. });
  78. pdg.load();
  79. root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
  80. var $this = $(this);
  81. $this.toggleClass("checked");
  82. if ($this.hasClass("checked")) {
  83. root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
  84. } else {
  85. root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
  86. }
  87. });
  88. root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
  89. var $this = $(this);
  90. $this.toggleClass("checked");
  91. });
  92. root.find(".opt-view").on("click", function () {
  93. var $org = root.find("td.opt-check>i.checked");
  94. var time = $org.attr("createTime").substring(0,8);
  95. var shareId = $org.attr("shareId");
  96. var contentType = pdg.queryParam().contentType;
  97. if ($org.length) {
  98. if ($org.length > 1) {
  99. util.alert("只能选择一个用户");
  100. } else {
  101. if ( contentType==3){//文章
  102. // window.open('http://www.ekexiu.com/articalShow.html?articleId=' + $org.attr("contentId"));
  103. window.open('http://www.ekexiu.com/shtml/a/'+time+'/' + shareId+'.html');
  104. }else if ( contentType== 2){//资源
  105. window.open('http://www.ekexiu.com/resourceShow.html?resourceId=' + $org.attr("contentId"));
  106. }else if ( contentType==4){//专利
  107. // window.open('http://www.ekexiu.com/patentShow.html?patentId=' + $org.attr("contentId"));
  108. window.open('http://www.ekexiu.com/shtml/pt/'+time+'/' + shareId+'.html');
  109. }else if ( contentType==5){//论文
  110. // window.open('http://www.ekexiu.com/paperShow.html?paperId=' + $org.attr("contentId"));
  111. window.open('http://www.ekexiu.com/shtml/pp/'+time+'/' + shareId+'.html');
  112. }
  113. }
  114. } else {
  115. util.alert("请选择一个用户");
  116. }
  117. });
  118. }, mainDestory: function () {
  119. }
  120. };
  121. });
  122. });