提交 43eb27f4 authored 作者: huhuiqing's avatar huhuiqing

智库问题前端修复

上级 e17d9815
...@@ -351,7 +351,7 @@ const box3Data = ref({ ...@@ -351,7 +351,7 @@ const box3Data = ref({
// ] // ]
}); });
const box3SelectYear = ref("2024"); const box3SelectYear = ref("2025");
const box3YearList = ref([ const box3YearList = ref([
{ {
label: "2025", label: "2025",
......
...@@ -308,21 +308,31 @@ const handleCurrentChange = page => { ...@@ -308,21 +308,31 @@ const handleCurrentChange = page => {
handleGetThinkDynamicsReport() handleGetThinkDynamicsReport()
}; };
function arrayToString(arr) {
return arr.reduce((acc, item) => {
if (item !== null && item !== undefined && item !== "") {
return acc === "" ? item : acc + "," + item;
}
return acc;
}, "");
}
// 获取智库动态报告 // 获取智库动态报告
const handleGetThinkDynamicsReport = async () => { const handleGetThinkDynamicsReport = async () => {
console.log(selectedReportTypeList.value, 'selectedReportTypeList.value')
console.log(selectedResearchTypeList.value, 'selectedResearchTypeList.value')
try { try {
const parmas = { const parmas = {
id: router.currentRoute._value.params.id, id: router.currentRoute._value.params.id,
startDate: getDateYearsAgo(selectedYear.value), startDate: getDateYearsAgo(selectedYear.value),
parmas: { parmas: {
searchText: searchReport.value,
authorName: author.name,
sortFun: sort.value, sortFun: sort.value,
authorName: author.value ? author.value : null, authorName: author.value ? author.value : null,
currentPage: currentPage.value, currentPage: currentPage.value - 1,
pageSize: 12, pageSize: 12,
reportTypeIds: selectedReportTypeList.value ? selectedReportTypeList.value : null, reportTypeIds: arrayToString(selectedReportTypeList.value) === '' ? null : arrayToString(selectedResearchTypeList.value),
researchTypeIds: selectedResearchTypeList.value ? selectedResearchTypeList.value : null researchTypeIds: arrayToString(selectedResearchTypeList.value) === '' ? null : arrayToString(selectedResearchTypeList.value)
} }
} }
...@@ -331,6 +341,9 @@ const handleGetThinkDynamicsReport = async () => { ...@@ -331,6 +341,9 @@ const handleGetThinkDynamicsReport = async () => {
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
curFooterList.value = res.data.content curFooterList.value = res.data.content
total.value = res.data.totalElements total.value = res.data.totalElements
} else if (res.code === 500 && res.message === '未找到对应筛选的报告') {
curFooterList.value = []
total.value = 0
} }
} catch (error) { } catch (error) {
console.error("获取智库动态报告error", error); console.error("获取智库动态报告error", error);
......
...@@ -335,10 +335,12 @@ ...@@ -335,10 +335,12 @@
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange"> <el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">
全部领域 全部领域
</el-checkbox> </el-checkbox>
<el-checkbox v-for="research in areaList" :key="research.id" v-model="selectedAreaList" <el-checkbox-group v-model="selectedAreaList">
:label="research.id" @change="handleCheckedAreaChange()" class="filter-checkbox"> <el-checkbox v-for="(research, index) in areaList" :key="index" :label="research.id"
@change="handleCheckedAreaChange()" class="filter-checkbox">
{{ research.name }} {{ research.name }}
</el-checkbox> </el-checkbox>
</el-checkbox-group>
</div> </div>
</div> </div>
</div> </div>
...@@ -350,17 +352,24 @@ ...@@ -350,17 +352,24 @@
</div> </div>
<div class="select-main"> <div class="select-main">
<div class="checkbox-group"> <div class="checkbox-group">
<el-checkbox v-for="time in pubTimeList" :key="time.id" v-model="selectedPubTimeList" :label="time.id" <el-checkbox v-model="checkAllTime" :indeterminate="isIndeterminateTime"
class="filter-checkbox"> @change="handleCheckAllChangeTime">
全部时间
</el-checkbox>
<el-checkbox-group v-model="selectedPubTimeList">
<el-checkbox v-for="time in pubTimeList" :key="time.id" :label="time.id" class="filter-checkbox"
@change="handleCheckedAreaChangeTime()">
{{ time.name }} {{ time.name }}
</el-checkbox> </el-checkbox>
</el-checkbox-group>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<div class="card-box"> <div class="card-box">
<div class="footer-card" v-for="(item, index) in curFooterList" :key="index"> <div class="footer-card" v-for="(item, index) in curFooterList" :key="index"
@click="handleToReportDetail(item.id)">
<div class="footer-card-top"> <div class="footer-card-top">
<img :src="item.imageUrl" alt="" /> <img :src="item.imageUrl" alt="" />
</div> </div>
...@@ -374,13 +383,10 @@ ...@@ -374,13 +383,10 @@
</div> </div>
</div> </div>
<div class="right-footer"> <div class="right-footer">
<div class="info"> <div class="info">{{ total }}项调查</div>
{{ total }}项调查
</div>
<div class="page-box"> <div class="page-box">
<el-pagination :page-size="12" background layout="prev, pager, next" :total="total" <el-pagination :page-size="12" background layout="prev, pager, next" :total="total"
@current-change="handleCurrentChange()" :current-page="currentPage" /> @current-change="handleCurrentChange" :current-page="currentPage" />
</div> </div>
</div> </div>
</div> </div>
...@@ -1069,45 +1075,72 @@ const handleCheckAllChange = val => { ...@@ -1069,45 +1075,72 @@ const handleCheckAllChange = val => {
} }
// selectedAreaList.value = val ? areaList : [] // selectedAreaList.value = val ? areaList : []
// isIndeterminate.value = false // isIndeterminate.value = false
handleGetetThinkTankReport();
}; };
const handleCheckedAreaChange = () => { const handleCheckedAreaChange = () => {
// console.log(selectedAreaList.value, "handleCheckedAreaChange"); // console.log(selectedAreaList.value, "handleCheckedAreaChange");
console.log(selectedAreaList.value, "当前选中的领域");
selectedAreaList.value.length !== areaList.value.length selectedAreaList.value.length !== areaList.value.length
? (isIndeterminate.value = true) ? (isIndeterminate.value = true)
: ((checkAll.value = true), (isIndeterminate.value = false)); : ((checkAll.value = true), (isIndeterminate.value = false));
handleGetetThinkTankReport();
}; };
const pubTimeList = ref([ const pubTimeList = ref([
{ {
id: "全部时间", id: 2025,
name: "全部时间" name: "2025"
},
{
id: "2025年",
name: "2025年"
},
{
id: "2024年",
name: "2024年"
}, },
{ {
id: "2023年", id: 2024,
name: "2023年" name: "2024"
}, },
{ {
id: "2022年", id: 2023,
name: "2022年" name: "2023"
}, },
{ {
id: "2021年", id: 2022,
name: "2021年" name: "2022"
}, },
{ {
id: "更早时间", id: 2021,
name: "更早时间" name: "2021"
} }
// {
// id: "更早时间",
// name: "更早时间"
// }
]); ]);
const selectedPubTimeList = ref(["全部时间"]); const selectedPubTimeList = ref([""]);
const checkAllTime = ref(false);
const isIndeterminateTime = ref(true);
const handleCheckAllChangeTime = val => {
// console.log(val, "handleCheckAllChange");
if (val) {
isIndeterminateTime.value = false;
selectedPubTimeList.value.length !== pubTimeList.value.length
? (selectedPubTimeList.value = pubTimeList.value.map(obj => obj.id))
: "";
} else {
selectedPubTimeList.value = [];
}
// selectedAreaList.value = val ? areaList : []
// isIndeterminate.value = false
handleGetetThinkTankReport();
};
const handleCheckedAreaChangeTime = () => {
// console.log(selectedAreaList.value, "handleCheckedAreaChange");
console.log(selectedPubTimeList.value, "当前选中的时间");
selectedPubTimeList.value.length !== pubTimeList.value.length
? (isIndeterminateTime.value = true)
: ((checkAllTime.value = true), (isIndeterminateTime.value = false));
handleGetetThinkTankReport();
};
const curFooterList = ref([ const curFooterList = ref([
{ {
...@@ -1184,26 +1217,36 @@ const curFooterList = ref([ ...@@ -1184,26 +1217,36 @@ const curFooterList = ref([
} }
]); ]);
const currentPage = ref(1); const currentPage = ref(1);
const total = ref(0) const total = ref(0);
// 处理页码改变事件 // 处理页码改变事件
const handleCurrentChange = page => { const handleCurrentChange = page => {
console.log(page, 'pagepagepage')
currentPage.value = page; currentPage.value = page;
handleGetetThinkTankReport() handleGetetThinkTankReport();
}; }
function arrayToString(arr) {
return arr.reduce((acc, item) => {
if (item !== null && item !== undefined && item !== "") {
return acc === "" ? item : acc + "," + item;
}
return acc;
}, "");
}
//获取智库报告 //获取智库报告
const handleGetetThinkTankReport = async () => { const handleGetetThinkTankReport = async () => {
const params = { const params = {
currentPage: currentPage.value, currentPage: currentPage.value - 1,
pageSize: 12, pageSize: 12,
researchTypeIds: selectedAreaList.value, researchTypeIds: arrayToString(selectedAreaList.value),
years: 2025 years: arrayToString(selectedPubTimeList.value)
} };
try { try {
const res = await getThinkTankReport(params); const res = await getThinkTankReport(params);
console.log("智库报告", res); console.log("智库报告", res);
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
curFooterList.value = res.data.content; curFooterList.value = res.data.content;
total.value = res.data.totalElements total.value = res.data.totalElements;
} }
} catch (error) { } catch (error) {
console.error("获取智库报告error", error); console.error("获取智库报告error", error);
...@@ -1211,7 +1254,7 @@ const handleGetetThinkTankReport = async () => { ...@@ -1211,7 +1254,7 @@ const handleGetetThinkTankReport = async () => {
}; };
const handleClick = tank => { const handleClick = tank => {
console.log(tank) console.log(tank);
// router.push({ name: "ThinkTankDetail", params: { id: tank.id } }); // router.push({ name: "ThinkTankDetail", params: { id: tank.id } });
const curRoute = router.resolve({ name: "ThinkTankDetail", params: { id: tank.id, name: tank.name } }); const curRoute = router.resolve({ name: "ThinkTankDetail", params: { id: tank.id, name: tank.name } });
window.open(curRoute.href, "_blank"); window.open(curRoute.href, "_blank");
...@@ -1230,6 +1273,16 @@ const handleToMoreRiskSignal = () => { ...@@ -1230,6 +1273,16 @@ const handleToMoreRiskSignal = () => {
window.open(route.href, "_blank"); window.open(route.href, "_blank");
}; };
const handleToReportDetail = (id) => {
const route = router.resolve({
name: 'ReportDetail',
params: {
id: id
}
});
window.open(route.href, "_blank");
}
onMounted(async () => { onMounted(async () => {
handleGetThinkTankList(); handleGetThinkTankList();
handleGetNewReport(); handleGetNewReport();
...@@ -1239,7 +1292,7 @@ onMounted(async () => { ...@@ -1239,7 +1292,7 @@ onMounted(async () => {
handleBox7(); handleBox7();
handleGetHylyList(); handleGetHylyList();
handleGetThinkTankHot(getDateYearsAgo(1)); handleGetThinkTankHot(getDateYearsAgo(1));
handleGetetThinkTankReport() handleGetetThinkTankReport();
}); });
</script> </script>
...@@ -2934,7 +2987,6 @@ onMounted(async () => { ...@@ -2934,7 +2987,6 @@ onMounted(async () => {
box-shadow: none !important; box-shadow: none !important;
} }
.page { .page {
width: 1600px; width: 1600px;
height: 40px; height: 40px;
...@@ -2954,7 +3006,6 @@ onMounted(async () => { ...@@ -2954,7 +3006,6 @@ onMounted(async () => {
letter-spacing: 0px; letter-spacing: 0px;
text-align: left; text-align: left;
} }
} }
:deep(.el-pagination) { :deep(.el-pagination) {
...@@ -2974,17 +3025,12 @@ onMounted(async () => { ...@@ -2974,17 +3025,12 @@ onMounted(async () => {
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
font-family: "Microsoft YaHei"; font-family: "Microsoft YaHei";
} }
:deep(.el-pagination.is-background .el-pager li.is-active) { :deep(.el-pagination.is-background .el-pager li.is-active) {
background-color: #fff; background-color: #fff;
color: rgba(22, 119, 255, 1); color: rgba(22, 119, 255, 1);
border-color: rgba(22, 119, 255, 1); border-color: rgba(22, 119, 255, 1);
} }
:deep(.el-pagination.is-background .el-pager li.is-ellipsis) { :deep(.el-pagination.is-background .el-pager li.is-ellipsis) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论