Browse Source

部门首页下的工作计划和资料下载改为列表页

master
aBin 3 years ago
parent
commit
36a4ea586c
  1. 3
      src/App.vue
  2. 1
      src/router/index.js
  3. 40
      src/views/OtherPages/Department.vue

3
src/App.vue

@ -27,6 +27,9 @@ export default {
updated() {
window.scroll(0, 0);
},
created() {
console.log(this.$route);
},
};
</script>

1
src/router/index.js

@ -11,6 +11,7 @@ const routes = [
path: '/',
name: 'Home',
component: Home,
code: '0100',
},
// 新闻中心
{

40
src/views/OtherPages/Department.vue

@ -7,6 +7,9 @@
<div class="flex-1 flex-column">
<Location :title="defaultTitle" />
<div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }">
<template v-if="code.length === 6 && (code.split('')[5] === '4' || code.split('')[5] === '6')">
<ListPage :code="code" @changeYear="changeYear" :content="content" @getData="getNumData" />
</template>
<RichText :rich-obj="content" />
</div>
</div>
@ -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);
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);
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);
},
},
};
</script>

Loading…
Cancel
Save