説明なし

index.js 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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-articleid").each(function() {
  22. var $e = $(this);
  23. var articleid = $e.attr("articleid");
  24. if (articleid) {
  25. util.get("/ajax/content/lwCount", {articleId: articleid}, function (data) {
  26. $e.text(data);
  27. }, {});
  28. $e.removeClass("hand-articleid");
  29. }
  30. });
  31. root.find(".hand-collectionid").each(function() {
  32. var $e = $(this);
  33. var collectionid = $e.attr("collectionid");
  34. util.get("/ajax/content/countProfessor",{id:collectionid,type:type},function(data){
  35. $e.text(data);
  36. },{});
  37. $e.removeClass("hand-collectionid");
  38. });
  39. if (type == 3 || type==2 ) {
  40. $(".create").hide();
  41. } else {
  42. $(".publish").hide();
  43. }
  44. });
  45. root.find(".opt-query").on("click", function () {
  46. pdg.load();
  47. });
  48. pdg.load();
  49. root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
  50. var $this = $(this);
  51. $this.toggleClass("checked");
  52. if ($this.hasClass("checked")) {
  53. root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
  54. } else {
  55. root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
  56. }
  57. });
  58. root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
  59. var $this = $(this);
  60. $this.toggleClass("checked");
  61. });
  62. root.find(".opt-view").on("click", function () {
  63. var $org = root.find("td.opt-check>i.checked");
  64. var contentType = pdg.queryParam().contentType;
  65. if ($org.length) {
  66. if ($org.length > 1) {
  67. util.alert("只能选择一个用户");
  68. } else {
  69. if ( contentType==3){//文章
  70. window.open('http://www.ekexiu.com/articalShow.html?articleId=' + $org.attr("contentId"));
  71. }else if ( contentType== 2){//资源
  72. window.open('http://www.ekexiu.com/resourceShow.html?resourceId=' + $org.attr("contentId"));
  73. }else if ( contentType==4){//专利
  74. window.open('http://www.ekexiu.com/patentShow.html?patentId=' + $org.attr("contentId"));
  75. }else if ( contentType==5){//论文
  76. window.open('http://www.ekexiu.com/paperShow.html?paperId=' + $org.attr("contentId"));
  77. }
  78. }
  79. } else {
  80. util.alert("请选择一个用户");
  81. }
  82. });
  83. }, mainDestory: function () {
  84. }
  85. };
  86. });
  87. });