|
|
@@ -11,7 +11,7 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<custom-bar :pre="0" :title="title" :barTop="140"></custom-bar>
|
|
|
- <banner :banners="banners" fixed :height="140" :radius="0"></banner>
|
|
|
+ <banner ref="banner" :banners="banners" :height="140" :radius="0"></banner>
|
|
|
<scroll-view class="scroll-height"></scroll-view>
|
|
|
<div class="main" id="main">
|
|
|
<van-sticky :offset-top="barHeight" :z-index="100" :container="main">
|
|
|
@@ -23,6 +23,7 @@
|
|
|
:line-width="24"
|
|
|
:line-height="2"
|
|
|
>
|
|
|
+ <van-tab :title="$t('quan-bu-xin-wen')"></van-tab>
|
|
|
<van-tab :title="item.name" v-for="item in informations" :key="item.key"></van-tab>
|
|
|
</van-tabs>
|
|
|
</div>
|
|
|
@@ -92,35 +93,39 @@ export default {
|
|
|
},
|
|
|
listQuery() {
|
|
|
return {
|
|
|
- query: { type: [...this.informations][this.hotActive].key, status: 'PASS' },
|
|
|
- sort: 'createdAt,desc'
|
|
|
+ query: { type: this.hotActive ? [...this.informations][this.hotActive - 1].key : '', status: 'PASS' },
|
|
|
+ sort: 'top,asc;auditTime,desc;sort,desc'
|
|
|
};
|
|
|
},
|
|
|
pageType() {
|
|
|
- return [...this.informations][this.hotActive].type;
|
|
|
+ return this.hotActive ? [...this.informations][this.hotActive - 1].type : 'default';
|
|
|
},
|
|
|
title() {
|
|
|
- return this.$t([...this.informations][this.hotActive].name);
|
|
|
+ return this.hotActive ? this.$t([...this.informations][this.hotActive - 1].name) : '新闻资讯';
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.$nextTick(() => {
|
|
|
- let index = 0;
|
|
|
+ let index = -1;
|
|
|
if (options.type) {
|
|
|
index = [...this.informations].findIndex(item => {
|
|
|
return item.key === options.type;
|
|
|
});
|
|
|
- if (index === -1) {
|
|
|
- index = 0;
|
|
|
- }
|
|
|
}
|
|
|
- this.changeTab(index, true);
|
|
|
+ this.changeTab(index + 1, true);
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
changeTab(index, first = false) {
|
|
|
this.hotActive = index;
|
|
|
- getBanner([...this.informations][index].key).then(res => {
|
|
|
+ getBanner(
|
|
|
+ index
|
|
|
+ ? [...this.informations][index - 1].key
|
|
|
+ : [...InformationType].map(item => {
|
|
|
+ return item[0];
|
|
|
+ })
|
|
|
+ ).then(res => {
|
|
|
+ this.$refs.banner.init();
|
|
|
this.banners = res;
|
|
|
});
|
|
|
|