_id.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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"><img src="/images/help/help-title.png"></div>
  13. <div class="help-center-title">
  14. <a v-bind:href="'/help/home'" style="font-size: 14px">帮助中心首页<i class="fa fa-angle-right"></i></a>
  15. <span>
  16. <nuxt-link :to="`/help/home`" class="box" style="font-size: 16px"><span>{{helpTitle.item}}</span><i class="fa fa-close"></i></nuxt-link>
  17. </span>
  18. </div>
  19. <!-- 文章列表-->
  20. <div class="help-center-list">
  21. <h4>问题知识列表</h4>
  22. <ul>
  23. <li v-for="list in helpList">
  24. <em></em>
  25. <nuxt-link :to="`/help/helpDetail/${list.num}`" v-text="list.title" :title="list.title"></nuxt-link>
  26. </li>
  27. <li v-if="helpList.length == 0" style="color: #999;">暂无数据!</li>
  28. </ul>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import { left, helpHeader } from '~components/help'
  39. // 升序
  40. function compare (propertyName) {
  41. return function (object1, object2) {
  42. let value1 = object1[propertyName]
  43. let value2 = object2[propertyName]
  44. if (value1 > value2) {
  45. return 1
  46. } else if (value1 < value2) {
  47. return -1
  48. } else {
  49. return 0
  50. }
  51. }
  52. }
  53. export default {
  54. name: 'help',
  55. data () {
  56. return {
  57. helpList: {},
  58. getFlag: true,
  59. helpTitle: {}
  60. }
  61. },
  62. components: {
  63. left,
  64. helpHeader
  65. },
  66. mounted () {
  67. this.$http.get('/api/help-service/issues', {params: { navId: this.$route.params.id }})
  68. .then(response => {
  69. this.helpList = response.data.sort(compare('detno'))
  70. })
  71. this.getFlag = false
  72. let id = this.$route.params.id
  73. this.$http.get(`/api/help-service/${id}`)
  74. .then(response => {
  75. this.helpTitle = response.data
  76. })
  77. },
  78. updated () {
  79. if (this.getFlag) {
  80. this.$http.get('/api/help-service/issues', {params: { navId: this.$route.params.id }})
  81. .then(response => {
  82. this.helpList = response.data.sort(compare('detno'))
  83. })
  84. this.getFlag = false
  85. let id = this.$route.params.id
  86. this.$http.get(`/api/help-service/${id}`)
  87. .then(response => {
  88. this.helpTitle = response.data
  89. })
  90. }
  91. },
  92. fetch ({ store, route }) {
  93. return Promise.all([
  94. // store.dispatch('loadHelpSnapsho', { parentId: 0 }),
  95. // store.dispatch('loadHelpList', { navId: route.params.id }),
  96. // store.dispatch('loadHelpTitle', route.params)
  97. ])
  98. },
  99. computed: {
  100. // helpTitle () {
  101. // return this.$store.state.help.title.data
  102. // }
  103. // helpList () {
  104. // return this.$store.state.help.helplist.data.sort(compare('detno'))
  105. // }
  106. }
  107. }
  108. </script>
  109. <style>
  110. @import '~assets/scss/help.css';
  111. </style>