禁止浏览器默认左滑

This commit is contained in:
al 2024-08-21 16:15:35 +08:00
parent e4643cf358
commit d4c45a6dd1
3 changed files with 223 additions and 212 deletions

View File

@ -85,7 +85,11 @@ export default function AddWeChat({
}); });
return; return;
} }
if (userWechat.match(/wxid_|[\u4e00-\u9fa5]/g)) { if (
userWechat.match(
/wxid_|[\u4e00-\u9fa5]|[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3010|\u3011|\u007e]/g
)
) {
Toast.show({ Toast.show({
content: "请提交可被搜索的有效微信", content: "请提交可被搜索的有效微信",
position: "top", position: "top",

View File

@ -21,7 +21,9 @@ function ImagesMask({}, ref) {
const defaultIndex = useRef(null); const defaultIndex = useRef(null);
const router = useRouter(); const router = useRouter();
useEffect(() => { useEffect(() => {
let body = document.body;
if (visible) { if (visible) {
body.style.touchAction = "none";
const root = createRoot(document?.getElementById("maskDomBox")); const root = createRoot(document?.getElementById("maskDomBox"));
root.render( root.render(
<div> <div>
@ -38,6 +40,8 @@ function ImagesMask({}, ref) {
/> />
</div> </div>
); );
} else {
body.style.touchAction = "auto";
} }
// root.render(<div>xxxx</div>); // root.render(<div>xxxx</div>);
@ -193,12 +197,14 @@ const ImagesMaskContaint = forwardRef(
if (index < images.length - 1) { if (index < images.length - 1) {
setCurrentIndex(index + 1); setCurrentIndex(index + 1);
} else { } else {
// setCurrentIndex(0);
ref.current.style.transform = `translateX(${-cxOffset * index}px)`; ref.current.style.transform = `translateX(${-cxOffset * index}px)`;
} }
} else { } else {
if (index > 0) { if (index > 0) {
setCurrentIndex(index - 1); setCurrentIndex(index - 1);
} else { } else {
// setCurrentIndex(images.length - 1);
ref.current.style.transform = `translateX(${-cxOffset * index}px)`; ref.current.style.transform = `translateX(${-cxOffset * index}px)`;
} }
} }
@ -230,8 +236,8 @@ const ImagesMaskContaint = forwardRef(
} }
return ( return (
<div>
<Mask <Mask
destroyOnClose={false}
visible={visible} visible={visible}
className="z-[1002] h-screen flex justify-center items-center" className="z-[1002] h-screen flex justify-center items-center"
onMaskClick={() => { onMaskClick={() => {
@ -342,6 +348,7 @@ const ImagesMaskContaint = forwardRef(
{images.map((item, index) => { {images.map((item, index) => {
return ( return (
<div <div
draggable={true}
key={index} key={index}
className="flex-none w-screen relative h-full" className="flex-none w-screen relative h-full"
// onDoubleClick={() => { // onDoubleClick={() => {
@ -364,6 +371,7 @@ const ImagesMaskContaint = forwardRef(
}} }}
/> */} /> */}
<Image <Image
draggable={true}
className="h-full m-auto" className="h-full m-auto"
src={item.url} src={item.url}
style={{ style={{
@ -460,7 +468,6 @@ const ImagesMaskContaint = forwardRef(
</div> </div>
</div> </div>
</Mask> </Mask>
</div>
); );
} }
); );

View File

@ -132,7 +132,7 @@ export default function Photos({
// handleShowImages(index, photos, interval); // handleShowImages(index, photos, interval);
// setVisible(true) // setVisible(true)
console.log(imagesMaskRef.current, photos); // console.log(imagesMaskRef.current, photos);
imagesMaskRef.current.show(photos, index, data); imagesMaskRef.current.show(photos, index, data);
}; };
// const handleShowImages = (index, photos, interval) => { // const handleShowImages = (index, photos, interval) => {