|
@@ -6,10 +6,9 @@
|
|
|
<div class="box">
|
|
|
<titles :type="'正文'" :title="item" :en="en"></titles>
|
|
|
<div class="html">
|
|
|
- <h2>{{ pageitem && pageitem.title }}</h2>
|
|
|
- <h4>{{ pageitem && pageitem.shortTitle }}</h4>
|
|
|
- <p class="slug">{{ pageitem && pageitem.slug }}</p>
|
|
|
- <div class="content" v-html="pageitem && pageitem.content"></div>
|
|
|
+ <h2>{{ pagedetails && pagedetails.title }}</h2>
|
|
|
+ <p class="slug">{{ pagedetails && pagedetails.slug }}</p>
|
|
|
+ <div class="content" v-html="pagedetails && pagedetails.content"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -23,6 +22,7 @@ import titles from '../components/sidebar/title.vue'
|
|
|
import { createNamespacedHelpers } from 'vuex'
|
|
|
const { mapState, mapActions } = createNamespacedHelpers('menu')
|
|
|
const { mapState: pagemapState, mapActions: pagemapActions } = createNamespacedHelpers('page')
|
|
|
+const { mapState: bannermapState, mapActions: bannermapActions } = createNamespacedHelpers('banner')
|
|
|
export default {
|
|
|
props: {
|
|
|
id: String
|
|
@@ -36,27 +36,44 @@ export default {
|
|
|
return {
|
|
|
item: '',
|
|
|
en: '',
|
|
|
- code: ''
|
|
|
+ code: '',
|
|
|
+ pagedetails: {}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['getmenu']),
|
|
|
...pagemapActions(['getdetails']),
|
|
|
+ ...bannermapActions({ bannergetdetails: 'getdetails' }),
|
|
|
async filteritem () {
|
|
|
- this.code = localStorage.getItem('itemId')
|
|
|
- const items = this.items.filter(p => p.code === this.id)[0]
|
|
|
- this.item = items.name
|
|
|
- this.en = items.en
|
|
|
+ let items = {}
|
|
|
+ if (this.code !== '-1') {
|
|
|
+ items = this.items.filter(p => p.code === this.id)[0]
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ this.item = this.code == '-1' ? '轮播图' : items.name
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ this.en = this.code == '-1' ? 'image' : items.en
|
|
|
}
|
|
|
},
|
|
|
async mounted () {
|
|
|
+ this.code = localStorage.getItem('itemId')
|
|
|
const res = await this.getmenu()
|
|
|
if (res.data.errcode === 0) this.filteritem()
|
|
|
- this.getdetails({ code: this.id })
|
|
|
+ // eslint-disable-next-line eqeqeq
|
|
|
+ if (this.code == '-1') {
|
|
|
+ console.log(111)
|
|
|
+ await this.bannergetdetails({ id: this.id })
|
|
|
+ this.pagedetails = this.banneritem
|
|
|
+ } else {
|
|
|
+ console.log(222)
|
|
|
+ await this.getdetails({ code: this.id })
|
|
|
+ this.pagedetails = this.pageitem
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['items']),
|
|
|
- ...pagemapState(['pageitem'])
|
|
|
+ ...pagemapState(['pageitem']),
|
|
|
+ ...bannermapState(['banneritem'])
|
|
|
},
|
|
|
watch: {
|
|
|
id (val) {
|