|
@@ -29,7 +29,9 @@ export default {
|
|
|
policyDetail,
|
|
|
},
|
|
|
data: () => ({
|
|
|
+ // 站点信息
|
|
|
info: {},
|
|
|
+ // 查询栏目
|
|
|
liebiaoList: [],
|
|
|
display: 'list',
|
|
|
columnName: '',
|
|
@@ -40,27 +42,25 @@ export default {
|
|
|
policyInfo: {},
|
|
|
}),
|
|
|
async created() {
|
|
|
- this.searchSite();
|
|
|
- await this.policyColumn();
|
|
|
+ await this.search();
|
|
|
await this.defaultColumn();
|
|
|
+ // this.searchSite();
|
|
|
+ // await this.policyColumn();
|
|
|
+ //
|
|
|
},
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
...mapSite(['showInfo']),
|
|
|
...mappolicyColumn({ policyColumns: 'query', policyfetch: 'fetch' }),
|
|
|
...mappolicyNews({ 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 policyColumn({ ...info } = {}) {
|
|
|
- const res = await this.policyColumns({ ...info });
|
|
|
+ res = await this.policyColumns({ ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `liebiaoList`, res.data);
|
|
|
}
|
|
@@ -68,18 +68,15 @@ export default {
|
|
|
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.policyfetch(val.column_id);
|
|
|
- val.column_name = result.data.name;
|
|
|
- }
|
|
|
- this.$set(this, `contentList`, res.data);
|
|
|
- this.$set(this, `total`, res.data.length);
|
|
|
- for (const val of res.data) {
|
|
|
- this.$set(this, `columnName`, val.column_name);
|
|
|
+ let columnName = this.liebiaoList.find(i => i.id == this.leftId);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `contentList`, res.data);
|
|
|
+ this.$set(this, `total`, res.data.length);
|
|
|
+ this.$set(this, `columnName`, columnName.name);
|
|
|
}
|
|
|
},
|
|
|
async defaultColumn() {
|
|
@@ -88,13 +85,13 @@ export default {
|
|
|
if (!id) return;
|
|
|
this.submit({ id });
|
|
|
},
|
|
|
+ // 查询详情
|
|
|
async fetchInfo(id) {
|
|
|
this.display = 'detail';
|
|
|
const res = await this.newsFetch(id);
|
|
|
const result = await this.policyfetch(res.data.column_id);
|
|
|
this.$set(this, `columnTitle`, result.data.name);
|
|
|
this.$set(this, `policyInfo`, res.data);
|
|
|
- // 查询详情,赋值
|
|
|
},
|
|
|
},
|
|
|
};
|