_id.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div v-show="showAlone">
  3. <help-header></help-header>
  4. <div id="main">
  5. <div class="container" style="padding: 0; width: 1190px;">
  6. <div style="display: inline-block; width: 100%; margin: 0 auto">
  7. <div class="left">
  8. <left></left>
  9. </div>
  10. <div class="right">
  11. <div class="help-center">
  12. <div class="help-head">
  13. <nuxt-link to="/help/home"><img src="/images/help/help-title.png"></nuxt-link>
  14. </div>
  15. <div class="help-center-title">
  16. <nuxt-link :to="'/help/home'" style="font-size: 14px">帮助中心首页<i class="fa fa-angle-right"></i></nuxt-link>
  17. <span>
  18. <nuxt-link :to="`/help/home`" class="box" style="font-size: 16px"><span>{{helpTitle.item}}</span><i class="fa fa-close"></i></nuxt-link>
  19. </span>
  20. </div>
  21. <!-- 文章列表-->
  22. <div class="help-center-list">
  23. <h4>问题知识列表</h4>
  24. <ul>
  25. <li v-for="list in helpList">
  26. <em></em>
  27. <nuxt-link :to="`/help/helpDetail/${list.num}`" v-text="list.title" :title="list.title"></nuxt-link>
  28. </li>
  29. <li v-if="helpList.length == 0" style="color: #999;">暂无数据!</li>
  30. </ul>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. // 升序
  41. function compare (property) {
  42. return function (a, b) {
  43. var value1 = a[property]
  44. var value2 = b[property]
  45. return value1 - value2
  46. }
  47. }
  48. import { left, helpHeader } from '~components/help'
  49. export default {
  50. name: 'help',
  51. data () {
  52. return {
  53. showAlone: false
  54. }
  55. },
  56. components: {
  57. left,
  58. helpHeader
  59. },
  60. fetch ({ store, route }) {
  61. return Promise.all([
  62. store.dispatch('loadHelpSnapsho', { parentId: 0 }),
  63. store.dispatch('loadHelpList', { navId: route.params.id }),
  64. store.dispatch('loadHelpTitle', route.params)
  65. ])
  66. },
  67. created () {
  68. if(this.helpList && this.helpList.length === 1) {
  69. this.$router.push(`/help/helpDetail/${this.helpList[0].num}`)
  70. } else {
  71. this.showAlone = true
  72. }
  73. },
  74. computed: {
  75. helpTitle () {
  76. return this.$store.state.help.title.data
  77. },
  78. helpList () {
  79. return [...this.$store.state.help.helplist.data].sort(compare('detno'))
  80. }
  81. }
  82. }
  83. </script>
  84. <style scoped>
  85. @import '~assets/scss/help.css';
  86. </style>