文案更新且增加路由跳转并定位

This commit is contained in:
caishi 2026-04-29 16:07:23 +08:00
parent ce2009b82a
commit 8149a01e5a
3 changed files with 40 additions and 18 deletions

View File

@ -4,7 +4,7 @@ import { useState , useEffect } from 'react';
import { information } from '../info';
import { getDocList } from '../api'
import "../home/index.less";
import { useModel , Link } from 'umi';
import { useModel , Link , useLocation } from 'umi';
import SpeTitle from '../components/Title';
import Infoleftbanner from '../img/infoleftbanner.png';
import Resource from '../img/resource.png';
@ -22,6 +22,21 @@ function Information() {
const[ title ,setTitle] = useState(undefined);
const[ searchTitle ,setSearchTitle] = useState(undefined);
const [ showNews , setShowNews] = useState(false);
let { hash } = useLocation();
useEffect(() => {
if (hash) {
setTimeout(()=>{
const element = document.getElementById(hash.slice(1));
if (element) {
//
const headerHeight = document.querySelector('header')?.offsetHeight || 64;
const elementTop = element.getBoundingClientRect().top + headerHeight;
window.scrollTo({ top: elementTop, behavior: 'smooth' });
}
},200);
}
}, [hash]);
function saishiNewActive(){
const observer = new IntersectionObserver((entries) => {
@ -104,18 +119,20 @@ function Information() {
const getList = (id, name,title) => {
return new Promise((resolve, reject) => {
getDocList(id).then(res => {
let list = res.rows;
list = title ? list.filter(i=>i.name.indexOf(title)>-1 || i.summary.indexOf(title)>-1) : list;
list.forEach(e => {
if (e.publishTime) {
let time = e.publishTime.split('/');
e.date1 = `${time[0]}${time[1]}`;
e.date2 = `${time[2]}`;
} else {
e.date1 = e.date2 = '-'
}
})
resolve({ name, list: list });
if(res){
let list = res.rows;
list = title ? list.filter(i=>i.name.indexOf(title)>-1 || i.summary.indexOf(title)>-1) : list;
list.forEach(e => {
if (e.publishTime) {
let time = e.publishTime.split('/');
e.date1 = `${time[0]}${time[1]}`;
e.date2 = `${time[2]}`;
} else {
e.date1 = e.date2 = '-'
}
})
resolve({ name, list: list });
}
})
})
}
@ -227,7 +244,7 @@ function Information() {
{
information.category.map((e) => {
return e.anchor === "guide" && <div className="content part" key={ e.anchor }>
<div className="content-wrapper">
<div className="content-wrapper expalinWrapper">
{
informationList[e.anchor].map(( e, k ) => {
return <div className="content-item" key={ k }><div className="explainBox">

View File

@ -376,6 +376,14 @@
background-image: url(../img/explain.png);
background-size: 100% 100%;
padding-bottom: 60px;
.expalinWrapper{
gap: 30px;
padding:0px 15px 0px 45px!important;
.content-item{
margin:0px!important;
flex: 0 0 calc(50% - 30px);
}
}
.content{
background-color: #fff;
border-radius:30px;
@ -424,9 +432,6 @@
margin-left: 0px!important;
}
}
.content-wrapper{
padding:0px!important;
}
.item-title{
&::after{
opacity: 0;

View File

@ -72,7 +72,7 @@ function TrainAnswer(){
<div className={`${styles.xingTitle} ${styles.typing}`}>
<TypingText text={"独家赛题解读"}/><br/><TypingText text={"高手带你"} defaultTime={6}/><span style={{animationDelay:"1.1s"}} className={styles.xingColors}>玩转开源</span>
</div>
<p className='font17 mt20'style={{textAlign:"left",fontFamily:"alibabaPuhuiR"}}>开源大赛官方培训即将开启助你冲刺奖项</p>
<p className='font17 mt20'style={{textAlign:"left",fontFamily:"alibabaPuhuiR"}}>官方培训预告实时更新助你冲刺<br/>往期精彩与资料尽在<Link to={`/competitions/2026/information#guide`}>赛事动态 - 赛事解读</Link>板块</p>
</div>
<div className={styles.trainRight}>
<div className={styles.vedioBox} onClick={()=>window.open(`/zone/2026CCFkycxds/newdetail/1359`)}>