left.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. .el-tree{
  73. border: none;
  74. min-height: 300px;
  75. }
  76. .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content,.el-tree-node:hover{
  77. background: none !important;
  78. }
  79. .el-tree-node__content:hover{
  80. background: none !important;
  81. }
  82. .el-tree-node__content:hover span{
  83. color: #5078cb;
  84. }
  85. .el-pagination .el-pager li.active{
  86. background-color: #5078cb;
  87. border-color: #337ab7;
  88. }
  89. .el-tree-node__expand-icon{
  90. font-family: "iconfont" !important;
  91. font-size: 14px;
  92. font-style: normal;
  93. -webkit-font-smoothing: antialiased;
  94. width: inherit;
  95. height: inherit;
  96. border: inherit;
  97. font-weight: bold;
  98. text-shadow: -1px 0px 0 #333;
  99. margin-right: 3px !important;
  100. }
  101. .el-tree-node__content{
  102. line-height: 30px;
  103. height: 30px;
  104. }
  105. .el-tree-node__expand-icon.is-leaf{
  106. visibility: hidden;
  107. }
  108. .el-tree-node__expand-icon:before{
  109. content: "\E621";
  110. }
  111. .help-list{
  112. width: 200px;
  113. background: #fff;
  114. border: #e8e8e8 1px solid;
  115. }
  116. .help-list h2{
  117. background: #5078cb;
  118. line-height: 34px;
  119. height: 34px;
  120. color: #fff;
  121. font-size: 14px;
  122. text-align: center;
  123. margin: 0;
  124. }
  125. .help-list ul{
  126. width: 200px;
  127. display: inline-block;
  128. }
  129. .help-list li {
  130. position: relative;
  131. line-height: 33px;
  132. font-size: 14px;
  133. color: #333;
  134. float: left;
  135. width: 100%;
  136. padding-left: 10px;
  137. }
  138. .help-list li a {
  139. display: block;
  140. padding-left: 15px;
  141. text-decoration: none;
  142. color: #333;
  143. }
  144. .help-list li a:hover{
  145. color: #5078cb;
  146. cursor: pointer;
  147. }
  148. .help-list ul.list-body {
  149. /*display: none;*/
  150. color: #666;
  151. }
  152. .help-list ul.list-body.active {
  153. display: block;
  154. }
  155. .help-list ul.list-body li {
  156. float: none;
  157. background-image: none;
  158. min-height: 26px;
  159. line-height: 26px;
  160. font-size: 12px;
  161. }
  162. .help-list ul.list-body li a {
  163. padding-left: 15px;
  164. display: block;
  165. color: rgb(50,50,50);
  166. background: none;
  167. }
  168. .help-list ul.list-body li a:hover {
  169. color: #5078cb;
  170. cursor: pointer;
  171. }
  172. .help-list ul.list-body li a.cur,.help-list ul li a.cur{
  173. text-decoration: none;
  174. font-size: 14px;
  175. }
  176. .help-list .operate-icon {
  177. position: absolute;
  178. right: 20px;
  179. top: 1px;
  180. }
  181. .help-list li>ul>li>ul>li {
  182. padding-left: 30px;
  183. }
  184. </style>