禁止浏览器默认左滑

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;
}
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({
content: "请提交可被搜索的有效微信",
position: "top",

View File

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

View File

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