left.vue 4.4 KB

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