|
@@ -7,7 +7,7 @@
|
|
|
:columnName="columnName"
|
|
|
:contentList="contentList"
|
|
|
:total="total"
|
|
|
- :columnTitle="columnTitle"
|
|
|
+ :columnTitle="columnName"
|
|
|
:policyInfo="policyInfo"
|
|
|
@clickLists="submit"
|
|
|
@fetch="fetchInfo"
|
|
@@ -30,19 +30,23 @@ export default {
|
|
|
governmentListsLayout,
|
|
|
},
|
|
|
data: () => ({
|
|
|
+ // 站点信息
|
|
|
info: {},
|
|
|
- nativeList: [],
|
|
|
+ // 显示
|
|
|
display: 'list',
|
|
|
- columnName: '',
|
|
|
+ // 左侧栏目列表
|
|
|
+ nativeList: [],
|
|
|
+ // 左侧点击存储栏目id
|
|
|
+ leftId: '',
|
|
|
+ // 右侧信息列表
|
|
|
contentList: [],
|
|
|
total: 0,
|
|
|
- leftId: '',
|
|
|
- columnTitle: '',
|
|
|
+ columnName: '',
|
|
|
+ // 右侧详情
|
|
|
policyInfo: {},
|
|
|
}),
|
|
|
async created() {
|
|
|
- this.searchSite();
|
|
|
- await this.searchColumn();
|
|
|
+ await this.search();
|
|
|
await this.defaultColumn();
|
|
|
},
|
|
|
computed: {},
|
|
@@ -50,53 +54,48 @@ export default {
|
|
|
...mapSite(['showInfo']),
|
|
|
...mapColumn({ columnList: 'query', columnInfo: 'fetch' }),
|
|
|
...mapNews({ policyNew: 'query', newsFetch: 'fetch' }),
|
|
|
- // 查询站点信息
|
|
|
- async searchSite() {
|
|
|
+ // 查询站点信息+友情链接
|
|
|
+ async search({ ...info } = {}) {
|
|
|
let res = await this.showInfo();
|
|
|
let object = JSON.parse(JSON.stringify(res.data));
|
|
|
if (object) {
|
|
|
this.$set(this, `info`, res.data);
|
|
|
- } else {
|
|
|
- this.$message.error(res.errmsg ? res.errmsg : 'error');
|
|
|
}
|
|
|
- },
|
|
|
- // 查询科技政务栏目
|
|
|
- async searchColumn({ ...info } = {}) {
|
|
|
- const res = await this.columnList({ ...info });
|
|
|
+ // 科技政务栏目
|
|
|
+ res = await this.columnList({ ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `nativeList`, res.data);
|
|
|
}
|
|
|
},
|
|
|
+ // 点击左侧存储栏目id,并查询右侧信息
|
|
|
submit({ id }) {
|
|
|
this.$set(this, `leftId`, id);
|
|
|
this.display = 'list';
|
|
|
- this.searchRight();
|
|
|
+ this.searchrightnews();
|
|
|
},
|
|
|
- async searchRight({ skip = 0, limit = 10, column_id } = {}) {
|
|
|
+ async searchrightnews({ skip = 0, limit = 10, column_id } = {}) {
|
|
|
const res = await this.policyNew({ column_id: this.leftId });
|
|
|
- for (const val of res.data) {
|
|
|
- const result = await this.columnInfo(val.column_id);
|
|
|
- val.column_name = result.data.name;
|
|
|
- }
|
|
|
- this.$set(this, `contentList`, res.data);
|
|
|
- this.$set(this, `total`, res.total);
|
|
|
- for (const val of res.data) {
|
|
|
- this.$set(this, `columnName`, val.column_name);
|
|
|
+ let columnName = this.nativeList.find(i => i.id == this.leftId);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `contentList`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ this.$set(this, `columnName`, columnName.name);
|
|
|
}
|
|
|
},
|
|
|
- async defaultColumn() {
|
|
|
+ // 查询默认栏目
|
|
|
+ defaultColumn() {
|
|
|
if (!(this.nativeList.length > 0)) return;
|
|
|
let id = _.get(this.nativeList[0], 'id', false);
|
|
|
if (!id) return;
|
|
|
this.submit({ id });
|
|
|
},
|
|
|
+ // 查询详情
|
|
|
async fetchInfo(id) {
|
|
|
this.display = 'detail';
|
|
|
const res = await this.newsFetch(id);
|
|
|
const result = await this.columnInfo(res.data.column_id);
|
|
|
- this.$set(this, `columnTitle`, result.data.name);
|
|
|
+ this.$set(this, `columnName`, result.data.name);
|
|
|
this.$set(this, `policyInfo`, res.data);
|
|
|
- // 查询详情,赋值
|
|
|
},
|
|
|
},
|
|
|
};
|