改善请求次数
This commit is contained in:
parent
176a87ba7b
commit
e568325a41
|
@ -139,7 +139,6 @@ const RecommPostList = forwardRef(({ scrollHeight }, ref) => {
|
||||||
setHasMore(true);
|
setHasMore(true);
|
||||||
}
|
}
|
||||||
async function loadMore() {
|
async function loadMore() {
|
||||||
debugger;
|
|
||||||
const list = await getRecommPostList(!commenPostList.length?2:0);
|
const list = await getRecommPostList(!commenPostList.length?2:0);
|
||||||
if (list.length == 0) {
|
if (list.length == 0) {
|
||||||
setHasMore(false);
|
setHasMore(false);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { useRouter } from "next/navigation";
|
||||||
import baseRequest from "@/utils/baseRequest";
|
import baseRequest from "@/utils/baseRequest";
|
||||||
import { handleShowVideo } from "@/utils/tools/handleFuns";
|
import { handleShowVideo } from "@/utils/tools/handleFuns";
|
||||||
// import dynamic from 'next/dynamic'
|
// import dynamic from 'next/dynamic'
|
||||||
import ImagesMask from "@/components/ImagesMask";
|
// import ImagesMask from "@/components/ImagesMask";
|
||||||
// const ImagesMask = dynamic(() =>
|
// const ImagesMask = dynamic(() =>
|
||||||
// import('@/components/ImagesMask'), { ssr: false }
|
// import('@/components/ImagesMask'), { ssr: false }
|
||||||
// )
|
// )
|
||||||
|
@ -113,59 +113,59 @@ export default function Photos({
|
||||||
// });
|
// });
|
||||||
// btns.append(btnL, btnR);
|
// btns.append(btnL, btnR);
|
||||||
// handleShowImages(index, photos, btns,interval);
|
// handleShowImages(index, photos, btns,interval);
|
||||||
// handleShowImages(index, photos, interval);
|
handleShowImages(index, photos, interval);
|
||||||
|
|
||||||
// setVisible(true)
|
// setVisible(true)
|
||||||
console.log(imagesMaskRef.current);
|
// console.log(imagesMaskRef.current);
|
||||||
imagesMaskRef.current.show(
|
// imagesMaskRef.current.show(
|
||||||
photos.map((item) => item?.url),
|
// photos.map((item) => item?.url),
|
||||||
index
|
// index
|
||||||
);
|
// );
|
||||||
};
|
};
|
||||||
// const handleShowImages = (index, photos, interval) => {
|
const handleShowImages = (index, photos, interval) => {
|
||||||
// const mediaDom = document.createElement("div");
|
const mediaDom = document.createElement("div");
|
||||||
// mediaDom.style.width = "100vw";
|
mediaDom.style.width = "100vw";
|
||||||
// document.body.appendChild(mediaDom);
|
document.body.appendChild(mediaDom);
|
||||||
// mediaDom.className = `${
|
mediaDom.className = `${
|
||||||
// photos[index]?.type == "hid" ? "mediaDom photos-body" : "mediaDom"
|
photos[index]?.type == "hid" ? "mediaDom photos-body" : "mediaDom"
|
||||||
// }`;
|
}`;
|
||||||
// // mediaDom.appendChild(btns);
|
// mediaDom.appendChild(btns);
|
||||||
// ImageViewer.clear();
|
ImageViewer.clear();
|
||||||
// ImageViewer.Multi.show({
|
ImageViewer.Multi.show({
|
||||||
// images: photos.map((item) => item?.url),
|
images: photos.map((item) => item?.url),
|
||||||
// defaultIndex: index,
|
defaultIndex: index,
|
||||||
// renderFooter: (image, index) => {
|
renderFooter: (image, index) => {
|
||||||
// return renderFooter(photos[index]?.type == "hid", mediaDom);
|
return renderFooter(photos[index]?.type == "hid", mediaDom);
|
||||||
// },
|
},
|
||||||
|
|
||||||
// getContainer: mediaDom,
|
getContainer: mediaDom,
|
||||||
// onIndexChange: (index) => {
|
onIndexChange: (index) => {
|
||||||
// currentIndex.current = index;
|
currentIndex.current = index;
|
||||||
// mediaDom.className = `${
|
mediaDom.className = `${
|
||||||
// photos[index]?.type == "hid" ? "mediaDom photos-body" : "mediaDom"
|
photos[index]?.type == "hid" ? "mediaDom photos-body" : "mediaDom"
|
||||||
// }`;
|
}`;
|
||||||
// const leftBtn = document.getElementsByClassName("imagesBtnsControllerLeft")[0]
|
const leftBtn = document.getElementsByClassName("imagesBtnsControllerLeft")[0]
|
||||||
// const rightBtn = document.getElementsByClassName("imagesBtnsControllerRight")[0]
|
const rightBtn = document.getElementsByClassName("imagesBtnsControllerRight")[0]
|
||||||
// if(leftBtn && rightBtn){
|
if(leftBtn && rightBtn){
|
||||||
// if(!index){
|
if(!index){
|
||||||
// leftBtn.style.opacity=0.5
|
leftBtn.style.opacity=0.5
|
||||||
// rightBtn.style.opacity=1
|
rightBtn.style.opacity=1
|
||||||
// }else if(index==currentPhotos.length-1){
|
}else if(index==currentPhotos.length-1){
|
||||||
// leftBtn.style.opacity=1
|
leftBtn.style.opacity=1
|
||||||
// rightBtn.style.opacity=0.5
|
rightBtn.style.opacity=0.5
|
||||||
// }else{
|
}else{
|
||||||
// leftBtn.style.opacity=1
|
leftBtn.style.opacity=1
|
||||||
// rightBtn.style.opacity=1
|
rightBtn.style.opacity=1
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// afterClose: () => {
|
afterClose: () => {
|
||||||
// mediaDom.remove();
|
mediaDom.remove();
|
||||||
// clearInterval(interval);
|
clearInterval(interval);
|
||||||
// },
|
},
|
||||||
// classNames: { body: "photos-bodyBox" },
|
classNames: { body: "photos-bodyBox" },
|
||||||
// });
|
});
|
||||||
// };
|
};
|
||||||
const handleSeeAllPhotos = (e) => {
|
const handleSeeAllPhotos = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -304,7 +304,7 @@ export default function Photos({
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<ImagesMask ref={imagesMaskRef} />
|
{/* <ImagesMask ref={imagesMaskRef} /> */}
|
||||||
{/* <Viewer
|
{/* <Viewer
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onClose={() => { setVisible(false); } }
|
onClose={() => { setVisible(false); } }
|
||||||
|
|
|
@ -163,7 +163,7 @@ export default function PostItem({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="mr-8 min-h-24 bg-[#ffffff1a] rounded-md">
|
<div className="mr-8 min-h-24 rounded-md">
|
||||||
{data.media_component && (
|
{data.media_component && (
|
||||||
<Photos
|
<Photos
|
||||||
data={data}
|
data={data}
|
||||||
|
|
Loading…
Reference in New Issue