From 6716b2a7ecc3ce3745c17f8361c781abd63d40d7 Mon Sep 17 00:00:00 2001 From: tanghaolin <1723298894@qq.com> Date: 星期四, 17 四月 2025 16:40:33 +0800 Subject: [PATCH] 修改首页 --- src/views/Home.vue | 1258 ++++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 843 insertions(+), 415 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index 71af422..b419bc3 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,17 +1,17 @@ <template> - <div class="h-full"> + <div class="w-full h-full relative"> <!-- 杞挱鍥鹃儴鍒� --> - <div class="banner-carousel relative right-[29.5%] w-screen"> - <el-carousel height="500px" :interval="5000" arrow="always"> + <div class="banner-carousel relative w-screen h-[602px]"> + <el-carousel height="602px" :interval="3000" indicator-position="none" arrow="never"> <el-carousel-item> <div class="carousel-item"> - <img src="@/assets/carousel/test/15.jpg" class="carousel-image" /> + <img src="@/assets/carousel/test/15.png" class="carousel-image" /> <!-- <img src="https://www.app-i.cn/api/file?file_name=2d82602e-8797-46d7-9b5c-59d9f88bc6d9.png;杞欢涓�浣撳寲娴嬭瘯骞冲彴_鍓湰.png" class="carousel-image" /> --> </div> </el-carousel-item> <el-carousel-item> <div class="carousel-item"> - <img src="@/assets/carousel/final/2.jpg" class="carousel-image" /> + <img src="@/assets/carousel/final/2.png" class="carousel-image" /> <!-- <img src="https://www.app-i.cn/static/epidemicBanner.e4d9a821.jpg" alt=""> --> </div> </el-carousel-item> @@ -26,16 +26,12 @@ </el-carousel-item> --> </el-carousel> </div> - <div class="relative z-20 2 -mt-24"> + <div class="relative z-20 2 w-full flex justify-center items-center"> <!-- 鍔熻兘鎸夐挳鍖哄煙 --> - <div class="bg-white py-8"> + <div class="bg-white py-8" v-if="false"> <div class="mx-auto px-32"> <div class="grid grid-cols-4 divide-x-w-default"> - <router-link - to="/subsidy-application" - class="block" - style="border-left: 1px solid #e3e3e3; border-right: 1px solid #e3e3e3" - > + <a @click="toSubsidy" class="block" style="border-left: 1px solid #e3e3e3; border-right: 1px solid #e3e3e3"> <div class="flex items-center gap-1 justify-center"> <div class="w-16 h-16"> <svg viewBox="0 0 24 24" class="w-full h-full"> @@ -50,7 +46,7 @@ <div class="text-sm text-info-light-3">Subsidy Application</div> </div> </div> - </router-link> + </a> <router-link to="/certified-products" class="block" style="border-right: 1px solid #e3e3e3"> <div class="flex items-center gap-1 justify-center"> <div class="w-16 h-16"> @@ -83,8 +79,8 @@ </div> </div> </router-link> - <router-link to="/" class="block" style="border-right: 1px solid #e3e3e3"> - <div class="flex items-center gap-1 justify-center" @click="linkClick(' https://www.xpump.net/')"> + <a class="block" style="border-right: 1px solid #e3e3e3" @click="linkClick"> + <div class="flex items-center gap-1 justify-center"> <div class="w-16 h-16"> <!-- <svg viewBox="0 0 24 24" class="w-full h-full"> <path @@ -99,7 +95,7 @@ <div class="text-sm text-info-light-3">Pump Search</div> </div> </div> - </router-link> + </a> <!-- <router-link to="/publish-demand" class="block"> <div class="function-card bg-white rounded-lg shadow-md p-6 text-center"> @@ -145,145 +141,230 @@ </div> </div> </div> - <div class="bg-white px-4 py-4 flex flex-col gap-8"> + <!-- 涓诲唴瀹瑰尯鍩� --> + <div class="bg-white flex flex-col gap-8 relative" style="width: calc(100% - 434px)"> + <!-- 浜у搧鍖哄煙 --> + <div class="bg-[#F0F3EF] w-full"> + <div class="catalog-list bg-[#fff] grid grid-cols-5 gap-4 justify-center items-center"> + <div + :class="state.curSelectCatalog === item.tag ? 'catalog-tag-active' : ''" + class="catalog-item" + v-for="item in state.catalog" + :key="item.tag" + @click="changeCatalog(item.tag)" + > + {{ item.name }} + </div> + </div> + <!-- 鎴戦渶瑕佽缃畇wiper鐨勯粯璁ゆ樉绀虹殑slide --> + <swiper + :direction="'vertical'" + @swiper="onSwiper" + @slideChange="onSlideChange" + :slidesPerView="state.catalogSwiperIndex" + :centeredSlides="true" + :autoplay="{ + delay: 10000, + disableOnInteraction: false, + pauseOnMouseEnter: true, + }" + :effect="'fade'" + :modules="SwiperModule" + class="catalog-swiper w-full h-[1175px]" + > + <swiper-slide class="w-full h-full" v-for="(item, index) in state.catalogItemList" :key="index"> + <div class="catalog-continer overflow-hidden"> + <div class="catalog-continer-item p-4" v-for="child in item" :key="child.Id" @click="handleCatalogClick(child)"> + <div class="w-full h-[250px]"> + <img class="w-full h-full object-contain" :src="child.PhysicalPicturePath" alt="" /> + </div> + <div class="mt-4 text-center font-medium" style="font-size: 18px"> + {{ child.Model }} + </div> + </div> + </div> + </swiper-slide> + </swiper> + </div> <!-- 鏂伴椈鍏憡鍖哄煙 --> <div class="w-full mb-4"> - <div class="flex justify-between items-center mb-4" style="border-bottom: 1.5px solid var(--alloy-color-primary)"> + <!-- <div class="flex justify-between items-center mb-4" style="border-bottom: 1.5px solid var(--alloy-color-primary)"> <div class="flex items-center space-x-2 ml-2 font-bold"> <el-icon class="text-blue-500"><Document /></el-icon> <span class="text-medium font-bold"> <span class="text-primary">鏂伴椈</span>鏀跨瓥</span> </div> <el-button text>鏇村</el-button> - </div> - <div class="flex"> - <img - class="w-[30%] flex-0 cursor-pointer" - src="@/assets/home/notice1.png" - @click="routeClick('/news-detail/8')" - alt="鏂伴椈鏀跨瓥" - /> - <div class="bg-page p-4 flex-auto"> - <div - class="font-bold text-large over-ellipsis mb-2 hover:text-primary cursor-pointer" - @click="routeClick('/news-detail/8')" - > - 涓婃捣甯傜粡娴庝俊鎭寲濮斿叧浜庡紑灞�2025骞村害涓婃捣甯傚伐涓氶�氫俊涓氱敤鑳借澶囨洿鏂颁笓椤规壎鎸佽祫閲戦」鐩敵鎶ュ伐浣滅殑閫氱煡 - </div> - <div class="text-small text-regular"> - 鏈夊叧鍗曚綅锛� - 涓鸿疮褰昏惤瀹炪�婁笂娴峰競鑺傝兘鍑忔帓锛堝簲瀵规皵鍊欏彉鍖栵級涓撻」璧勯噾绠$悊鍔炴硶锛堟勃鍙戞敼瑙勮寖銆�2021銆�5鍙凤級銆嬪拰銆婁笂娴峰競宸ヤ笟閫氫俊涓氱敤鑳借澶囨洿鏂颁笓椤规壎鎸佸疄鏂界粏鍒欍�嬶紙娌粡淇¤鑼冦��2025銆�1鍙凤級锛岃繘涓�姝ユ帹杩涙湰甯傚伐涓氶�氫俊涓氱敤鑳借澶囨洿鏂板伐浣滐紝鐜扮粍缁囧紑灞�2025骞村害涓婃捣甯傚伐涓氶�氫俊涓氱敤鑳借澶囨洿鏂颁笓椤规壎鎸佽祫閲戦」鐩敵鎶ュ伐浣溿�� - </div> - <div class="mt-4"> - <div - v-for="(item, index) in newsList" - :key="index" - class="flex text-regular justify-between items-center py-2 news-item" - > - <div class="flex items-center hover:text-primary w-full" @click="handleNewsClick(item)"> - <!-- <div class="w-1.5 h-1.5 rounded-full bg-gray-400 mr-2"></div> --> - <div - class="w-full text-gray-700 hover:text-blue-500 cursor-pointer text-ellipsis overflow-hidden whitespace-nowrap" - > - {{ item.title }} - </div> - </div> - <!-- <div class="text-gray-400 text-sm">{{ item.date }}</div> --> - </div> - </div> - </div> - </div> - </div> - - <!-- 娲诲姩鍚堜綔鍖哄煙 --> - <div class="w-full"> - <div class="flex justify-between items-center mb-4" style="border-bottom: 1.5px solid var(--alloy-color-primary)"> - <div class="flex items-center space-x-2 ml-2 font-bold"> - <el-icon class="text-blue-500"><Operation /></el-icon> - <span class="text-medium font-bold"> <span class="text-primary">鑳芥晥</span>浜у搧</span> - </div> - <el-button text @click="routeClick('/certified-products')">鏇村</el-button> - </div> - <div class="flex h-[360px] bg-[#f9f9f9] eec-product-div"> - <div class="flex-auto h-full"> - <!-- <img src="@/assets/images/china-map.png" alt="鑳芥晥浜у搧" class="w-full h-full" /> --> - <div id="eec-product-map" ref="EecProductMapChartRef"></div> - </div> - <div class="h-fit my-auto px-4 py-4 mx-10 eec-product-num-div"> - <div class="h-full bg-[#393939] px-4 py-4 flex-1" style="box-sizing: border-box; background-color: rgb(0 0 0 / 67%)"> - <div class="flex flex-col justify-between items-center mb-4 gap-2"> - <div class="text-lg font-bold text-[#26c4f6]">鍏ㄥ浗鑳芥晥浜у搧鎬婚噺</div> - <div class="px-10 bg-[#d7ecf1] py-1.5 rounded-lg text-large font-bold text-warning"> - {{ m_allEecProductNumber }}<span class="text-base text-info-light-3 ml-1">涓�</span> - </div> - </div> - <div class="grid grid-cols-1 gap-4 h-[140px]"> - <!-- <div class="flex gap-4 items-center" v-for="(item, index) in cooperationData" :key="index"> - <span class="text-[#26c4f6]">{{ item.region }}</span> - <div> - <span class="text-white font-bold">{{ item.count }}</span> - <span class="text-sm text-white-500 ml-1 text-white">涓�</span> - </div> - </div> --> - <swiper - :direction="'vertical'" - :slidesPerView="5" - :spaceBetween="10" - :autoplay="{ - delay: 1500, - disableOnInteraction: false, - }" - :modules="SwiperModule" - class="mySwiper" - > - <swiper-slide v-for="(item, index) in cooperationData" :key="index" style="width: 100%; height: 20px"> - <div style="height: 100%; width: 100%; display: flex; gap: 4px;justify-content: center;"> - <span class="text-[#26c4f6]">{{ item.region }}</span> - <div> - <span class="text-white font-bold">{{ item.count }}</span> - <span class="text-sm ml-1" style="color: #aaa;">涓�</span> - </div> - </div> - </swiper-slide> - </swiper> - </div> - </div> - </div> - </div> - </div> - - <!-- 宸ヤ笟杞欢鍒嗙被缁熻 --> - <div class="w-full bg-[#f6f7f9]"> - <!-- <div class="flex justify-between items-center mb-4" style="border-bottom: 1.5px solid var(--alloy-color-primary)"> - <div class="flex items-center space-x-2 ml-2 font-bold"> - <el-icon class="text-blue-500"><DataLine /></el-icon> - <span class="text-medium font-medium">宸ヤ笟杞欢锝滃伐涓欰PP<span class="text-primary">浜у搧鍒嗙被</span></span> - </div> </div> --> - <div class="text-large flex items-center w-fit mx-auto mt-4 font-bold">鑳芥晥浜у搧鍒嗙被</div> - <div class="flex"> - <div class="w-[45%] h-[400px]" ref="pieChartRef"></div> - <div class="w-[55%] h-[400px]" ref="barChartRef"></div> + <div class="flex gap-6"> + <!-- 宸︿晶鏂伴椈妯℃澘 --> + <div class="w-[373px] flex flex-col gap-4"> + <div class="w-full relative left-news-temp-div"> + <img + class="w-full flex-0 cursor-pointer" + src="@/assets/home/notice1.png" + @click="routeClick('/news-detail/8')" + alt="鏂伴椈鏀跨瓥" + /> + </div> + <span class="news-title"> + 銆婁笂娴峰競缁忔祹淇℃伅鍖栧鍏充簬寮�灞�2025骞村害涓婃捣甯傚伐涓氶�氫俊涓氱敤鑳借澶囨洿鏂颁笓椤规壎鎸佽祫閲戦」鐩敵鎶ュ伐浣滅殑閫氱煡銆� + </span> + </div> + <div class="flex-auto right-news-temp-div"> + <div class="w-full h-[45px] flex justify-between items-center"> + <div class="w-[20%] font-bold text-[20px]">鏂伴椈鏀跨瓥</div> + <div class="w-[80%] text-right pr-[10%] text-[18px] text-[#5c5c5c]">鏇村>></div> + </div> + <div class="w-full flex justify-between gap-8" style="height: calc(100% - 45px)"> + <div class="w-[422px] flex-shrink-0"> + <img src="@/assets/home/news_1.jpg" alt="鏂伴椈鏀跨瓥" class="w-full h-[187px]" /> + <div + class="line-clamp-3 font-bold text-large mb-2 hover:text-primary cursor-pointer text-[20px] text-[#000]" + @click="routeClick('/news-detail/8')" + > + 涓婃捣甯傜粡娴庝俊鎭寲濮斿叧浜庡紑灞�2025骞村害涓婃捣甯傚伐涓氶�氫俊涓氱敤鑳借澶囨洿鏂颁笓椤规壎鎸佽祫閲戦」鐩敵鎶ュ伐浣滅殑閫氱煡 + </div> + <div + class="text-regular text-[16px] text-[#656565] line-height-[29px] line-clamp-4 new-desc-text overflow-hidden" + style="text-indent: 2rem" + > + 鏈夊叧鍗曚綅锛� + 涓鸿疮褰昏惤瀹炪�婁笂娴峰競鑺傝兘鍑忔帓锛堝簲瀵规皵鍊欏彉鍖栵級涓撻」璧勯噾绠$悊鍔炴硶锛堟勃鍙戞敼瑙勮寖銆�2021銆�5鍙凤級銆嬪拰銆婁笂娴峰競宸ヤ笟閫氫俊涓氱敤鑳借澶囨洿鏂颁笓椤规壎鎸佸疄鏂界粏鍒欍�嬶紙娌粡淇¤鑼冦��2025銆�1鍙凤級锛岃繘涓�姝ユ帹杩涙湰甯傚伐涓氶�氫俊涓氱敤鑳借澶囨洿鏂板伐浣滐紝鐜扮粍缁囧紑灞�2025骞村害涓婃捣甯傚伐涓氶�氫俊涓氱敤鑳借澶囨洿鏂颁笓椤规壎鎸佽祫閲戦」鐩敵鎶ュ伐浣溿�� + </div> + </div> + <div class="mt-4"> + <div v-for="(item, index) in newsList" :key="index" class="flex text-regular justify-between items-center news-item"> + <div class="flex items-center hover:text-primary w-full" @click="handleNewsClick(item)"> + <div class="w-[6px] h-[6px] mr-2 news-list-dot"></div> + <div + class="w-full text-gray-700 hover:text-blue-500 cursor-pointer text-ellipsis overflow-hidden whitespace-nowrap" + > + {{ item.title }} + </div> + </div> + <!-- <div class="text-gray-400 text-sm">{{ item.date }}</div> --> + </div> + </div> + </div> + </div> + </div> + </div> + <!-- 鑳芥晥浜у搧鍒嗙被 --> + <div class="eec-product-classify-div mb-[170px]"> + <div class="w-full mt-4"> + <div class="flex justify-between items-center"> + <div class="flex items-center space-x-2 ml-2 font-bold"> + <span class="text-medium font-bold"> 鑳芥晥浜у搧鍒嗙被</span> + </div> + </div> + <div class="flex h-[360px] bg-[#f9f9f9] eec-product-div" v-if="false"> + <div class="flex-auto h-full"> + <!-- <img src="@/assets/images/china-map.png" alt="鑳芥晥浜у搧" class="w-full h-full" /> --> + <div id="eec-product-map" ref="EecProductMapChartRef"></div> + </div> + <div class="h-fit my-auto px-4 py-4 mx-10 eec-product-num-div"> + <div class="h-full bg-[#393939] px-4 py-4 flex-1" style="box-sizing: border-box; background-color: rgb(0 0 0 / 67%)"> + <div class="flex flex-col justify-between items-center mb-4 gap-2"> + <div class="text-lg font-bold text-[#26c4f6]">鍏ㄥ浗鑳芥晥浜у搧鎬婚噺</div> + <div class="px-10 bg-[#d7ecf1] py-1.5 rounded-lg text-large font-bold text-warning"> + {{ m_allEecProductNumber }}<span class="text-base text-info-light-3 ml-1">涓�</span> + </div> + </div> + <div class="grid grid-cols-1 gap-4 h-[140px]"> + <swiper + :direction="'vertical'" + :slidesPerView="5" + :spaceBetween="10" + :autoplay="{ + delay: 1500, + disableOnInteraction: false, + }" + :modules="SwiperModule" + class="mySwiper" + > + <swiper-slide v-for="(item, index) in cooperationData" :key="index" style="width: 100%; height: 20px"> + <div style="height: 100%; width: 100%; display: flex; gap: 4px; justify-content: center"> + <span class="text-[#26c4f6]">{{ item.region }}</span> + <div> + <span class="text-white font-bold">{{ item.count }}</span> + <span class="text-sm ml-1" style="color: #aaa">涓�</span> + </div> + </div> + </swiper-slide> + </swiper> + </div> + </div> + </div> + </div> + </div> + + <!-- 宸ヤ笟杞欢鍒嗙被缁熻 --> + <div class="w-full bg-[#f6f7f9]"> + <!-- <div class="flex justify-between items-center mb-4" style="border-bottom: 1.5px solid var(--alloy-color-primary)"> + <div class="flex items-center space-x-2 ml-2 font-bold"> + <el-icon class="text-blue-500"><DataLine /></el-icon> + <span class="text-medium font-medium">宸ヤ笟杞欢锝滃伐涓欰PP<span class="text-primary">浜у搧鍒嗙被</span></span> + </div> + </div> --> + <div class="text-large flex items-center w-fit mx-auto mt-4 font-bold">鑳芥晥浜у搧鍒嗙被</div> + <div class="flex"> + <div class="w-[45%] h-[400px]" ref="pieChartRef"></div> + <div class="w-[55%] h-[400px]" ref="barChartRef"></div> + </div> </div> </div> </div> + <!-- 杩斿洖椤堕儴 --> + <div + id="scroll-to-top" + class="group absolute bottom-[100px] z-[30] right-[100px] transition-all duration-300 cursor-pointer" + :class="{ + 'opacity-0 translate-y-4 fade-leave-active': scrollPercent < 35, + 'opacity-100 translate-y-0 fade-enter-active': scrollPercent >= 35, + }" + v-show="scrollPercent >= 35" + @click="scrollToTop" + > + <div + class="w-14 h-14 flex items-center justify-center flex-col cursor-pointer border border-gray-200 hover:bg-blue-50 transition-colors duration-200" + > + <img src="@/assets/home/Totop.jpg" alt="杩斿洖椤堕儴" class="" /> + </div> + </div> </div> + + <!-- 瀹㈡湇瀵硅瘽妗� --> + <customer-service + class="fixed right-[150px] bottom-[17px] z-50 w-[440px] h-[calc(80vh-30px)] shadow-lg rounded-lg" + v-show="showCustomerService" + @close="showCustomerService = false" + /> </div> </template> <script setup lang="ts"> import { Document, Operation } from '@element-plus/icons-vue'; import * as echarts from 'echarts'; -import { onMounted, ref } from 'vue'; +import { onMounted, ref, nextTick, reactive } from 'vue'; import { useRouter } from 'vue-router'; import YWLogo from '@/assets/logo/yw_logo.png'; import axios from 'axios'; +import CustomerService from '@/components/CustomerService.vue'; import { Swiper, SwiperSlide } from 'swiper/vue'; -import { Autoplay } from 'swiper/modules'; +import { Autoplay, EffectFade, Virtual } from 'swiper/modules'; import 'swiper/css'; +import 'swiper/css/effect-fade'; +import 'swiper/css/pagination'; -const SwiperModule = [Autoplay]; +const SwiperModule = [Autoplay, EffectFade, Virtual]; const router = useRouter(); + +const catalogSwiperRef = ref<HTMLElement | null>(null); + +const scrollPercent = ref(0); + +const showCustomerService = ref(false); const newsList = ref([ { @@ -349,14 +430,30 @@ // date: '2024-03-07', // }, ]); - -const linkClick = (url) => { - window.open(url, '_blank'); +const m_RequestDataObj = { + 1: { requestPath: 'static/EecProductData/Pump.json?v=' + new Date().getTime() }, + 2: { requestPath: 'static/EecProductData/AirCompressor.json?v=' + new Date().getTime() }, + 3: { requestPath: 'static/EecProductData/Fan.json?v=' + new Date().getTime() }, + 4: { requestPath: 'static/EecProductData/WaterChiller.json?v=' + new Date().getTime() }, + 7: { requestPath: 'static/EecProductData/ElectricMachinery.json?v=' + new Date().getTime() }, }; +const state = reactive({ + catalog: [ + { name: '娉�', tag: 1 }, + { name: '瀹圭Н寮忕┖鍘嬫満', tag: 2 }, + { name: '閫氶鏈�', tag: 3 }, + { name: '鍐锋按鏈虹粍', tag: 4 }, + { name: '鐢垫満', tag: 7 }, + ], + curSelectCatalog: 1, + catalogSwiperIndex: 0, + catalogItemList: [], + m_PageLoading: false, +}); -const routeClick = (url) => { - router.push(url); -}; +const pieChartRef = ref<HTMLElement | null>(null); +const barChartRef = ref<HTMLElement | null>(null); + const cooperationData = ref([ { region: '鍖椾含', @@ -500,15 +597,6 @@ }, ]); -const handleNewsClick = (item: any) => { - // if (item.link) { - // window.open(item.link, '_blank'); - // } else { - // router.push(`/news-detail/${item.id}`); - // } - router.push(`/news-detail/${item.id}`); -}; - // 鍥捐〃鏁版嵁 const chartData = [ { name: '娉�', value: 7185, percentage: '18.89%' }, @@ -520,148 +608,6 @@ { name: '鐢垫満', value: 18865, percentage: '47.59%' }, ]; -// 璁$畻鎬婚噺 -const totalCount = computed(() => { - return chartData.reduce((sum, item) => sum + item.value, 0); -}); - -const pieChartRef = ref<HTMLElement | null>(null); -const barChartRef = ref<HTMLElement | null>(null); - -onMounted(() => { - nextTick(() => { - initMapChart(); - }); - if (pieChartRef.value && barChartRef.value) { - // 鍒濆鍖栭ゼ鍥� - const pieChart = echarts.init(pieChartRef.value); - pieChart.setOption({ - title: { - text: `鎬婚噺\n${totalCount.value}`, - left: '30%', - top: '50%', - textStyle: { - fontSize: 14, - lineHeight: 24, - align: 'center', - fontWeight: 'normal', - rich: { - value: { - fontSize: 24, - fontWeight: 'bold', - padding: [10, 0], - }, - }, - }, - textAlign: 'center', - textVerticalAlign: 'middle', - }, - tooltip: { - trigger: 'item', - formatter: '{b}: {c} ({d}%)', - }, - legend: { - orient: 'vertical', - right: '-1%', - top: 'middle', - formatter: (name: string) => { - const item = chartData.find((d) => d.name === name); - return `${name}: ${item?.value} (${item?.percentage})`; - }, - }, - series: [ - { - type: 'pie', - radius: ['40%', '70%'], - center: ['30%', '50%'], - avoidLabelOverlap: false, - itemStyle: { - borderRadius: 10, - borderColor: '#fff', - borderWidth: 2, - }, - label: { - show: false, - }, - emphasis: { - label: { - show: false, - }, - }, - data: chartData.map((item) => ({ - value: item.value, - name: item.name, - })), - color: ['#5B8FF9', '#5AD8A6', '#5D7092', '#F6BD16', '#E8684A'], - }, - ], - }); - - // 鍒濆鍖栨煴鐘跺浘 - const barChart = echarts.init(barChartRef.value); - barChart.setOption({ - title: { - text: '鑳芥晥浜у搧鍒嗙被鏁伴噺缁熻', - left: 'center', - top: 10, - }, - tooltip: { - trigger: 'axis', - axisPointer: { - type: 'shadow', - }, - }, - grid: { - left: '3%', - right: '4%', - bottom: '3%', - containLabel: true, - }, - xAxis: { - type: 'category', - data: chartData.map((item) => item.name), - axisLabel: { - interval: 0, - rotate: 30, - }, - }, - yAxis: { - type: 'value', - name: '鏁伴噺', - }, - series: [ - { - data: chartData.map((item) => item.value), - type: 'bar', - barWidth: '40%', - itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { offset: 0, color: '#83bff6' }, - { offset: 0.5, color: '#188df0' }, - { offset: 1, color: '#188df0' }, - ]), - }, - emphasis: { - itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { offset: 0, color: '#2378f7' }, - { offset: 0.7, color: '#2378f7' }, - { offset: 1, color: '#83bff6' }, - ]), - }, - }, - }, - ], - }); - - // 鐩戝惉绐楀彛澶у皬鍙樺寲 - window.addEventListener('resize', () => { - pieChart.resize(); - barChart.resize(); - }); - } -}); - // 琛屽熀閫氫笓鏁版嵁 const chartData2 = [ { name: '鍩虹鍏辨�х被', value: 1764, percentage: '43.20%' }, @@ -670,133 +616,125 @@ { name: '鍏朵粬绫�', value: 53, percentage: '1.30%' }, ]; -const pieChart2Ref = ref<HTMLElement | null>(null); +const pieChart2Ref = ref<null>(null); const barChart2Ref = ref<HTMLElement | null>(null); -onMounted(() => { - // 鍒濆鍖栫浜屼釜楗煎浘 - if (pieChart2Ref.value && barChart2Ref.value) { - const pieChart2 = echarts.init(pieChart2Ref.value); - pieChart2.setOption({ - title: { - text: '鎬婚噺\n4083', - left: '30%', - top: '50%', - textStyle: { - fontSize: 14, - lineHeight: 24, - align: 'center', - fontWeight: 'normal', - rich: { - value: { - fontSize: 24, - fontWeight: 'bold', - padding: [10, 0], - }, - }, - }, - textAlign: 'center', - textVerticalAlign: 'middle', - }, - tooltip: { - trigger: 'item', - formatter: '{b}: {c} ({d}%)', - }, - legend: { - orient: 'vertical', - right: '-1%', - top: 'middle', - formatter: (name: string) => { - const item = chartData2.find((d) => d.name === name); - return `${name}: ${item?.value} (${item?.percentage})`; - }, - }, - series: [ - { - type: 'pie', - radius: ['40%', '70%'], - center: ['30%', '50%'], - avoidLabelOverlap: false, - itemStyle: { - borderRadius: 10, - borderColor: '#fff', - borderWidth: 2, - }, - label: { - show: false, - }, - emphasis: { - label: { - show: false, - }, - }, - data: chartData2.map((item) => ({ - value: item.value, - name: item.name, - })), - color: ['#5B8FF9', '#5AD8A6', '#5D7092', '#F6BD16'], - }, - ], - }); - - // 鍒濆鍖栫浜屼釜鏌辩姸鍥� - const barChart2 = echarts.init(barChart2Ref.value); - barChart2.setOption({ - title: { - text: '鍩虹鍏辨�х被浜у搧鏁伴噺缁熻', - left: 'center', - top: 10, - }, - tooltip: { - trigger: 'axis', - axisPointer: { - type: 'shadow', - }, - }, - grid: { - left: '3%', - right: '4%', - bottom: '3%', - containLabel: true, - }, - xAxis: { - type: 'category', - data: ['姹熻嫃鐪�', '鍖椾含甯�', '娴欐睙鐪�', '涓婃捣甯�', '灞变笢鐪�', '骞夸笢鐪�'], - axisLabel: { - interval: 0, - rotate: 30, - }, - }, - yAxis: { - type: 'value', - name: '鏁伴噺', - max: 600, - }, - series: [ - { - data: [500, 450, 220, 150, 150, 120], - type: 'bar', - barWidth: '40%', - itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { offset: 0, color: '#26c4f6' }, - { offset: 0.5, color: '#26c4f6' }, - { offset: 1, color: '#26c4f6' }, - ]), - }, - }, - ], - }); - - // 鐩戝惉绐楀彛澶у皬鍙樺寲 - window.addEventListener('resize', () => { - pieChart2.resize(); - barChart2.resize(); - }); - } -}); const EecProductMapChartRef = ref<HTMLElement | null>(null); const m_allEecProductNumber = ref(0); + +// 璁$畻鎬婚噺 +const totalCount = computed(() => { + return chartData.reduce((sum, item) => sum + item.value, 0); +}); + +onMounted(() => { + nextTick(() => { + // initMapChart(); + initPipeOneChart(); + initPipeTwoChart(); + + initCatalogList(); + + document.getElementById('app-page')?.addEventListener('scroll', handleScroll); + }); +}); +const handleScroll = () => { + const scrollTop = document.getElementById('app-page')?.scrollTop; + const scrollHeight = document.getElementById('app-page')?.scrollHeight - document.getElementById('app-page')?.clientHeight; + scrollPercent.value = (scrollTop / scrollHeight) * 100; + + let scrollToTop = document.getElementById('scroll-to-top'); + let footer = document.getElementById('app-footer'); + + // if (footer) { + // const footerRect = footer.getBoundingClientRect(); + // const viewportHeight = window.innerHeight; + + // if (footerRect.top > viewportHeight) { + // // Footer is not in viewport + // if (scrollToTop) { + // scrollToTop.style.bottom = '100px'; + // } + // } else { + // // Footer is in viewport + // if (scrollToTop) { + // const distanceFromFooter = 100; // 100px gap from footer + // const newBottom = viewportHeight - footerRect.top + distanceFromFooter; + // scrollToTop.style.bottom = `${newBottom}px`; + // } + // } + // } +}; +const linkClick = () => { + router.push('/select-selpara'); +}; + +const routeClick = (url: string) => { + router.push(url); +}; +const handleNewsClick = (item: any) => { + // if (item.link) { + // window.open(item.link, '_blank'); + // } else { + // router.push(`/news-detail/${item.id}`); + // } + router.push(`/news-detail/${item.id}`); +}; +// 鍒濆鍖栫被鍨嬪垪琛ㄦ暟鎹� +const initCatalogList = (cb: any = null) => { + state.m_PageLoading = true; + const catalogTag = state.curSelectCatalog; + axios({ + method: 'get', + url: m_RequestDataObj[catalogTag].requestPath, + }) + .then((res) => { + state.m_PageLoading = false; + let result = res.data; + + let arr = []; + // arr涓轰簩浣嶆暟缁勶紝姣忎釜瀛愭暟缁勫寘鍚�15鏉℃暟鎹� + + result = result.map((item: any, index: number) => { + if (catalogTag === 2) { + item.Price = item.Price * 10; + } + if (catalogTag === 4) { + item.Price = item.Price * 5; + } + let incrementFactor = 0.1 * (index + 1); // 鏍规嵁绱㈠紩璁$畻閫掑绯绘暟 + let newPrice = parseFloat(item.Price) + parseFloat((item.Price * incrementFactor).toFixed(1)); // 璁$畻鏂扮殑Price鍊� + + return { + Id: item.Id, + Type: item.Type, + ModelType: item.ModelType, + Model: item.Model, + CompanyName: item.CompanyName, + RecordNumber: item.RecordNumber, + EnergyEfficiencyClass: item.EnergyEfficiencyClass, + RecordTime: item.RecordTime, + Price: newPrice, + PhysicalPicturePath: 'static/EecProductData/' + item.PhysicalPicturePath, + CertificatePath: `static/EecProductData/${item.CertificatePath}`, + Tip: `澶囨鏃堕棿锛�${item.RecordTime} \n 澶囨鍙凤細${item.RecordNumber}`, + }; + }); + + for (let i = 0; i < result.length; i += 15) { + arr.push(result.slice(i, i + 15)); + } + state.catalogItemList = arr; + + if (cb) { + cb(); + } + }) + .catch((err) => { + state.m_PageLoading = false; + }); +}; + const initMapChart = () => { let allEecProductNumber = 0; let mapData = cooperationData.value.map((item) => { @@ -944,6 +882,302 @@ console.log(err); }); }; +const initPipeOneChart = () => { + if (pieChartRef.value && barChartRef.value) { + // 鍒濆鍖栭ゼ鍥� + const pieChart = echarts.init(pieChartRef.value); + pieChart.setOption({ + title: { + text: `鎬婚噺\n${totalCount.value}`, + left: '30%', + top: '50%', + textStyle: { + fontSize: 14, + lineHeight: 24, + align: 'center', + fontWeight: 'normal', + rich: { + value: { + fontSize: 24, + fontWeight: 'bold', + padding: [10, 0], + }, + }, + }, + textAlign: 'center', + textVerticalAlign: 'middle', + }, + tooltip: { + trigger: 'item', + formatter: '{b}: {c} ({d}%)', + }, + legend: { + orient: 'vertical', + right: '-1%', + top: 'middle', + formatter: (name: string) => { + const item = chartData.find((d) => d.name === name); + return `${name}: ${item?.value} (${item?.percentage})`; + }, + }, + series: [ + { + type: 'pie', + radius: ['40%', '70%'], + center: ['30%', '50%'], + avoidLabelOverlap: false, + itemStyle: { + borderRadius: 10, + borderColor: '#fff', + borderWidth: 2, + }, + label: { + show: false, + }, + emphasis: { + label: { + show: false, + }, + }, + data: chartData.map((item) => ({ + value: item.value, + name: item.name, + })), + color: ['#5B8FF9', '#5AD8A6', '#5D7092', '#F6BD16', '#E8684A'], + }, + ], + }); + + // 鍒濆鍖栨煴鐘跺浘 + const barChart = echarts.init(barChartRef.value); + barChart.setOption({ + title: { + text: '鑳芥晥浜у搧鍒嗙被鏁伴噺缁熻', + left: 'center', + top: 10, + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow', + }, + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true, + }, + xAxis: { + type: 'category', + data: chartData.map((item) => item.name), + axisLabel: { + interval: 0, + rotate: 30, + }, + }, + yAxis: { + type: 'value', + name: '鏁伴噺', + }, + series: [ + { + data: chartData.map((item) => item.value), + type: 'bar', + barWidth: '40%', + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#83bff6' }, + { offset: 0.5, color: '#188df0' }, + { offset: 1, color: '#188df0' }, + ]), + }, + emphasis: { + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#2378f7' }, + { offset: 0.7, color: '#2378f7' }, + { offset: 1, color: '#83bff6' }, + ]), + }, + }, + }, + ], + }); + + // 鐩戝惉绐楀彛澶у皬鍙樺寲 + window.addEventListener('resize', () => { + pieChart.resize(); + barChart.resize(); + }); + } +}; +const initPipeTwoChart = () => { + if (pieChart2Ref.value && barChart2Ref.value) { + const pieChart2 = echarts.init(pieChart2Ref.value); + pieChart2.setOption({ + title: { + text: '鎬婚噺\n4083', + left: '30%', + top: '50%', + textStyle: { + fontSize: 14, + lineHeight: 24, + align: 'center', + fontWeight: 'normal', + rich: { + value: { + fontSize: 24, + fontWeight: 'bold', + padding: [10, 0], + }, + }, + }, + textAlign: 'center', + textVerticalAlign: 'middle', + }, + tooltip: { + trigger: 'item', + formatter: '{b}: {c} ({d}%)', + }, + legend: { + orient: 'vertical', + right: '-1%', + top: 'middle', + formatter: (name: string) => { + const item = chartData2.find((d) => d.name === name); + return `${name}: ${item?.value} (${item?.percentage})`; + }, + }, + series: [ + { + type: 'pie', + radius: ['40%', '70%'], + center: ['30%', '50%'], + avoidLabelOverlap: false, + itemStyle: { + borderRadius: 10, + borderColor: '#fff', + borderWidth: 2, + }, + label: { + show: false, + }, + emphasis: { + label: { + show: false, + }, + }, + data: chartData2.map((item) => ({ + value: item.value, + name: item.name, + })), + color: ['#5B8FF9', '#5AD8A6', '#5D7092', '#F6BD16'], + }, + ], + }); + + // 鍒濆鍖栫浜屼釜鏌辩姸鍥� + const barChart2 = echarts.init(barChart2Ref.value); + barChart2.setOption({ + title: { + text: '鍩虹鍏辨�х被浜у搧鏁伴噺缁熻', + left: 'center', + top: 10, + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow', + }, + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true, + }, + xAxis: { + type: 'category', + data: ['姹熻嫃鐪�', '鍖椾含甯�', '娴欐睙鐪�', '涓婃捣甯�', '灞变笢鐪�', '骞夸笢鐪�'], + axisLabel: { + interval: 0, + rotate: 30, + }, + }, + yAxis: { + type: 'value', + name: '鏁伴噺', + max: 600, + }, + series: [ + { + data: [500, 450, 220, 150, 150, 120], + type: 'bar', + barWidth: '40%', + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#26c4f6' }, + { offset: 0.5, color: '#26c4f6' }, + { offset: 1, color: '#26c4f6' }, + ]), + }, + }, + ], + }); + + // 鐩戝惉绐楀彛澶у皬鍙樺寲 + window.addEventListener('resize', () => { + pieChart2.resize(); + barChart2.resize(); + }); + } +}; + +// 鐩戝惉浜у搧绫诲瀷閫夋嫨 +const changeCatalog = (type: number) => { + state.curSelectCatalog = type; + state.catalogSwiperIndex = 0; + const cb = () => { + catalogSwiperRef.value?.slideTo(state.catalogSwiperIndex, 0); + // catalogSwiperRef.value?.autoplay = { + // delay: 3000, + // disableOnInteraction: false, + // pauseOnMouseEnter:true, + // }; + catalogSwiperRef.value?.update(); + }; + initCatalogList(cb); +}; +// 浜у搧绫诲瀷鐐瑰嚮 +const handleCatalogClick = (item: any) => { + console.log(item, '鎴戣鐐瑰嚮浜�'); +}; + +const onSwiper = (swiper: any) => { + console.log(swiper); + catalogSwiperRef.value = swiper; +}; +const onSlideChange = () => {}; +const toFeedBack = () => { + router.push('/feedback'); +}; +const toSubsidy = () => { + // 璺宠浆鍒拌缃戦〉 + window.open('https://www.sheitc.sh.gov.cn/', '_blank'); +}; +const scrollToTop = () => { + nextTick(() => { + document.getElementById('app-page').scrollTo({ + top: 0, + behavior: 'smooth', + }); + }); +}; + +onUnmounted(() => { + document.getElementById('app-page')?.removeEventListener('scroll', handleScroll); +}); </script> <style scoped> @@ -960,7 +1194,7 @@ .carousel-image { width: 100%; - /* height: 100%; */ + height: 100%; object-fit: fill; /* 淇敼涓篺ill浠ュ畬鍏ㄥ~鍏呭鍣� */ } @@ -991,6 +1225,15 @@ width: 100%; height: 100%; } +.card-hover-style { + /* display: flex; + justify-content: center; + align-items: center; */ + /* transform: translateY(50%); */ + background-color: #fff; + color: #000; + margin-right: unset; +} :deep(.el-carousel__arrow) { background-color: rgba(0, 0, 0, 0.5); border: none; @@ -1009,12 +1252,197 @@ .news-item { cursor: pointer; - border-bottom: 1px solid #e3e3e3; - &:first-child { - border-top: 1px solid #e3e3e3; + padding: 8px 0px; + font-size: 18px; + color: #5c5c5c; + font-family: 寰蒋闆呴粦; + font-weight: 500; +} + +:deep(.customer-service-dialog .el-dialog__body) { + padding: 0; +} + +:deep(.customer-service-dialog .el-dialog__header) { + display: block; +} + +.catalog-list { + padding: 20px; + box-sizing: border-box; + .catalog-item { + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + color: #003a8f; + font-size: 20px; + font-weight: 700; + &:hover { + color: #71b02b; + } } - &:last-child { - border-bottom: none; +} +.catalog-continer { + /* 鎬婚珮搴� - 涓婁笅padding - 琛岄棿璺� */ + height: 100%; /* 70px鏄笂涓媝adding鎬诲拰锛�60px鏄袱琛岄棿璺濇�诲拰 */ + padding: 35px; /* 鍋囪padding涓�20px锛屼綘鍙互鏍规嵁闇�瑕佽皟鏁� */ + display: grid; + grid-template-columns: repeat(5, 1fr); + grid-template-rows: repeat(3, 1fr); + gap: 30px; + overflow: hidden; + box-sizing: border-box; +} + +.catalog-continer-item { + background-color: #fff; + height: 100%; /* 鏀逛负100%浠ラ�傚簲grid甯冨眬 */ + border-radius: 20px; + box-sizing: border-box; + cursor: pointer; + &:hover { + img { + transform: scale(1.25); + transition: all 1s ease; + } + box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); } } + +.catalog-tag-active { + color: #71b02b !important; +} + +.news-title { + font-size: 20px; + color: #000000; + font-weight: 700; + font-family: 寰蒋闆呴粦; +} + +.left-news-temp-div { + border: 1px solid #ccc; + &::before { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 4px; + background-color: #003a8f; + } +} + +.right-news-temp-div { + /* border-top: 4px solid #003a8f; */ + position: relative; + &::before { + content: ''; + position: absolute; + top: 0px; + left: 0; + width: 20%; + height: 4px; + z-index: 1; + background-color: #71b02b; + } + &::after { + content: ''; + position: absolute; + top: 0px; + left: 20%; + width: 80%; + height: 4px; + z-index: 1; + background-color: #003a8f; + } + + .new-desc-text { + font-size: 16px; + color: #656565; + line-height: 29px; + font-family: 寰蒋闆呴粦; + font-weight: 300; + } +} +.news-list-dot { + width: 6px; + height: 6px; + background-image: linear-gradient(45deg, #93a5cf 0%, #e4efe9 100%); +} + +.eec-product-classify-div { + position: relative; + &::before { + content: ''; + position: absolute; + top: 0px; + left: 0; + width: 20%; + height: 4px; + z-index: 1; + background-color: #71b02b; + } + &::after { + content: ''; + position: absolute; + top: 0px; + left: 20%; + width: 80%; + height: 4px; + z-index: 1; + background-color: #003a8f; + } +} + +:deep(.catalog-swiper .swiper-slide) { + height: 100% !important; +} + +:deep(.catalog-swiper .swiper-pagination-bullet) { + width: 20px; + height: 20px; + text-align: center; + line-height: 20px; + font-size: 12px; + color: #000; + opacity: 1; + background: rgba(0, 0, 0, 0.2); +} + +:deep(.catalog-swiper .swiper-pagination-bullet-active) { + color: #fff; + background: #007aff; +} + +@keyframes fadeIn { + from { + opacity: 0; + transform: translateY(16px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes fadeOut { + from { + opacity: 1; + transform: translateY(0); + } + to { + opacity: 0; + transform: translateY(16px); + } +} + +.fade-enter-active { + animation: fadeIn 0.3s ease-out; +} + +.fade-leave-active { + animation: fadeOut 0.3s ease-out; +} </style> -- Gitblit v1.9.3