| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <template>
- <div>
- <help-header></help-header>
- <div id="main">
- <div class="container" style="padding: 0; width: 1190px;">
- <div style="display: inline-block; width: 100%; margin: 0 auto">
- <div class="left">
- <left></left>
- </div>
- <div class="right">
- <div class="help-center">
- <div class="help-head">
- <nuxt-link to="/help/home"><img src="/images/help/help-title.png"></nuxt-link>
- </div>
- <div class="help-center-title">
- <nuxt-link style="font-size: 14px" :to="'/help/home'">帮助中心首页</nuxt-link>
- </div>
- <div class="help-center-home">
- <div v-for="nav01 in helpNav">
- <h4 v-text="nav01.item"></h4>
- <div class="row">
- <div v-for="nav02 in nav01.children">
- <em></em><a @click="goToUrl(nav02.id)" v-text="nav02.item"></a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- // 升序
- function compare (property) {
- return function (a, b) {
- var value1 = a[property]
- var value2 = b[property]
- return value1 - value2
- }
- }
- function sortBy (arr, property) {
- for (let i = 0; i < arr.length; i++) {
- for (let j = i; j < arr.length; j++) {
- if (arr[i][property] > arr[j][property]) {
- let tmp = arr[i]
- arr[i] = arr[j]
- arr[j] = tmp
- }
- }
- }
- return arr
- }
- import { left, helpHeader } from '~components/help'
- export default {
- name: 'help',
- components: {
- left,
- helpHeader
- },
- fetch ({ store }) {
- return Promise.all([
- store.dispatch('loadHelpSnapsho', { parentId: 0 })
- ])
- },
- computed: {
- helpNav () {
- let list = [...this.$store.state.help.snapsho.data]
- if (list.length > 0) {
- list = sortBy(list, 'detno')
- for (let i = 0; i < list.length; i++) {
- let tem = sortBy(list[i].children, 'detno')
- list[i].children = tem
- }
- }
- return list
- }
- },
- methods: {
- goToUrl (id) {
- this.$http.get('/api/help-service/issues', {params: {navId: id}}).then(res => {
- let helpList = res.data || res.data.sort(compare('detno'))
- if(helpList && helpList.length === 1) {
- this.$router.push(`/help/helpDetail/${helpList[0].num}`)
- } else {
- this.$router.push(`/help/helpList/${id}`)
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- @import '~assets/scss/help.css';
- </style>
|