left.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <div class="help-list">
  3. <h2>帮助中心</h2>
  4. <!--<ul class="list-unstyled" style="margin-top: 10px;">
  5. <li v-for="nav01 in helps">
  6. <a :class="{'cur': nav01.isHide}" @click="toggleNav(nav01)"><span>{{nav01.item}}</span></a>
  7. <ul class="list-unstyled list-body" v-if="!nav01.isHide">
  8. <li v-for="nav02 in nav01.children">
  9. <nuxt-link :to="`/help/helpList/${nav02.id}`"><span v-text="nav02.item"></span></nuxt-link>
  10. </li>
  11. </ul>
  12. </li>
  13. </ul>-->
  14. <el-tree :data="helps" :props="defaultProps" :highlight-current="true" default-expand-all @node-click="openList"></el-tree>
  15. </div>
  16. </template>
  17. <script>
  18. // 升序
  19. function compare (propertyName) {
  20. return function (object1, object2) {
  21. let value1 = object1[propertyName]
  22. let value2 = object2[propertyName]
  23. if (value1 > value2) {
  24. return 1
  25. } else if (value1 > value2) {
  26. return -1
  27. } else {
  28. return 0
  29. }
  30. }
  31. }
  32. export default {
  33. name: 'left',
  34. data () {
  35. return {
  36. defaultProps: {
  37. children: 'children',
  38. label: 'item'
  39. },
  40. getFlag: true,
  41. helps: {}
  42. }
  43. },
  44. mounted () {
  45. this.$http.get('/api/help-service/helps', {params: { parentId: 0 }})
  46. .then(response => {
  47. console.log(response.data)
  48. this.helps = response.data.sort(compare('detno'))
  49. // let help = this.helps
  50. for (let i; i < this.helps.length; i++) {
  51. this.helps[i] = this.helps[i].children.sort(compare('detno'))
  52. }
  53. console.log(this.helps)
  54. })
  55. this.getFlag = false
  56. },
  57. computed: {
  58. // helps () {
  59. // return this.$store.state.help.snapsho.data.sort(compare('detno'))
  60. // }
  61. },
  62. methods: {
  63. openList (data) {
  64. if (data.level !== 1) {
  65. this.$router.push({ name: 'help-helpList-id', params: { id: data.id } })
  66. }
  67. }
  68. }
  69. }
  70. </script>
  71. <style scoped>
  72. @import "~element-ui/lib/theme-default/index.css";
  73. .el-tree{
  74. border: none;
  75. min-height: 300px;
  76. }
  77. .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content,.el-tree-node:hover{
  78. background: none !important;
  79. }
  80. .el-tree-node__content:hover{
  81. background: none !important;
  82. }
  83. .el-tree-node__content:hover span{
  84. color: #5078cb;
  85. }
  86. .el-pagination .el-pager li.active{
  87. background-color: #5078cb;
  88. border-color: #337ab7;
  89. }
  90. .el-tree-node__expand-icon{
  91. font-family: "iconfont" !important;
  92. font-size: 14px;
  93. font-style: normal;
  94. -webkit-font-smoothing: antialiased;
  95. width: inherit;
  96. height: inherit;
  97. border: inherit;
  98. font-weight: bold;
  99. text-shadow: -1px 0px 0 #333;
  100. margin-right: 3px !important;
  101. }
  102. .el-tree-node__content{
  103. line-height: 30px;
  104. height: 30px;
  105. }
  106. .el-tree-node__expand-icon.is-leaf{
  107. visibility: hidden;
  108. }
  109. .el-tree-node__expand-icon:before{
  110. content: "\E621";
  111. }
  112. .help-list{
  113. width: 200px;
  114. background: #fff;
  115. border: #e8e8e8 1px solid;
  116. }
  117. .help-list h2{
  118. background: #5078cb;
  119. line-height: 34px;
  120. height: 34px;
  121. color: #fff;
  122. font-size: 14px;
  123. text-align: center;
  124. margin: 0;
  125. }
  126. .help-list ul{
  127. width: 200px;
  128. display: inline-block;
  129. }
  130. .help-list li {
  131. position: relative;
  132. line-height: 33px;
  133. font-size: 14px;
  134. color: #333;
  135. float: left;
  136. width: 100%;
  137. padding-left: 10px;
  138. }
  139. .help-list li a {
  140. display: block;
  141. padding-left: 15px;
  142. text-decoration: none;
  143. color: #333;
  144. }
  145. .help-list li a:hover{
  146. color: #5078cb;
  147. cursor: pointer;
  148. }
  149. .help-list ul.list-body {
  150. /*display: none;*/
  151. color: #666;
  152. }
  153. .help-list ul.list-body.active {
  154. display: block;
  155. }
  156. .help-list ul.list-body li {
  157. float: none;
  158. background-image: none;
  159. min-height: 26px;
  160. line-height: 26px;
  161. font-size: 12px;
  162. }
  163. .help-list ul.list-body li a {
  164. padding-left: 15px;
  165. display: block;
  166. color: rgb(50,50,50);
  167. background: none;
  168. }
  169. .help-list ul.list-body li a:hover {
  170. color: #5078cb;
  171. cursor: pointer;
  172. }
  173. .help-list ul.list-body li a.cur,.help-list ul li a.cur{
  174. text-decoration: none;
  175. font-size: 14px;
  176. }
  177. .help-list .operate-icon {
  178. position: absolute;
  179. right: 20px;
  180. top: 1px;
  181. }
  182. .help-list li>ul>li>ul>li {
  183. padding-left: 30px;
  184. }
  185. </style>