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() { updated() {
window.scroll(0, 0); window.scroll(0, 0);
}, },
created() {
console.log(this.$route);
},
}; };
</script> </script>

1
src/router/index.js

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

40
src/views/OtherPages/Department.vue

@ -7,6 +7,9 @@
<div class="flex-1 flex-column"> <div class="flex-1 flex-column">
<Location :title="defaultTitle" /> <Location :title="defaultTitle" />
<div class="content-detail p-4" :style="{ 'min-height': list.children.length * 56 + 'px' }"> <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" /> <RichText :rich-obj="content" />
</div> </div>
</div> </div>
@ -20,9 +23,10 @@ import { mapActions } from 'vuex';
import LeftNav from '@/components/LeftNav/LeftNav.vue'; import LeftNav from '@/components/LeftNav/LeftNav.vue';
import RichText from '@/components/RichText/RichText.vue'; import RichText from '@/components/RichText/RichText.vue';
import Location from '@/components/Location/Location.vue'; import Location from '@/components/Location/Location.vue';
import ListPage from '@/components/ListPage/ListPage.vue';
export default { export default {
components: { LeftNav, RichText, Location }, components: { LeftNav, RichText, Location, ListPage },
data() { data() {
return { return {
code: '0901', code: '0901',
@ -641,6 +645,8 @@ export default {
}, },
], ],
}, },
year: '2022',
pageNum: 1,
content: {}, content: {},
}; };
}, },
@ -649,17 +655,25 @@ export default {
if (this.$route.path === this.list.url) { if (this.$route.path === this.list.url) {
this.code = val; this.code = val;
this.getDetault(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); this.getData(this.code);
} }
}
}, },
}, },
created() { created() {
this.code = this.$route.query.code; this.code = this.$route.query.code;
this.getDetault(this.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); this.getData(this.code);
}
}, },
methods: { methods: {
...mapActions('home', ['getDetail']), ...mapActions('home', ['getDetail', 'getContent']),
// //
getDetault(val) { getDetault(val) {
for (let i = 0; i < this.list.children.length; i++) { for (let i = 0; i < this.list.children.length; i++) {
@ -678,9 +692,31 @@ export default {
this.content = data || {}; this.content = data || {};
} catch (error) {} } 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) { chanegCode(code) {
this.code = code; this.code = code;
}, },
changeYear(year, code) {
this.year = year;
this.getContentData(code);
},
}, },
}; };
</script> </script>

Loading…
Cancel
Save