|
@@ -7,7 +7,7 @@
|
|
|
:columnName="columnName"
|
|
|
:contentList="contentList"
|
|
|
:total="total"
|
|
|
- :columnTitle="columnTitle"
|
|
|
+ :columnTitle="columnName"
|
|
|
:policyInfo="policyInfo"
|
|
|
@clickLists="submit"
|
|
|
@fetch="fetchInfo"
|
|
@@ -28,19 +28,23 @@ export default {
|
|
|
props: {},
|
|
|
components: { servicelistDetail },
|
|
|
data: () => ({
|
|
|
+ // 站点信息
|
|
|
info: {},
|
|
|
+ // 栏目列表
|
|
|
liebiaoList: [],
|
|
|
+ // 左侧栏目id
|
|
|
+ leftId: '',
|
|
|
+ // 显示列表+详情
|
|
|
display: 'list',
|
|
|
columnName: '',
|
|
|
contentList: [],
|
|
|
- total: 1,
|
|
|
- leftId: '',
|
|
|
+ total: 0,
|
|
|
+
|
|
|
columnTitle: '',
|
|
|
policyInfo: {},
|
|
|
}),
|
|
|
async created() {
|
|
|
- this.searchSite();
|
|
|
- await this.policyColumn();
|
|
|
+ await this.search();
|
|
|
await this.defaultColumn();
|
|
|
},
|
|
|
computed: {},
|
|
@@ -48,37 +52,32 @@ export default {
|
|
|
...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);
|
|
|
}
|
|
|
},
|
|
|
+ // 点击查询详情
|
|
|
submit({ id }) {
|
|
|
this.$set(this, `leftId`, id);
|
|
|
this.display = 'list';
|
|
|
- this.searchRight();
|
|
|
+ this.searchrightnews();
|
|
|
},
|
|
|
- async searchRight({ skip = 0, limit = 10, column_id } = {}) {
|
|
|
- const res = await this.policyNew({ skip, limit, 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);
|
|
|
+ // 查询详情
|
|
|
+ async searchrightnews({ skip = 0, limit = 10, column_id } = {}) {
|
|
|
+ const res = await this.policyNew({ column_id: this.leftId });
|
|
|
+ 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.total);
|
|
|
+ this.$set(this, `columnName`, columnName.name);
|
|
|
}
|
|
|
},
|
|
|
async defaultColumn() {
|
|
@@ -90,10 +89,11 @@ export default {
|
|
|
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);
|
|
|
- // 查询详情,赋值
|
|
|
+ let column = this.liebiaoList.find(i => i.id == res.data.column_id);
|
|
|
+ if (res) {
|
|
|
+ this.$set(this, `policyInfo`, res.data);
|
|
|
+ this.$set(this, `columnName`, column.name);
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|