广告添加

This commit is contained in:
xixi 2024-07-16 16:53:47 +08:00
parent 33fa438d60
commit d8995aa59c
4 changed files with 37 additions and 27 deletions

View File

@ -526,6 +526,7 @@ export default function CardProj(props: any) {
destroyOnClose={true} destroyOnClose={true}
onCancel={() => { onCancel={() => {
// props.upreqData()
setSoftwareManagementOpen(false); setSoftwareManagementOpen(false);
// props.getreqData() // props.getreqData()
// window.location.reload(); // 在取消时刷新页面 // window.location.reload(); // 在取消时刷新页面
@ -554,6 +555,7 @@ export default function CardProj(props: any) {
destroyOnClose={true} destroyOnClose={true}
onCancel={() => { onCancel={() => {
// props.upreqData()
setDisplayOrderOpen(false); setDisplayOrderOpen(false);
}} }}
footer={null} footer={null}

View File

@ -82,9 +82,9 @@ export default function ListProj() {
} }
}) })
} }
// const reqDataNoScoll = (currentPage: number) => {
// // setProjs([])
// 更新数据
// const upreqData = (currentPage: number) => {
// get<IListPage<IProj>>({ // get<IListPage<IProj>>({
// messageApi: messageApi, // messageApi: messageApi,
// url: '/api/proj/listpage/self', // url: '/api/proj/listpage/self',
@ -93,6 +93,7 @@ export default function ListProj() {
// page: currentPage, // page: currentPage,
// rows: 10, // rows: 10,
// keywords: keywords, // keywords: keywords,
// charge: name,
// projCategoryId: indexListContext.category, // projCategoryId: indexListContext.category,
// status: indexListContext.status ? indexListContext.status : getMenuActive() // status: indexListContext.status ? indexListContext.status : getMenuActive()
// } // }
@ -101,17 +102,7 @@ export default function ListProj() {
// setIsLoading(true); // setIsLoading(true);
// }, // },
// onSuccess({ data }) { // onSuccess({ data }) {
// console.log('看看结果', data); // setProjs(data.rows);
// setPage(data.page);
// setTotal(data.total);
// // setProjs(data.rows);
// const updatedArr = (data.rows).map((item, index) => ({
// ...item,
// img: images[index % images.length] // 利用取余来循环填充图片
// }));
// console.log('循环数组',updatedArr);
// setProjs(updatedArr);
// }, // },
// onFinally() { // onFinally() {
// setIsLoading(false); // setIsLoading(false);
@ -119,6 +110,7 @@ export default function ListProj() {
// }) // })
// } // }
const renderList = () => { const renderList = () => {
if (projs.length == 0) { if (projs.length == 0) {
return ( return (
@ -139,6 +131,7 @@ export default function ListProj() {
return ( return (
<div className='projListBox' key={new Date().getTime() + ':' + item.projId}> <div className='projListBox' key={new Date().getTime() + ':' + item.projId}>
<CardProj item={item} <CardProj item={item}
// upreqData={() => { upreqData(page) }}
// getreqData={reqDataNoScoll} // getreqData={reqDataNoScoll}
/> />
</div> </div>

View File

@ -1,6 +1,6 @@
import React, { useEffect } from 'react' import React, { useEffect } from 'react'
import './scrollAd.css' import './scrollAd.css'
export default function ScrollAd() { export default function ScrollAd(props:any) {
useEffect(() => { useEffect(() => {
const scrollInterval = setInterval(() => { const scrollInterval = setInterval(() => {
const adContainer = document.getElementById('scrolling-ad-container'); const adContainer = document.getElementById('scrolling-ad-container');
@ -18,7 +18,7 @@ export default function ScrollAd() {
<div id="scrolling-ad-container" className="scrolling-ad-container"> <div id="scrolling-ad-container" className="scrolling-ad-container">
<div className="scrolling-ad-content"> <div className="scrolling-ad-content">
广广广广广广广广广广广广广广 {props.ad}
</div> </div>
</div> </div>

View File

@ -40,6 +40,21 @@ export default function ProjCreate() {
const nav = useNavigate(); const nav = useNavigate();
const height = window.innerHeight - 170; const height = window.innerHeight - 170;
const [show,setShow] = useState(true) //是否显示广告 const [show,setShow] = useState(true) //是否显示广告
const [ad,setAd] = useState('')
const getAd = () => {
get<any>({
messageApi: messageApi,
url: '/api/env/custom/get-proj-create-notice',
onSuccess({ data }) {
console.log('广告',data);
setAd(data.data)
setShow(data.data==''?false:true)
}
})
// sessionStorage.setItem('pathArray', JSON.stringify([ { title: <Link to={'/home'}>首页</Link> },{ title: '创建项目' }]));
// sessionStorage.setItem('now', '创建');
console.log(allInfo);
}
useEffect(() => { useEffect(() => {
get<any>({ get<any>({
messageApi: messageApi, messageApi: messageApi,
@ -58,7 +73,7 @@ export default function ProjCreate() {
// sessionStorage.setItem('pathArray', JSON.stringify([ { title: <Link to={'/home'}>首页</Link> },{ title: '创建项目' }])); // sessionStorage.setItem('pathArray', JSON.stringify([ { title: <Link to={'/home'}>首页</Link> },{ title: '创建项目' }]));
// sessionStorage.setItem('now', '创建'); // sessionStorage.setItem('now', '创建');
console.log(allInfo); console.log(allInfo);
getAd()
}, []) }, [])
return ( return (
@ -69,7 +84,7 @@ export default function ProjCreate() {
<div style={{ position: 'absolute', top: 0, left: 0, width: '100%', background: 'rgba(0, 0, 0, 0.1)' ,display:show?'block':'none'}}> <div style={{ position: 'absolute', top: 0, left: 0, width: '100%', background: 'rgba(0, 0, 0, 0.1)' ,display:show?'block':'none'}}>
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center'}}> <div style={{display:'flex',justifyContent:'space-between',alignItems:'center'}}>
<div style={{width:'100%'}}> <div style={{width:'100%'}}>
<ScrollAd></ScrollAd> <ScrollAd ad = {ad}></ScrollAd>
</div> </div>
<div style={{width:20,fontWeight:700,cursor:'pointer'}} onClick={()=>{ <div style={{width:20,fontWeight:700,cursor:'pointer'}} onClick={()=>{
setShow(false) setShow(false)