提交 0ccdac09 authored 作者: 龙菲's avatar 龙菲

修改文物和展览的筛选字典为有数据的才显示

上级 56c5b03a
...@@ -41,3 +41,13 @@ export function getRecommendCr(params) { ...@@ -41,3 +41,13 @@ export function getRecommendCr(params) {
params params
}) })
} }
// 获取存在文物的字典
export function getCrExistDict(params) {
return request({
url: '/bizCulturalRelic/existDict',
method: 'get',
params
})
}
...@@ -22,4 +22,12 @@ export function getRecommendDisplay(params){ ...@@ -22,4 +22,12 @@ export function getRecommendDisplay(params){
method: 'get', method: 'get',
params params
}) })
} }
\ No newline at end of file
export function getDisplayExistDict(params){
return request({
url: '/bizExhibition/existDict',
method: 'get',
params
})
}
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
</div> </div>
<div class="text">{{ title }}</div> <div class="text">{{ title }}</div>
</div> --> </div> -->
<div class="total" > <div class="total">
<div class="total-title">{{title}}</div> <div class="total-title">{{ title }}</div>
<div class="amount"> <div class="amount">
<span class="num">{{num}}</span> <span class="num">{{ num }}</span>
<span class="unit">{{unit}}</span> <span class="unit">{{ unit }}</span>
</div> </div>
</div> </div>
<!-- <div class="banner-1"> <!-- <div class="banner-1">
...@@ -30,11 +30,11 @@ export default { ...@@ -30,11 +30,11 @@ export default {
type: String, type: String,
default: "标题", default: "标题",
}, },
num:{ num: {
type: String, type: [String, Number],
default: '0', default: '0',
}, },
unit:{ unit: {
type: String, type: String,
default: '个', default: '个',
}, },
...@@ -47,11 +47,12 @@ export default { ...@@ -47,11 +47,12 @@ export default {
width: 100%; width: 100%;
height: 360px; height: 360px;
position: relative; position: relative;
background-image: linear-gradient(to right,$themeColor,rgba($themeColor, 0.9),$themeColor); background-image: linear-gradient(to right, $themeColor, rgba($themeColor, 0.9), $themeColor);
padding: 0 13%; padding: 0 13%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
// height: 222px; // height: 222px;
// background-image: url("@/assets/imgs/list/banner2.png"); // background-image: url("@/assets/imgs/list/banner2.png");
// background-size:100% 100%; // background-size:100% 100%;
...@@ -71,18 +72,22 @@ export default { ...@@ -71,18 +72,22 @@ export default {
.total-title { .total-title {
font-size: 28px; font-size: 28px;
} }
.amount { .amount {
font-weight: bold; font-weight: bold;
.num{
.num {
font-size: 56px; font-size: 56px;
font-family: $puHuiTi; font-family: $puHuiTi;
} }
.unit{
.unit {
font-size: $font-size-base; font-size: $font-size-base;
} }
} }
} }
// .banner-1 { // .banner-1 {
// position: absolute; // position: absolute;
// left: 620px; // left: 620px;
...@@ -100,25 +105,30 @@ export default { ...@@ -100,25 +105,30 @@ export default {
// top: 54%; // top: 54%;
margin-top: 30px; margin-top: 30px;
width: 520px; width: 520px;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.title { .title {
padding: 0 13%; padding: 0 13%;
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
.img-container { .img-container {
width: 58px; width: 58px;
height: 58px; height: 58px;
margin-right: 26px; margin-right: 26px;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: contain; object-fit: contain;
} }
} }
.text { .text {
font-size: 28px; font-size: 28px;
font-weight: 400; font-weight: 400;
......
<template> <template>
<div class="cultural-relic"> <div class="cultural-relic">
<ListBanner title="文物展" unit="件/套" :num="list.total" /> <ListBanner title="共计文物" unit="件/套" :num="list.total" />
<div class="search-bar wow animate__animated animate__fadeIn"> <div class="search-bar wow animate__animated animate__fadeIn">
<div class="search-wrapper"> <div class="search-wrapper">
<div class="search-item" @click="handleClickSearchBar('type')"> <div class="search-item" @click="handleClickSearchBar('type')">
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
<script> <script>
import ListBanner from "@/components/ListBanner"; import ListBanner from "@/components/ListBanner";
import { getCulturalRelicList } from "@/api/culturalRelic"; import { getCulturalRelicList, getCrExistDict } from "@/api/culturalRelic";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
export default { export default {
name: "CulturalRelic", name: "CulturalRelic",
...@@ -209,46 +209,51 @@ export default { ...@@ -209,46 +209,51 @@ export default {
value: "", value: "",
} }
]; ];
await this.$store.dispatch("dict/getDictList", ["culturalRelicType"]); let res = await getCrExistDict()
for (const key in this.dicts.culturalRelicType) { let resTypeList = res.data.typeList
let resYearList = res.data.yearDictList
resTypeList.map(item=>{
typeList.push({ typeList.push({
label: this.dicts.culturalRelicType[key], label:item.label,
value: key, value:item.value
}); })
} })
resYearList.map(item=>{
yearList.push({
label:item.label,
value:item.value
})
})
this.typeList = typeList; this.typeList = typeList;
let res = await this.$store.dispatch("dict/getDictTree", [
"culturalRelicYears",
]);
this.culturalRelicYears = res.culturalRelicYears;
traveseYears(this.culturalRelicYears);
this.yearList = yearList; this.yearList = yearList;
// 获取叶子节点 // await this.$store.dispatch("dict/getDictList", ["culturalRelicType"]);
function traveseYears(arr) { // for (const key in this.dicts.culturalRelicType) {
if (arr && arr.length > 0) { // typeList.push({
arr.map((item) => { // label: this.dicts.culturalRelicType[key],
if (item.children && item.children.length > 0) { // value: key,
traveseYears(item.children);
} else {
yearList.push({
value: item.value,
label: item.label,
});
}
});
}
}
// 删除无children的节点
// function traveseYears(arr) {
// if (arr && arr.length > 0) {
// arr.map((item) => {
// if (item.children && item.children.length == 0) {
// delete item.children;
// } else {
// traveseYears(item.children);
// }
// }); // });
// } // }
// let res = await this.$store.dispatch("dict/getDictTree", [
// "culturalRelicYears",
// ]);
// this.culturalRelicYears = res.culturalRelicYears;
// traveseYears(this.culturalRelicYears);
// // 获取叶子节点
// function traveseYears(arr) {
// if (arr && arr.length > 0) {
// arr.map((item) => {
// if (item.children && item.children.length > 0) {
// traveseYears(item.children);
// } else {
// yearList.push({
// value: item.value,
// label: item.label,
// });
// }
// });
// }
// } // }
}, },
mounted() { mounted() {
...@@ -524,7 +529,7 @@ $text-indent: 16px; ...@@ -524,7 +529,7 @@ $text-indent: 16px;
.search-panel { .search-panel {
min-height: 100px; min-height: 100px;
max-height: 138px; max-height: 138px;
background: rgb(#8ac7ff, 1) url("@/assets/imgs/home/panel-bg.png"); background: rgb($themeColor, 0.15) url("@/assets/imgs/home/panel-bg.png");
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
<i class="el-icon-phone"></i> <i class="el-icon-phone"></i>
<span>{{ museumDetail.phone }}</span> <span>{{ museumDetail.phone }}</span>
</div> </div>
<div v-if="!museumDetail.phone">暂无联系方式</div> <div v-if="!museumDetail.phone">暂无联系方式</div>
</div> </div>
</div> </div>
...@@ -81,7 +80,7 @@ export default { ...@@ -81,7 +80,7 @@ export default {
tabbars: [ tabbars: [
'简介', '入园方式', '联系方式', '简介', '入园方式', '联系方式',
], ],
currentTab: '' currentTab: '简介'
}; };
}, },
mounted() { mounted() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论