首页跟多和公共详情页面改造

This commit is contained in:
熊丽君
2021-08-12 16:21:59 +08:00
parent a7f7dcde08
commit 812db4de27
4 changed files with 411 additions and 86 deletions

View File

@ -1,15 +1,28 @@
<template>
<div class="portrait_page content">
<div class="header">
<span class="span">企业画像</span>
<el-tabs v-model="queryParams.labelId" @tab-click="handleClick">
<el-tab-pane
:label="item.name"
:name="item.id"
v-for="item in portraitList"
:key="item.id"
></el-tab-pane>
</el-tabs>
<div class="header" v-if="type == 'policy'">
<span class="span">{{ val }}</span>
<el-radio
v-model="queryParams.labelId"
v-for="item in portraitList"
:key="item.id"
:label="item.id"
border
@change="handleClick"
>{{ item.name }}</el-radio
>
</div>
<div class="header" v-else-if="type == 'policyRead'">
<span class="span">{{ val }}</span>
<el-radio
v-model="queryParams.attributeId"
v-for="item in attributeOptions"
:key="item.value"
:label="item.value"
border
@change="handleClick"
>{{ item.label }}</el-radio
>
</div>
<div class="screen_l_b" v-for="item in portraitData" :key="item.id">
<div class="title text_hidden_one pointer">
@ -17,16 +30,19 @@
target="_blank"
:to="{
path: '/result',
query: { key: 'policy', id: item.id }
query: { key: type, id: item.id }
}"
>
{{ item.title }}
</router-link>
</div>
<div class="info">
<div class="info" v-if="type != 'information'">
<span>来源{{ item.source }}</span>
<span>发布{{ item.listDate }}</span>
</div>
<div class="info" style="justify-content: flex-end;" v-else>
<span>发布{{ item.createTime }}</span>
</div>
</div>
<!-- 分页 -->
<pagination
@ -43,17 +59,37 @@
import { getPolicyMatch } from '@/api/home/notice';
import { mapGetters } from 'vuex';
import { userInfo, getLabelSetting } from '@/api/home/info';
import { getPolicyRead, getInformation } from '@/api/home/home';
export default {
data() {
return {
activeName: '',
type: '',
val: '',
queryParams: {
pageNum: 1,
pageSize: 10,
labelId: ''
pageSize: 10
},
total: 0,
portraitList: [], // 企业画像
// 归口选项
attributeOptions: [
{
value: 'KJJ',
label: '科技'
},
{
value: 'JXJ',
label: '经信'
},
{
value: 'FGW',
label: '发改'
},
{
value: 'OTHER',
label: '其他'
}
],
portraitData: [], // 企业画像绑定的政策列表
portraitTotal: 0
};
@ -64,10 +100,22 @@ export default {
methods: {
// 获取企业画像数据列表
getPortraitList() {
getPolicyMatch(this.queryParams).then(({ data }) => {
this.portraitData = data.list;
this.total = data.total;
});
if (this.type == 'policy') {
getPolicyMatch(this.queryParams).then(({ data }) => {
this.portraitData = data.list;
this.total = data.total;
});
} else if (this.type == 'policyRead') {
getPolicyRead(this.queryParams).then(({ data }) => {
this.portraitData = data.list;
this.total = data.total;
});
} else if (this.type == 'information') {
getInformation(this.queryParams).then(({ data }) => {
this.portraitData = data.list;
this.total = data.total;
});
}
},
handleClick() {
this.getPortraitList();
@ -75,25 +123,39 @@ export default {
},
created() {
if (this.token) {
userInfo().then(({ data }) => {
if (data.companyId) {
getLabelSetting({ companyId: data.companyId }).then(({ data }) => {
if (data.length) {
this.portraitList = data.map(item =>
item.labelList
? item.labelList.filter(v => v.isHas)[0]
console.log();
const { key, val } = this.$route.query;
this.type = key;
this.val = val;
if (key == 'policy') {
userInfo().then(({ data }) => {
if (data.companyId) {
getLabelSetting({ companyId: data.companyId }).then(({ data }) => {
if (data.length) {
console.log(data);
this.portraitList = data.map(item =>
item.labelList
? item.labelList.filter(v => v.isHas)[0]
: ''
: undefined
);
this.queryParams.labelId = this.portraitList[0].id;
this.getPortraitList();
}
});
}
});
? item.labelList.filter(v => v.isHas)[0]
: ''
: undefined
);
this.queryParams.labelId = this.portraitList[0].id;
this.getPortraitList();
}
});
}
});
} else if (key == 'policyRead') {
this.queryParams.attributeId = this.attributeOptions[0].value;
this.getPortraitList();
} else if (key == 'information') {
this.getPortraitList();
} else {
this.msgError('非法进入');
}
} else {
this.msgSuccess('请先登录');
this.msgError('请先登录');
}
}
};
@ -114,6 +176,9 @@ export default {
height: 0;
}
}
/deep/.el-radio__input {
display: none;
}
}
.screen_l_b {
height: 110px;