提交 e8ee4d52 authored 作者: coderBryanFu's avatar coderBryanFu

feat:更新moduleHeader组件和setChart.js

上级 b970396e
...@@ -128,7 +128,19 @@ const homeTitleList = ref([ ...@@ -128,7 +128,19 @@ const homeTitleList = ref([
} }
]); ]);
const homeActiveTitleIndex = ref(0); const homeActiveTitleIndex = computed(() => {
let activeIndex = 1
if (route.fullPath.includes('/ZMOverView')) {
activeIndex = 0
} else if (route.fullPath.includes('/dataLibrary')) {
activeIndex = 3
} else if (route.fullPath.includes('/chat') || route.fullPath.includes('/writtingAsstaint')) {
activeIndex = 2
} else {
activeIndex = 1
}
return activeIndex
})
const isShowMenu = ref(false); const isShowMenu = ref(false);
const handleShowMenu = (index, isShow) => { const handleShowMenu = (index, isShow) => {
...@@ -148,79 +160,150 @@ const handleHoverMenu = isShow => { ...@@ -148,79 +160,150 @@ const handleHoverMenu = isShow => {
isShowMenu.value = isShow; isShowMenu.value = isShow;
}; };
const menuList = ref([ const menuList = computed(() => {
// { let menu = [
// title: "中美科技博弈概览", // {
// icon: Menu1, // title: "中美科技博弈概览",
// path: "/ZMOverView" // icon: Menu1,
// }, // path: "/ZMOverView"
{ // },
title: "科技法案", {
icon: Menu2, title: "科技法案",
path: "/billHome", icon: Menu2,
active: false path: "/billHome",
}, active: false
{ },
title: "科技政令", {
icon: Menu3, title: "科技政令",
path: "/decree", icon: Menu3,
active: false path: "/decree",
}, active: false
{ },
title: "美国科技智库", {
icon: Menu4, title: "美国科技智库",
path: "/thinkTank", icon: Menu4,
active: false path: "/thinkTank",
}, active: false
{ },
title: "出口管制", {
icon: Menu5, title: "出口管制",
path: "/exportControl", icon: Menu5,
active: false path: "/exportControl",
}, active: false
{ },
title: "科研合作限制", {
icon: Menu6, title: "科研合作限制",
path: "/cooperationRestrictions", icon: Menu6,
active: false path: "/cooperationRestrictions",
}, active: false
{ },
title: "投融资限制", {
icon: Menu7, title: "投融资限制",
path: "/finance", icon: Menu7,
active: false path: "/finance",
}, active: false
{ },
title: "市场准入限制", {
icon: Menu8, title: "市场准入限制",
path: "/marketAccessRestrictions", icon: Menu8,
active: false path: "/marketAccessRestrictions",
}, active: false
{ },
title: "规则限制", {
icon: Menu9, title: "规则限制",
path: "/ruleRestrictions", icon: Menu9,
active: false path: "/ruleRestrictions",
}, active: false
{ },
title: "美国科技人物观点", {
icon: Menu10, title: "美国科技人物观点",
path: "/technologyFigures", icon: Menu10,
active: false path: "/technologyFigures",
}, active: false
{ },
title: "美国主要创新主体动向", {
icon: Menu11, title: "美国主要创新主体动向",
path: "/innovationSubject", icon: Menu11,
active: false path: "/innovationSubject",
}, active: false
{ },
title: "美国科研资助体系", {
icon: Menu12, title: "美国科研资助体系",
path: "/scientificFunding", icon: Menu12,
active: false path: "/scientificFunding",
active: false
}
]
switch (route.fullPath) {
case '/billHome':
menu.forEach(item => {
item.active = false
})
menu[0].active = true
break
case '/decree':
menu.forEach(item => {
item.active = false
})
menu[1].active = true
break
case '/thinkTank':
menu.forEach(item => {
item.active = false
})
menu[2].active = true
break
case '/exportControl':
menu.forEach(item => {
item.active = false
})
menu[3].active = true
break
case '/cooperationRestrictions':
menu.forEach(item => {
item.active = false
})
menu[4].active = true
break
case '/finance':
menu.forEach(item => {
item.active = false
})
menu[5].active = true
break
case '/marketAccessRestrictions':
menu.forEach(item => {
item.active = false
})
menu[6].active = true
break
case '/ruleRestrictions':
menu.forEach(item => {
item.active = false
})
menu[7].active = true
break
case '/technologyFigures':
menu.forEach(item => {
item.active = false
})
menu[8].active = true
break
case '/innovationSubject':
menu.forEach(item => {
item.active = false
})
menu[9].active = true
break
case '/scientificFunding':
menu.forEach(item => {
item.active = false
})
menu[10].active = true
break
} }
]); return menu
})
const isShowTool = ref(false); const isShowTool = ref(false);
...@@ -243,13 +326,7 @@ const toolList = ref([ ...@@ -243,13 +326,7 @@ const toolList = ref([
]) ])
const handleToModule = (item, index) => { const handleToModule = (item, index) => {
window.sessionStorage.setItem('homeActiveTitleIndex', index)
if (index === 1) { if (index === 1) {
homeActiveTitleIndex.value = index
menuList.value.forEach(val => {
val.active = false
})
item.active = true
router.push({ router.push({
path: item.path path: item.path
}) })
...@@ -268,10 +345,7 @@ const handleToModule = (item, index) => { ...@@ -268,10 +345,7 @@ const handleToModule = (item, index) => {
}; };
const handleClickTitle = (item, index) => { const handleClickTitle = (item, index) => {
if (index === 0 || index === 3) { if (index === 0 || index === 3) {
window.sessionStorage.setItem('homeActiveTitleIndex', index)
homeActiveTitleIndex.value = index
router.push(item.path) router.push(item.path)
} }
}; };
...@@ -282,17 +356,8 @@ const handleClickToolBox = () => { ...@@ -282,17 +356,8 @@ const handleClickToolBox = () => {
onMounted(() => { onMounted(() => {
handleGetPersonType(); handleGetPersonType();
if (route.query.titleIndex) {
homeActiveTitleIndex.value = Number(route.query.titleIndex)
} else {
homeActiveTitleIndex.value = Number(window.sessionStorage.getItem('homeActiveTitleIndex'))
}
}); });
onUnmounted(() => {
window.sessionStorage.removeItem('homeActiveTitleIndex')
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -73,8 +73,9 @@ const setChart = (option, chartId, allowClick, selectParam) => { ...@@ -73,8 +73,9 @@ const setChart = (option, chartId, allowClick, selectParam) => {
}); });
window.open(route.href, "_blank"); window.open(route.href, "_blank");
} else if (params.componentType === 'series' && params.seriesType === 'bar') { } else if (params.componentType === 'series' && params.seriesType === 'bar') {
const year = params.name.slice(0, 4)
const quatarNum = Number(params.name[params.name.length - 1]) const quatarNum = Number(params.name[params.name.length - 1])
selectParam.selectedDate = JSON.stringify(getQuarterRange(selectParam.selectedDate, quatarNum)) selectParam.selectedDate = JSON.stringify(getQuarterRange(year, quatarNum))
const route = router.resolve({ const route = router.resolve({
path: "/dataLibrary/dataDecree", path: "/dataLibrary/dataDecree",
query: selectParam query: selectParam
...@@ -86,7 +87,7 @@ const setChart = (option, chartId, allowClick, selectParam) => { ...@@ -86,7 +87,7 @@ const setChart = (option, chartId, allowClick, selectParam) => {
case '科技智库报告': case '科技智库报告':
if (selectParam.key === 1) { if (selectParam.key === 1) {
selectParam.domains = params.seriesName selectParam.domains = params.seriesName
const year = params.name.slice(0,4) const year = params.name.slice(0, 4)
const quatarNum = Number(params.name[params.name.length - 1]) const quatarNum = Number(params.name[params.name.length - 1])
selectParam.selectedDate = JSON.stringify(getQuarterRange(year, quatarNum)) selectParam.selectedDate = JSON.stringify(getQuarterRange(year, quatarNum))
const route = router.resolve({ const route = router.resolve({
......
...@@ -1093,11 +1093,21 @@ const handleBox9Data = async () => { ...@@ -1093,11 +1093,21 @@ const handleBox9Data = async () => {
const selectedIndex = box9LegislativeStatusList.value.findIndex( const selectedIndex = box9LegislativeStatusList.value.findIndex(
item => item.value === box9LegislativeStatus.value item => item.value === box9LegislativeStatus.value
); );
const arr = [
{ label: "提出法案", value: "提案" },
{ label: "众议院通过", value: "众议院通过" },
{ label: "参议院通过", value: "参议院通过" },
{ label: "解决分歧", value: "分歧已解决" },
{ label: "完成立法", value: "完成立法" }
]
const status = arr.filter(item => {
return item.value === box9LegislativeStatus.value
})[0].label
const selectParam = { const selectParam = {
moduleType: '国会法案', moduleType: '国会法案',
key: 2, key: 2,
selectedDate: box9selectetedTime.value ? JSON.stringify([box9selectetedTime.value + '-01-01', box9selectetedTime.value + '-12-31']) : '', selectedDate: box9selectetedTime.value ? JSON.stringify([box9selectetedTime.value + '-01-01', box9selectetedTime.value + '-12-31']) : '',
selectedStatus: box9LegislativeStatus.value ? box9LegislativeStatus.value : '全部阶段', selectedStatus: status ? status : '全部阶段',
isInvolveCn: true isInvolveCn: true
} }
box9ChartInstance = setChart(box9Chart, "box9Chart", true, selectParam); box9ChartInstance = setChart(box9Chart, "box9Chart", true, selectParam);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论