index.ftl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>文章</title>
  6. <#include "../../include/head-file.ftl">
  7. </head>
  8. <body style="overflow: hidden">
  9. <div id="index" v-cloak>
  10. <!--左侧-->
  11. <el-container class="index-menu">
  12. <div class="left-tree" style="position:relative;">
  13. <el-scrollbar style="height: 100%;">
  14. <el-tree
  15. :indent="5"
  16. v-loading="loading"
  17. highlight-current
  18. :expand-on-click-node="false"
  19. default-expand-all
  20. :empty-text="emptyText"
  21. :data="treeData"
  22. :props="defaultProps"
  23. @node-click="handleNodeClick"
  24. style="padding: 10px;height: 100%;">
  25. <span class="custom-tree-node" slot-scope="{ node, data }" >
  26. <span :style="data.categoryType == '3' ? 'color: #dcdfe6' : ''" :title="data.categoryTitle">{{ data.categoryTitle }}</span>
  27. </span>
  28. </el-tree>
  29. </el-scrollbar>
  30. </div>
  31. <iframe :src="action" class="ms-iframe-style">
  32. </iframe>
  33. </el-container>
  34. </div>
  35. </body>
  36. </html>
  37. <script>
  38. var indexVue = new Vue({
  39. el: "#index",
  40. data: {
  41. action: "",
  42. //跳转页面
  43. defaultProps: {
  44. children: 'children',
  45. label: 'categoryTitle'
  46. },
  47. treeData: [],
  48. loading: true,
  49. emptyText: ''
  50. },
  51. methods: {
  52. handleNodeClick: function (data) {
  53. if (data.categoryType == '1') {
  54. this.action = ms.manager + "/cms/content/main.do?categoryId=" + data.id;
  55. } else if (data.categoryType == '2') {
  56. this.action = ms.manager + "/cms/content/form.do?categoryId=" + data.id + "&type=2";
  57. //id=0时为最顶级节点全部节点
  58. } else if (data.id == 0){
  59. this.action = ms.manager + "/cms/content/main.do";
  60. }
  61. },
  62. treeList: function () {
  63. var that = this;
  64. this.loadState = false;
  65. this.loading = true;
  66. ms.http.get(ms.manager + "/cms/category/list.do", {
  67. pageSize: 999
  68. }).then(function (res) {
  69. if (that.loadState) {
  70. that.loading = false;
  71. } else {
  72. that.loadState = true;
  73. }
  74. if (!res.result || res.data.total <= 0) {
  75. that.emptyText = '暂无数据';
  76. that.treeData = [];
  77. } else {
  78. that.emptyText = '';
  79. // 过滤掉栏目类型为链接属性
  80. that.treeData = res.data.rows;
  81. that.treeData = ms.util.treeData(that.treeData, 'id', 'categoryId', 'children');
  82. that.treeData = [{
  83. id: 0,
  84. categoryTitle: '全部',
  85. children: that.treeData
  86. }];
  87. }
  88. }).catch(function (err) {
  89. console.log(err);
  90. });
  91. setTimeout(function () {
  92. if (that.loadState) {
  93. that.loading = false;
  94. } else {
  95. that.loadState = true;
  96. }
  97. }, 500);
  98. }
  99. },
  100. mounted: function () {
  101. this.action = ms.manager + "/cms/content/main.do";
  102. this.treeList();
  103. }
  104. });
  105. </script>
  106. <style>
  107. #index .index-menu {
  108. height: 100vh;
  109. min-height: 100vh;
  110. min-width: 140px;
  111. }
  112. #index .ms-iframe-style {
  113. width: 100%;
  114. height: 100%;
  115. border: 0;
  116. }
  117. #index .index-menu .el-main {
  118. padding: 0;
  119. }
  120. #index .left-tree{
  121. min-height: 100vh;
  122. background: #fff;
  123. width: 180px;
  124. border-right: solid 1px #e6e6e6;
  125. }
  126. #index .index-menu .el-main .index-menu-menu .el-menu-item {
  127. min-width: 140px;
  128. width: 100%;
  129. }
  130. #index .index-menu .el-main .index-material-item {
  131. min-width: 100% !important
  132. }
  133. #index .index-menu-menu-item , .el-submenu__title {
  134. height: 40px !important;
  135. line-height: 46px !important;
  136. }
  137. body{
  138. overflow: hidden;
  139. }
  140. </style>