diff --git a/src/App.vue b/src/App.vue index 048c1fa..7be544c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,6 +27,9 @@ export default { updated() { window.scroll(0, 0); }, + created() { + console.log(this.$route); + }, }; diff --git a/src/router/index.js b/src/router/index.js index 4b83fc7..9a251ac 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -11,6 +11,7 @@ const routes = [ path: '/', name: 'Home', component: Home, + code: '0100', }, // 新闻中心 { diff --git a/src/views/OtherPages/Department.vue b/src/views/OtherPages/Department.vue index b0bbb24..c51fd2f 100644 --- a/src/views/OtherPages/Department.vue +++ b/src/views/OtherPages/Department.vue @@ -7,6 +7,9 @@
+
@@ -20,9 +23,10 @@ import { mapActions } from 'vuex'; import LeftNav from '@/components/LeftNav/LeftNav.vue'; import RichText from '@/components/RichText/RichText.vue'; import Location from '@/components/Location/Location.vue'; +import ListPage from '@/components/ListPage/ListPage.vue'; export default { - components: { LeftNav, RichText, Location }, + components: { LeftNav, RichText, Location, ListPage }, data() { return { code: '0901', @@ -641,6 +645,8 @@ export default { }, ], }, + year: '2022', + pageNum: 1, content: {}, }; }, @@ -649,17 +655,25 @@ export default { if (this.$route.path === this.list.url) { this.code = val; this.getDetault(val); - this.getData(this.code); + if (this.code.length === 6 && (this.code.split('')[5] === '4' || this.code.split('')[5] === '6')) { + this.getContentData(this.code); + } else { + this.getData(this.code); + } } }, }, created() { this.code = this.$route.query.code; this.getDetault(this.code); - this.getData(this.code); + if (this.code.length === 6 && (this.code.split('')[5] === '4' || this.code.split('')[5] === '6')) { + this.getContentData(this.code); + } else { + this.getData(this.code); + } }, methods: { - ...mapActions('home', ['getDetail']), + ...mapActions('home', ['getDetail', 'getContent']), // 获取默认显示标题 getDetault(val) { for (let i = 0; i < this.list.children.length; i++) { @@ -678,9 +692,31 @@ export default { this.content = data || {}; } catch (error) {} }, + async getContentData() { + try { + const params = { + showPage: this.code, + year: this.year, + showType: 0, + pageNum: this.pageNum, + pageSize: 10, + }; + const data = await this.getContent(params); + console.log('data: ', data); + } catch (error) {} + }, + getNumData(pageNum) { + console.log('pageNum: ', pageNum); + this.pageNum = pageNum; + this.getContentData(); + }, chanegCode(code) { this.code = code; }, + changeYear(year, code) { + this.year = year; + this.getContentData(code); + }, }, };