Browse Source

滚动条优化

dev
wenlele 1 year ago
parent
commit
2a85ea7a57
  1. 72
      web/client/src/sections/control/containers/control.jsx

72
web/client/src/sections/control/containers/control.jsx

@ -210,44 +210,6 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
attribute(v)
})
const domProject = document.getElementById("news");
if (domProject) {
newScrollbar = new PerfectScrollbar("#news", {
suppressScrollX: true,
});
}
const domProject3 = document.getElementById("equipment");
if (domProject3) {
equipmentScrollbar = new PerfectScrollbar("#equipment", {
suppressScrollX: true,
});
}
const domProject4 = document.getElementById("web");
if (domProject4) {
webScrollbar = new PerfectScrollbar("#web", {
suppressScrollX: true,
})
}
const domProject5 = document.getElementById("problems");
if (domProject5) {
problemsScrollbar = new PerfectScrollbar("#problems", {
suppressScrollX: true,
});
}
const domProject6 = document.getElementById("alarm");
if (domProject6) {
alarmScrollbar = new PerfectScrollbar("#alarm", {
suppressScrollY: true,
});
}
return () => {
}
@ -430,6 +392,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
}
if (exhibition.current?.overall?.find(v => v.key == 'dynamic')) {
concentration3()
}
@ -451,6 +414,33 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
suppressScrollX: true,
});
}
const domProject = document.getElementById("news");
if (domProject) {
newScrollbar = new PerfectScrollbar("#news", {
suppressScrollX: true,
});
}
const domProject3 = document.getElementById("equipment");
if (domProject3) {
equipmentScrollbar = new PerfectScrollbar("#equipment", {
suppressScrollX: true,
});
}
const domProject4 = document.getElementById("web");
if (domProject4) {
webScrollbar = new PerfectScrollbar("#web", {
suppressScrollX: true,
})
}
const domProject6 = document.getElementById("alarm");
if (domProject6) {
alarmScrollbar = new PerfectScrollbar("#alarm", {
suppressScrollY: true,
});
}
}, [pepProjectId, exhibition.current])
useEffect(() => {
@ -459,7 +449,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
if (line && news) {
news.onscroll = (e) => {
e.stopPropagation();
if ((line.clientHeight - 578) < news.scrollTop + 10) {
if ((line.clientHeight - 565) < news.scrollTop + 10) {
setQuery({ ...query, page: query.page + 1 })
if (exhibition?.current?.dynamic?.length > 0) {
dispatch(control.getLatestDynamic({ ...query, projectCorrelationId: pepProjectId, page: query.page + 1 })).then(res => {
@ -736,7 +726,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
</div>
</div>
{/* 循环类型 */}
<SimpleBar style={{ width: 'calc(100% - 200px)', whiteSpace: 'nowrap', }} forceVisible="x" >
<SimpleBar style={{ width: 'calc(100% - 240px)', whiteSpace: 'nowrap', }} forceVisible="x" >
{exhibition.current['workbench']?.map((item, index) => {
return (
pepProjectId && item.name == '关注的项目' ? '' : <div key={item.name} style={{ background: item.img, backgroundSize: "100% 100%", display: "inline-block", width: 270, height: 135, marginRight: 26 }}>
@ -1224,7 +1214,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
}} />
</div>
</div>
<div id='news' style={{ height: 578, position: 'relative', marginTop: 10, overscrollBehavior: 'contain', }}>
<div id='news' style={{ height: 565, position: 'relative', marginTop: 10, overscrollBehavior: 'contain', }}>
<div id='line' style={{ width: '100%', }}>
<Timeline mode="center" style={{ marginLeft: '-56px', width: 400 }}>
{querydata.current?.map((v, index) => {

Loading…
Cancel
Save