提交 e0c66c4d authored 作者: yanpeng's avatar yanpeng

bugfix 1

上级 accf8ee8
<template> <template>
<div class="search-container" v-show="!isShow"> <div class="search-container" v-show="!isShow">
<div class="search-type-tabs" v-if="enableBillTypeSwitch"> <div class="search-type-tabs" v-if="enableBillTypeSwitch">
<div class="search-type-tab" :class="{ active: billSearchType === 'federal' }" <div
@click="handleChangeBillSearchType('federal')"> class="search-type-tab"
:class="{ active: billSearchType === 'federal' }"
@click="handleChangeBillSearchType('federal')"
>
联邦议会 联邦议会
</div> </div>
<div class="search-type-tab" :class="{ active: billSearchType === 'state' }" <div
@click="handleChangeBillSearchType('state')"> class="search-type-tab"
:class="{ active: billSearchType === 'state' }"
@click="handleChangeBillSearchType('state')"
>
州议会 州议会
</div> </div>
</div> </div>
<div class="search-main" :class="{ 'search-main-with-tabs': enableBillTypeSwitch }"> <div class="search-main" :class="{ 'search-main-with-tabs': enableBillTypeSwitch }">
<input v-model="store.searchBillText" :placeholder="placeholder" @keyup.enter="handleSearch" <input v-model="store.searchBillText" :placeholder="placeholder" @keyup.enter="handleSearch" class="search-input" />
class="search-input" />
<div class="search-btn" @click="handleSearch"> <div class="search-btn" @click="handleSearch">
<img src="@/assets/icons/search-icon.png" alt /> <img src="@/assets/icons/search-icon.png" alt />
搜索 搜索
...@@ -32,7 +37,7 @@ ...@@ -32,7 +37,7 @@
</div> </div>
</div> </div>
<div class="btn" @click="handleToPosi('position2')"> <div class="btn" @click="handleToPosi('position2')">
<div class="btn-text">咨询要闻</div> <div class="btn-text">资讯要闻</div>
<div class="btn-icon"> <div class="btn-icon">
<img src="@/assets/icons/arrow-right-icon.png" alt /> <img src="@/assets/icons/arrow-right-icon.png" alt />
</div> </div>
...@@ -62,14 +67,7 @@ import { useWrittingAsstaintStore } from "@/stores/writtingAsstaintStore"; ...@@ -62,14 +67,7 @@ import { useWrittingAsstaintStore } from "@/stores/writtingAsstaintStore";
const store = useWrittingAsstaintStore(); const store = useWrittingAsstaintStore();
const router = useRouter(); const router = useRouter();
const { const { countInfo, containerRef, placeholder, areaName, enableBillTypeSwitch, defaultBillSearchType } = defineProps({
countInfo,
containerRef,
placeholder,
areaName,
enableBillTypeSwitch,
defaultBillSearchType
} = defineProps({
countInfo: { countInfo: {
type: Array, type: Array,
default: () => [] default: () => []
...@@ -138,11 +136,9 @@ watchEffect(() => { ...@@ -138,11 +136,9 @@ watchEffect(() => {
if (isShow.value) { if (isShow.value) {
homeMainRef.value.classList.add("scroll-main"); homeMainRef.value.classList.add("scroll-main");
homeMainRef.value.classList.add("scrollHomeMain"); homeMainRef.value.classList.add("scrollHomeMain");
} else { } else {
homeMainRef.value.classList.remove("scroll-main"); homeMainRef.value.classList.remove("scroll-main");
homeMainRef.value.classList.remove("scrollHomeMain"); homeMainRef.value.classList.remove("scrollHomeMain");
} }
store.changeIsShowSearchBar(isShow.value); store.changeIsShowSearchBar(isShow.value);
......
...@@ -74,7 +74,12 @@ ...@@ -74,7 +74,12 @@
<span>美对华领域打压遏制最新动态</span> <span>美对华领域打压遏制最新动态</span>
</div> </div>
<div class="title-right-select"> <div class="title-right-select">
<el-select v-model="selectedFieldForLatest" placeholder="全部领域" class="field-select"> <el-select
v-model="selectedFieldForLatest"
@change="handleFieldChange"
placeholder="全部领域"
class="field-select"
>
<el-option v-for="item in fieldOptions" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in fieldOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
</div> </div>
...@@ -131,7 +136,7 @@ ...@@ -131,7 +136,7 @@
<simple-pagination <simple-pagination
v-model:current-page="newsCurrentPage" v-model:current-page="newsCurrentPage"
:page-size="pageSize" :page-size="pageSize"
:total="newsList.length" :total="allNewsList.length"
@page-change="handleNewsPageChange" @page-change="handleNewsPageChange"
/> />
</div> </div>
...@@ -215,7 +220,7 @@ ...@@ -215,7 +220,7 @@
<div class="bottom-item"> <div class="bottom-item">
<div class="bottom-item-title"> <div class="bottom-item-title">
<img :src="icon4" alt="" /> <img :src="icon4" alt="" />
<span>美对领域打压遏制时间线</span> <span>美对领域打压遏制时间线</span>
</div> </div>
<el-select <el-select
v-model="selectedFieldTimeline" v-model="selectedFieldTimeline"
...@@ -408,6 +413,12 @@ const newsList = ref([]); ...@@ -408,6 +413,12 @@ const newsList = ref([]);
const newsCurrentPage = ref(1); const newsCurrentPage = ref(1);
const pageSize = ref(5); // 每页显示 5 条 const pageSize = ref(5); // 每页显示 5 条
const handleFieldChange = domainId => {
console.log("领域改变", domainId);
console.log("领域值 =>", selectedFieldForLatest.value);
getUSGovernmentLatestDynamicData();
};
// 总页数 // 总页数
const totalPages = computed(() => { const totalPages = computed(() => {
return Math.ceil(newsList.value.length / pageSize.value) || 1; return Math.ceil(newsList.value.length / pageSize.value) || 1;
...@@ -445,10 +456,11 @@ const handleNextPage = () => { ...@@ -445,10 +456,11 @@ const handleNextPage = () => {
const getUSGovernmentLatestDynamicData = async () => { const getUSGovernmentLatestDynamicData = async () => {
try { try {
const params = { const params = {
orgId: !!deptValueForLatest.value ? deptValueForLatest.value : null, domainId: !!selectedFieldForLatest.value ? selectedFieldForLatest.value : null,
pageSize: 50, pageSize: 50,
currentPage: newsCurrentPage.value currentPage: newsCurrentPage.value
}; };
console.log("领域值 =>", selectedFieldForLatest.value);
const res = await getUSGovernmentLatestDynamic(params); const res = await getUSGovernmentLatestDynamic(params);
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
// 将接口数据转换为 newsList 需要的格式 // 将接口数据转换为 newsList 需要的格式
......
...@@ -185,8 +185,8 @@ ...@@ -185,8 +185,8 @@
<simple-pagination <simple-pagination
v-model:current-page="rankCurrentPage" v-model:current-page="rankCurrentPage"
:page-size="pageSize" :page-size="rankingPageSize"
:total="rankingList.length" :total="allRankingList.length"
@page-change="handleRankPageChange" @page-change="handleRankPageChange"
/> />
</div> </div>
...@@ -419,6 +419,7 @@ const getUSGovernmentSanctionHistoryData = async () => { ...@@ -419,6 +419,7 @@ const getUSGovernmentSanctionHistoryData = async () => {
const loadingJointRank = ref(false); const loadingJointRank = ref(false);
const getUSGovernmentJointSanctionRankData = async () => { const getUSGovernmentJointSanctionRankData = async () => {
loadingJointRank.value = true; loadingJointRank.value = true;
const params = {};
try { try {
const res = await getUSGovernmentJointSanctionRank(); const res = await getUSGovernmentJointSanctionRank();
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
...@@ -487,8 +488,8 @@ const updateDynamicListByPage = () => { ...@@ -487,8 +488,8 @@ const updateDynamicListByPage = () => {
}; };
const updateRankListByPage = () => { const updateRankListByPage = () => {
const start = (rankCurrentPage.value - 1) * pageSize.value; const start = (rankCurrentPage.value - 1) * rankingPageSize.value;
const end = start + pageSize.value; const end = start + rankingPageSize.value;
rankingList.value = allRankingList.value.slice(start, end); rankingList.value = allRankingList.value.slice(start, end);
}; };
// 点击科技要闻-跳转详情页 // 点击科技要闻-跳转详情页
...@@ -785,31 +786,7 @@ const fieldOptions = ref([ ...@@ -785,31 +786,7 @@ const fieldOptions = ref([
{ label: "其他", value: "99" } { label: "其他", value: "99" }
]); ]);
const methodOptions = ref([ const methodOptions = ref([]);
// { label: "全部制裁手段", value: "" },
// { label: "法案", value: "-1" },
// { label: "政令", value: "-2" },
// { label: "实体清单", value: "1" },
// { label: "特别国民指定清单", value: "2" },
// { label: "涉军企业", value: "3" },
// { label: "行业制裁识别清单", value: "4" },
// { label: "无法核实清单", value: "5" },
// { label: "军事最终用户清单", value: "6" },
// { label: "非SDN中国军工企业名单", value: "7" },
// { label: "拒绝往来人员清单", value: "8" },
// { label: "军事最终用途与最终用户规则", value: "9" },
// { label: "欧盟合并制裁清单", value: "10" },
// { label: "英国制裁清单", value: "11" },
// { label: "加拿大合并自主制裁清单", value: "12" },
// { label: "商业管制清单", value: "13" }
// { label: "232调查", value: "14" },
// { label: "Capta List (CAP) - Treasury Department", value: "15" },
// { label: "ITAR Debarred (DTC) - State Department", value: "16" },
// { label: "Nonproliferation Sanctions (ISN) - State Department", value: "17" },
// { label: "Non-SDN Menu-Based Sanctions List (NS-MBS List) - Treasury Department", value: "18" },
// { label: "Palestinian Legislative Council List (PLC) - Treasury Department", value: "19" },
// { label: "经验证最终用户清单", value: "20" }
]);
const handleGetSanList = async () => { const handleGetSanList = async () => {
const params = { const params = {
...@@ -825,16 +802,17 @@ const handleGetSanList = async () => { ...@@ -825,16 +802,17 @@ const handleGetSanList = async () => {
value: item.id value: item.id
}; };
}); });
methodValue.value = "";
} }
} catch (error) {} } catch (error) {}
}; };
watch( // watch(
() => methodValue.value, // () => methodValue.value,
val => { // val => {
getDepartmentListData(); // getDepartmentListData();
} // }
); // );
watch( watch(
() => deptValue.value, () => deptValue.value,
...@@ -847,6 +825,7 @@ const allDynamicData = ref([]); ...@@ -847,6 +825,7 @@ const allDynamicData = ref([]);
const dynamicList = ref([]); const dynamicList = ref([]);
const newsCurrentPage = ref(1); const newsCurrentPage = ref(1);
const pageSize = ref(5); // 每页显示 5 条 const pageSize = ref(5); // 每页显示 5 条
const rankingPageSize = ref(10);
const handleNewsPageChange = page => { const handleNewsPageChange = page => {
newsCurrentPage.value = page; newsCurrentPage.value = page;
...@@ -1662,7 +1641,7 @@ const prev = () => { ...@@ -1662,7 +1641,7 @@ const prev = () => {
// border-radius: 10px; // border-radius: 10px;
// border: 1px solid rgb(234, 236, 238); // border: 1px solid rgb(234, 236, 238);
border-bottom: 1px solid rgb(234, 236, 238); border-bottom: 1px solid rgb(234, 236, 238);
padding: 12px 24px; padding: 10px 24px;
margin-bottom: 12px; margin-bottom: 12px;
box-sizing: border-box; box-sizing: border-box;
......
...@@ -6,10 +6,16 @@ ...@@ -6,10 +6,16 @@
<img src="./assets/leftbtn.png" alt class="left-btn" @click="prev" :class="{ disabled: startIndex === 0 }" /> <img src="./assets/leftbtn.png" alt class="left-btn" @click="prev" :class="{ disabled: startIndex === 0 }" />
<div class="content"> <div class="content">
<div class="carousel-container" :style="{ transform: `translateX(-${startIndex * (307 + 16)}px)` }"> <div class="carousel-container" :style="{ transform: `translateX(-${startIndex * (307 + 16)}px)` }">
<div class="carousel-item" v-for="item, index in carouselList" :key="index"> <div class="carousel-item" v-for="(item, index) in carouselList" :key="index">
<div class="item-top"> <div class="item-top">
<div class="top-img"> <div class="top-img">
<img :src="ele" :class="{ img1: index !== 0 }" alt v-for="(ele, idx) in item.imageList" :key="idx" /> <img
:src="ele"
:class="{ img1: index !== 0 }"
alt
v-for="(ele, idx) in item.imageList"
:key="idx"
/>
</div> </div>
<div class="top-num">{{ item.count }}</div> <div class="top-num">{{ item.count }}</div>
</div> </div>
...@@ -20,13 +26,18 @@ ...@@ -20,13 +26,18 @@
:key="idxx"> :key="idxx">
{{ ele.industryName }} {{ ele.industryName }}
</div> --> </div> -->
<AreaTag v-for="ele, idxx in item.industryList" :key="idxx" :tagName="ele.industryName"></AreaTag> <AreaTag v-for="(ele, idxx) in item.industryList" :key="idxx" :tagName="ele.industryName"></AreaTag>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<img src="./assets/rightbtn.png" alt class="right-btn" @click="next" <img
:class="{ disabled: startIndex >= carouselList.length - 5 }" /> src="./assets/rightbtn.png"
alt
class="right-btn"
@click="next"
:class="{ disabled: startIndex >= carouselList.length - 5 }"
/>
</div> </div>
<!-- 排华联盟分布 --> <!-- 排华联盟分布 -->
...@@ -48,8 +59,13 @@ ...@@ -48,8 +59,13 @@
<div class="item" v-for="(item, index) in countList" :key="index"> <div class="item" v-for="(item, index) in countList" :key="index">
<div class="item-left"> <div class="item-left">
<img :src="item.image" alt /> <img :src="item.image" alt />
<el-tooltip effect="dark" :content="item.zhName" popper-class="common-prompt-popper" placement="top" <el-tooltip
:show-after="500"> effect="dark"
:content="item.zhName"
popper-class="common-prompt-popper"
placement="top"
:show-after="500"
>
<span>{{ item.zhName }}</span> <span>{{ item.zhName }}</span>
</el-tooltip> </el-tooltip>
</div> </div>
...@@ -91,13 +107,18 @@ ...@@ -91,13 +107,18 @@
<span>排华联盟最新动态</span> <span>排华联盟最新动态</span>
</div> </div>
<div class="news-content"> <div class="news-content">
<div class="item" v-for="item, index in newsList" :key="index"> <div class="item" v-for="(item, index) in newsList" :key="index">
<div class="item-title"> <div class="item-title">
<img :src="item.image || defaultImg" alt /> <img :src="item.image || defaultImg" alt />
<span @click="handleClick(item)">{{ item.title }}</span> <span @click="handleClick(item)">{{ item.title }}</span>
</div> </div>
<el-tooltip effect="dark" :content="item.content" popper-class="common-prompt-popper" placement="top" <el-tooltip
:show-after="500"> effect="dark"
:content="item.content"
popper-class="common-prompt-popper"
placement="top"
:show-after="500"
>
<div class="item-content">{{ item.content }}</div> <div class="item-content">{{ item.content }}</div>
</el-tooltip> </el-tooltip>
<div class="item-bottom"> <div class="item-bottom">
...@@ -106,7 +127,7 @@ ...@@ -106,7 +127,7 @@
:key="idx"> :key="idx">
<span>{{ ele.industryName }}</span> <span>{{ ele.industryName }}</span>
</div> --> </div> -->
<AreaTag v-for="ele, idx in item.industryList" :key="idx" :tagName="ele.industryName"></AreaTag> <AreaTag v-for="(ele, idx) in item.industryList" :key="idx" :tagName="ele.industryName"></AreaTag>
</div> </div>
<div class="bottom-right">{{ getTime(item.time) }}</div> <div class="bottom-right">{{ getTime(item.time) }}</div>
</div> </div>
...@@ -123,16 +144,26 @@ ...@@ -123,16 +144,26 @@
<div class="item-title"> <div class="item-title">
<div class="title-left"> <div class="title-left">
<div class="img-list"> <div class="img-list">
<img :src="ele.image || defaultImg" :class="{ img1: index !== 0 }" <img
@error="e => (e.target.src = defaultImg)" alt v-for="(ele, index) in item.countryList" :src="ele.image || defaultImg"
:key="index" /> :class="{ img1: index !== 0 }"
@error="e => (e.target.src = defaultImg)"
alt
v-for="(ele, index) in item.countryList"
:key="index"
/>
</div> </div>
<div class="left-content">{{ getContent(item.countryList) }}</div> <div class="left-content">{{ getContent(item.countryList) }}</div>
</div> </div>
<div class="title-right">{{ item.statementList?.length }}次合作</div> <div class="title-right">{{ item.statementList?.length }}次合作</div>
</div> </div>
<div class="item-content"> <div class="item-content">
<div class="content-list" v-for="(ele, idx) in item.statementList" :key="idx" @click="handleClick(ele)"> <div
class="content-list"
v-for="(ele, idx) in item.statementList"
:key="idx"
@click="handleClick(ele)"
>
<div class="list-left"> <div class="list-left">
<!-- <span>{{ getName(ele.industryList) }}</span> --> <!-- <span>{{ getName(ele.industryList) }}</span> -->
<AreaTag v-if="getName(ele.industryList)" :tagName="getName(ele.industryList)"></AreaTag> <AreaTag v-if="getName(ele.industryList)" :tagName="getName(ele.industryList)"></AreaTag>
...@@ -945,7 +976,7 @@ const initRightDonut = async () => { ...@@ -945,7 +976,7 @@ const initRightDonut = async () => {
value: res.data[i].amount, value: res.data[i].amount,
x: Math.random() * 10, x: Math.random() * 10,
y: Math.random() * 10, y: Math.random() * 10,
symbolSize: res.data[i].amount * 9, symbolSize: res.data[i].amount * 9
}; };
// 先判断data中是否包含上述数据 // 先判断data中是否包含上述数据
...@@ -985,8 +1016,8 @@ const initRightDonut = async () => { ...@@ -985,8 +1016,8 @@ const initRightDonut = async () => {
// text: 'Basic Graph' // text: 'Basic Graph'
}, },
tooltip: { tooltip: {
trigger: 'item', // 针对Graph的节点/边触发(必配,否则弹框不生效) trigger: "item", // 针对Graph的节点/边触发(必配,否则弹框不生效)
triggerOn: 'click', triggerOn: "click",
formatter: function (params) { formatter: function (params) {
// params.data 是当前点击节点的完整数据对象 // params.data 是当前点击节点的完整数据对象
const { name, value } = params.data; const { name, value } = params.data;
...@@ -1018,7 +1049,7 @@ const initRightDonut = async () => { ...@@ -1018,7 +1049,7 @@ const initRightDonut = async () => {
show: true show: true
}, },
edgeSymbol: ["circle", ""], edgeSymbol: ["circle", ""],
edgeSymbolSize: [4, 40], edgeSymbolSize: [4, 80],
edgeLabel: { edgeLabel: {
fontSize: 20 fontSize: 20
}, },
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
<!-- 资讯要问 --> <!-- 资讯要问 -->
<div class="ask" id="position2"> <div class="ask" id="position2">
<com-title title="咨询要闻" /> <com-title title="资讯要闻" />
<div class="ask-main"> <div class="ask-main">
<askPage /> <askPage />
</div> </div>
......
...@@ -3,8 +3,13 @@ ...@@ -3,8 +3,13 @@
<div class="main-content" ref="homeMainRef"> <div class="main-content" ref="homeMainRef">
<div class="home-top-bg"></div> <div class="home-top-bg"></div>
<!-- 搜索栏部分 --> <!-- 搜索栏部分 -->
<SearchContainer v-if="homeMainRef" :countInfo="statCountInfo" placeholder="搜索规则限制" :containerRef="homeMainRef" <SearchContainer
areaName="" /> v-if="homeMainRef"
:countInfo="statCountInfo"
placeholder="搜索规则限制"
:containerRef="homeMainRef"
areaName=""
/>
<!-- 最新动态 --> <!-- 最新动态 -->
<div class="newdata" id="position1"> <div class="newdata" id="position1">
<com-title title="最新动态" /> <com-title title="最新动态" />
...@@ -14,7 +19,7 @@ ...@@ -14,7 +19,7 @@
</div> </div>
<!-- 资讯要问 --> <!-- 资讯要问 -->
<div class="ask" id="position2"> <div class="ask" id="position2">
<com-title title="咨询要闻" /> <com-title title="资讯要闻" />
<div class="ask-main"> <div class="ask-main">
<askPage /> <askPage />
</div> </div>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</div> </div>
</div> </div>
<div class="btn" @click="handleToPosi('position2')"> <div class="btn" @click="handleToPosi('position2')">
<div class="btn-text">咨询要闻</div> <div class="btn-text">资讯要闻</div>
<div class="btn-icon"> <div class="btn-icon">
<img src="@/assets/icons/arrow-right-icon.png" alt /> <img src="@/assets/icons/arrow-right-icon.png" alt />
</div> </div>
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
<div class="btn-icon"> <div class="btn-icon">
<img src="@/assets/icons/arrow-right-icon.png" alt /> <img src="@/assets/icons/arrow-right-icon.png" alt />
</div> </div>
</div>, </div>
,
<div class="btn" @click="handleToPosi('position4')"> <div class="btn" @click="handleToPosi('position4')">
<div class="btn-text">资源库</div> <div class="btn-text">资源库</div>
<div class="btn-icon"> <div class="btn-icon">
...@@ -85,7 +86,7 @@ ...@@ -85,7 +86,7 @@
</div> </div>
</div> </div>
<div class="btn" @click="handleToPosi('position2')"> <div class="btn" @click="handleToPosi('position2')">
<div class="btn-text">咨询要闻</div> <div class="btn-text">资讯要闻</div>
<div class="btn-icon"> <div class="btn-icon">
<img src="@/assets/icons/arrow-right-icon.png" alt /> <img src="@/assets/icons/arrow-right-icon.png" alt />
</div> </div>
...@@ -113,7 +114,7 @@ ...@@ -113,7 +114,7 @@
</div> </div>
<!-- 资讯要问 --> <!-- 资讯要问 -->
<div class="ask" id="position2"> <div class="ask" id="position2">
<com-title title="咨询要闻" /> <com-title title="资讯要闻" />
<div class="ask-main"> <div class="ask-main">
<askPage /> <askPage />
</div> </div>
...@@ -145,7 +146,7 @@ import askPage from "./components/askPage/index.vue"; ...@@ -145,7 +146,7 @@ import askPage from "./components/askPage/index.vue";
import dataSub from "./components/dataSub/index.vue"; import dataSub from "./components/dataSub/index.vue";
import resLib from "./components/resLib/index.vue"; import resLib from "./components/resLib/index.vue";
import { useContainerScroll } from "@/hooks/useScrollShow"; import { useContainerScroll } from "@/hooks/useScrollShow";
import { getStatCount } from '@/api/ruleRestriction/index.js' import { getStatCount } from "@/api/ruleRestriction/index.js";
// 搜索框 // 搜索框
const input = ref(""); const input = ref("");
...@@ -154,59 +155,59 @@ const { isShow } = useContainerScroll(homeMainRef); ...@@ -154,59 +155,59 @@ const { isShow } = useContainerScroll(homeMainRef);
const router = useRouter(); const router = useRouter();
const statCountInfo = ref({}) const statCountInfo = ref({});
const getStatCountInfo = async () => { const getStatCountInfo = async () => {
try { try {
const res = await getStatCount(); const res = await getStatCount();
if (res && res.code === 200) { if (res && res.code === 200) {
// console.log('----getStatCountInfo', res.data) // console.log('----getStatCountInfo', res.data)
statCountInfo.value = res.data statCountInfo.value = res.data;
} }
} catch (error) { } catch (error) {
console.error("获取首页统计接口失败:", error); console.error("获取首页统计接口失败:", error);
} }
} };
// 搜索功能 // 搜索功能
const handleSearch = () => { const handleSearch = () => {
console.log("搜索内容:", input.value); console.log("搜索内容:", input.value);
}; };
// 锚点跳转 // 锚点跳转
const handleToPosi = id => { const handleToPosi = id => {
const element = document.getElementById(id); const element = document.getElementById(id);
if (element && homeMainRef.value) { if (element && homeMainRef.value) {
// 如果当前还未显示吸顶搜索栏,先强制切换状态以稳定布局 // 如果当前还未显示吸顶搜索栏,先强制切换状态以稳定布局
if (!isShow.value) { if (!isShow.value) {
isShow.value = true; isShow.value = true;
} }
// 使用 nextTick 确保 DOM 状态更新(高度变化生效)后再计算 // 使用 nextTick 确保 DOM 状态更新(高度变化生效)后再计算
nextTick(() => { nextTick(() => {
const containerRect = homeMainRef.value.getBoundingClientRect(); const containerRect = homeMainRef.value.getBoundingClientRect();
const elementRect = element.getBoundingClientRect(); const elementRect = element.getBoundingClientRect();
// 使用 getBoundingClientRect 计算元素相对于容器顶部的绝对距离,不受嵌套布局影响 // 使用 getBoundingClientRect 计算元素相对于容器顶部的绝对距离,不受嵌套布局影响
const top = elementRect.top - containerRect.top + homeMainRef.value.scrollTop; const top = elementRect.top - containerRect.top + homeMainRef.value.scrollTop;
homeMainRef.value.scrollTo({ homeMainRef.value.scrollTo({
top: top, top: top,
behavior: "smooth" behavior: "smooth"
}); });
}); });
} }
}; };
// 返回首页 // 返回首页
const handleBackHome = () => { const handleBackHome = () => {
router.push({ router.push({
path: "/overview" path: "/overview"
}); });
}; };
onMounted(async () => { onMounted(async () => {
await getStatCountInfo() await getStatCountInfo();
}) });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -14,8 +14,14 @@ ...@@ -14,8 +14,14 @@
<div class="main-content" ref="containerRef"> <div class="main-content" ref="containerRef">
<div class="home-top-bg"></div> <div class="home-top-bg"></div>
<!-- 搜索栏部分 --> <!-- 搜索栏部分 -->
<SearchContainer style="margin-bottom: 48px;height: fit-content;" v-if="containerRef" :countInfo="countInfo" <SearchContainer
placeholder="搜索科研资助实体、资助记录" :containerRef="containerRef" areaName="" /> style="margin-bottom: 48px; height: fit-content"
v-if="containerRef"
:countInfo="countInfo"
placeholder="搜索科研资助实体、资助记录"
:containerRef="containerRef"
areaName=""
/>
<!-- <div class="search"> --> <!-- <div class="search"> -->
<!-- <div class="search-main"> <!-- <div class="search-main">
...@@ -51,7 +57,7 @@ ...@@ -51,7 +57,7 @@
</div> </div>
</div> </div>
<div class="btn" @click="scrollToTop('position2')"> <div class="btn" @click="scrollToTop('position2')">
<div class="btn-text">咨询要闻</div> <div class="btn-text">资讯要闻</div>
<div class="btn-icon"> <div class="btn-icon">
<img src="@/assets/icons/arrow-right-icon.png" alt="" /> <img src="@/assets/icons/arrow-right-icon.png" alt="" />
</div> </div>
...@@ -80,7 +86,7 @@ ...@@ -80,7 +86,7 @@
<div class="data-item-name">{{ item.orgNameEn }}</div> <div class="data-item-name">{{ item.orgNameEn }}</div>
<div v-if="item.orgAbbEn" class="data-item-abb">{{ item.orgAbbEn }}</div> <div v-if="item.orgAbbEn" class="data-item-abb">{{ item.orgAbbEn }}</div>
</div> </div>
<div class="data-item-num" :style="{ color: color[index] }">{{ item.num + '项' }}</div> <div class="data-item-num" :style="{ color: color[index] }">{{ item.num + "项" }}</div>
</div> </div>
</div> </div>
<!-- 最新动态 --> <!-- 最新动态 -->
...@@ -92,7 +98,7 @@ ...@@ -92,7 +98,7 @@
</div> </div>
<!-- 资讯要问 --> <!-- 资讯要问 -->
<div class="ask" id="position2"> <div class="ask" id="position2">
<com-title title="咨询要闻" /> <com-title title="资讯要闻" />
<div class="ask-main"> <div class="ask-main">
<askPage /> <askPage />
</div> </div>
...@@ -125,10 +131,7 @@ import dataSub from "./components/dataSub/index.vue"; ...@@ -125,10 +131,7 @@ import dataSub from "./components/dataSub/index.vue";
import resLib from "./components/resLib/index.vue"; import resLib from "./components/resLib/index.vue";
import scrollToTop from "@/utils/scrollToTop"; import scrollToTop from "@/utils/scrollToTop";
import { getFundSourceOrg } from "@/api/scientificFunding/overview";
import {
getFundSourceOrg
} from "@/api/scientificFunding/overview";
import { useContainerScroll } from "@/hooks/useScrollShow"; import { useContainerScroll } from "@/hooks/useScrollShow";
...@@ -141,21 +144,21 @@ import img06 from "./assets/images/img06.png"; ...@@ -141,21 +144,21 @@ import img06 from "./assets/images/img06.png";
let containerRef = ref(null); let containerRef = ref(null);
let countInfo = ref([ let countInfo = ref([
{ {
name: '科研资助机构', name: "科研资助机构",
count: 18 count: 18
}, },
{ {
name: '科研资助动态', name: "科研资助动态",
count: 633 count: 633
}, },
{ {
name: '科研资助项目', name: "科研资助项目",
count: 312 count: 312
}, },
{ {
name: '经费总额(亿美元)', name: "经费总额(亿美元)",
count: '15,556' count: "15,556"
}, }
]); ]);
// 搜索框 // 搜索框
const input = ref(""); const input = ref("");
...@@ -231,14 +234,14 @@ const color = ref([ ...@@ -231,14 +234,14 @@ const color = ref([
"rgba(64, 150, 255, 1)", "rgba(64, 150, 255, 1)",
"rgb(33, 129, 57)", "rgb(33, 129, 57)",
"rgb(5, 95, 194)" "rgb(5, 95, 194)"
]) ]);
//// 来源机构列表 //// 来源机构列表
const handleGetFundSourceOrg = async () => { const handleGetFundSourceOrg = async () => {
try { try {
const res = await getFundSourceOrg(); const res = await getFundSourceOrg();
console.log("来源机构列表", res); console.log("来源机构列表", res);
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
dataList.value = res.data dataList.value = res.data;
} }
} catch (error) { } catch (error) {
console.error("获取来源机构列表error", error); console.error("获取来源机构列表error", error);
...@@ -246,7 +249,7 @@ const handleGetFundSourceOrg = async () => { ...@@ -246,7 +249,7 @@ const handleGetFundSourceOrg = async () => {
}; };
onMounted(async () => { onMounted(async () => {
handleGetFundSourceOrg() handleGetFundSourceOrg();
}); });
</script> </script>
...@@ -461,7 +464,9 @@ onMounted(async () => { ...@@ -461,7 +464,9 @@ onMounted(async () => {
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
cursor: pointer; cursor: pointer;
transition: transform 0.3s ease, box-shadow 0.3s ease; transition:
transform 0.3s ease,
box-shadow 0.3s ease;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0px 24px; padding: 0px 24px;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论