_id.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div>
  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. components: {
  52. left,
  53. helpHeader
  54. },
  55. fetch ({ store, route }) {
  56. return Promise.all([
  57. store.dispatch('loadHelpSnapsho', { parentId: 0 }),
  58. store.dispatch('loadHelpList', { navId: route.params.id }),
  59. store.dispatch('loadHelpTitle', route.params)
  60. ])
  61. },
  62. mounted () {
  63. if(this.helpList && this.helpList.length === 1) {
  64. this.$router.push(`/help/helpDetail/${this.helpList[0].num}`)
  65. }
  66. },
  67. computed: {
  68. helpTitle () {
  69. return this.$store.state.help.title.data
  70. },
  71. helpList () {
  72. return [...this.$store.state.help.helplist.data].sort(compare('detno'))
  73. }
  74. }
  75. }
  76. </script>
  77. <style scoped>
  78. @import '~assets/scss/help.css';
  79. </style>