广告添加

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

View File

@ -29,7 +29,7 @@ export default function ListProj() {
// // setKeywords(state.keyword)
// }
const keywords = state ? state.keyword : ''
const name = state?state.name:''
const name = state ? state.name : ''
// console.log(keywords);
// const images = [syminga,symingb,symingc,symingd]
const listProjRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
@ -56,7 +56,7 @@ export default function ListProj() {
page: currentPage,
rows: 10,
keywords: keywords,
charge:name,
charge: name,
projCategoryId: indexListContext.category,
status: indexListContext.status ? indexListContext.status : getMenuActive()
}
@ -75,16 +75,16 @@ export default function ListProj() {
// }));
// console.log('循环数组',updatedArr);
// setProjs(updatedArr);
},
onFinally() {
setIsLoading(false);
}
})
}
// const reqDataNoScoll = (currentPage: number) => {
// // setProjs([])
// 更新数据
// const upreqData = (currentPage: number) => {
// get<IListPage<IProj>>({
// messageApi: messageApi,
// url: '/api/proj/listpage/self',
@ -93,6 +93,7 @@ export default function ListProj() {
// page: currentPage,
// rows: 10,
// keywords: keywords,
// charge: name,
// projCategoryId: indexListContext.category,
// status: indexListContext.status ? indexListContext.status : getMenuActive()
// }
@ -101,23 +102,14 @@ export default function ListProj() {
// setIsLoading(true);
// },
// onSuccess({ data }) {
// console.log('看看结果', data);
// 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);
// setProjs(data.rows);
// },
// onFinally() {
// setIsLoading(false);
// }
// })
// }
const renderList = () => {
if (projs.length == 0) {
@ -131,14 +123,15 @@ export default function ListProj() {
justifyContent: 'center',
alignItems: 'center'
}}>
<Empty description='暂无内容' />
<Empty description='暂无内容' />
</div>
)
}
return projs.map((item) => {
return (
<div className='projListBox' key={new Date().getTime() + ':' + item.projId}>
<CardProj item={item}
<CardProj item={item}
// upreqData={() => { upreqData(page) }}
// getreqData={reqDataNoScoll}
/>
</div>
@ -157,15 +150,15 @@ export default function ListProj() {
renderCategory();
}
console.log(page);
setTimeout(() => {
setShowPage(true)
}, 0);
}, [indexListContext.status,keywords,name])
}, [indexListContext.status, keywords, name])
useEffect(() => {
if (indexListContext.categorys) {
reqData(page);
renderCategory();
}
@ -194,9 +187,9 @@ export default function ListProj() {
</div>
<div className="page" >
{/* defaultCurrent: 默认当前页数 total:数据总数 */}
{showPage?<Pagination defaultCurrent={page} total={total} defaultPageSize={10} onChange={(page) => {
{showPage ? <Pagination defaultCurrent={page} total={total} defaultPageSize={10} onChange={(page) => {
reqData(page);
}} /> : null}
}} /> : null}
</div>
</Spin>
</div>

View File

@ -1,6 +1,6 @@
import React, { useEffect } from 'react'
import './scrollAd.css'
export default function ScrollAd() {
export default function ScrollAd(props:any) {
useEffect(() => {
const scrollInterval = setInterval(() => {
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 className="scrolling-ad-content">
广广广广广广广广广广广广广广
{props.ad}
</div>
</div>

View File

@ -40,6 +40,21 @@ export default function ProjCreate() {
const nav = useNavigate();
const height = window.innerHeight - 170;
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(() => {
get<any>({
messageApi: messageApi,
@ -58,7 +73,7 @@ export default function ProjCreate() {
// sessionStorage.setItem('pathArray', JSON.stringify([ { title: <Link to={'/home'}>首页</Link> },{ title: '创建项目' }]));
// sessionStorage.setItem('now', '创建');
console.log(allInfo);
getAd()
}, [])
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={{display:'flex',justifyContent:'space-between',alignItems:'center'}}>
<div style={{width:'100%'}}>
<ScrollAd></ScrollAd>
<ScrollAd ad = {ad}></ScrollAd>
</div>
<div style={{width:20,fontWeight:700,cursor:'pointer'}} onClick={()=>{
setShow(false)