|
@@ -35,7 +35,6 @@ import moment from 'moment'
|
|
|
import breadcrumb from '../components/breadcrumb.vue'
|
|
|
import { createNamespacedHelpers } from 'vuex'
|
|
|
const { mapState, mapActions } = createNamespacedHelpers('menu')
|
|
|
-const { mapState: columnmapState, mapActions: columnmapActions } = createNamespacedHelpers('column')
|
|
|
const { mapState: contentnmapState, mapActions: contentmapActions } = createNamespacedHelpers('content')
|
|
|
export default {
|
|
|
props: {
|
|
@@ -56,11 +55,10 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['getmenu']),
|
|
|
- ...columnmapActions(['getcolumn']),
|
|
|
...contentmapActions(['getcontent']),
|
|
|
// 分页
|
|
|
async currentChange (e) {
|
|
|
- await this.getcontent({ code: this.columnitems[0].code, skip: e - 1, limit: this.pageSize })
|
|
|
+ await this.getcontent({ code: this.id, skip: e - 1, limit: this.pageSize })
|
|
|
this.contentlist = [...this.contentitems]
|
|
|
this.total = this.contenttotal
|
|
|
},
|
|
@@ -73,20 +71,17 @@ export default {
|
|
|
window.open(routeData.href)
|
|
|
},
|
|
|
async filteritem () {
|
|
|
- const items = this.items.filter(p => p.code === this.id)[0]
|
|
|
- this.item = items.name || ''
|
|
|
- this.en = items.en || ''
|
|
|
- const res = await this.getcolumn(items)
|
|
|
- if (res.data.errcode === 0) {
|
|
|
- if (this.columnitems.length > 0) {
|
|
|
- await this.getcontent({ code: this.columnitems[0].code, skip: 0, limit: this.pageSize })
|
|
|
- this.contentlist = [...this.contentitems]
|
|
|
- this.total = this.contenttotal
|
|
|
- } else {
|
|
|
- this.contentlist = []
|
|
|
- this.total = 0
|
|
|
- }
|
|
|
+ let items = {}
|
|
|
+ if (this.id !== '-1') {
|
|
|
+ items = this.items.filter(p => p.code === this.id)[0]
|
|
|
}
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ this.item = items.name
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ this.en = items.en
|
|
|
+ await this.getcontent({ code: this.id, skip: 0, limit: this.pageSize })
|
|
|
+ this.contentlist = [...this.contentitems]
|
|
|
+ this.total = this.contenttotal
|
|
|
}
|
|
|
},
|
|
|
async mounted () {
|
|
@@ -95,7 +90,6 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['items']),
|
|
|
- ...columnmapState({ columnitems: 'items' }),
|
|
|
...contentnmapState({ contentitems: 'items', contenttotal: 'total' })
|
|
|
},
|
|
|
watch: {
|