|
@@ -1,5 +1,6 @@
|
|
|
"use client";
|
|
|
import { PromotionRep } from "@/api/home";
|
|
|
+import { usePathname } from "@/i18n/routing";
|
|
|
import { useUserInfoStore } from "@/stores/useUserInfoStore";
|
|
|
import useWheelStore from "@/stores/useWheelStore";
|
|
|
import { server } from "@/utils/client";
|
|
@@ -28,6 +29,7 @@ const getPromotions = async () => {
|
|
|
};
|
|
|
|
|
|
const AutoShowDialog = () => {
|
|
|
+ const pathName = usePathname();
|
|
|
const [data, setData] = React.useState<PromotionRep[]>([]);
|
|
|
const { userInfo } = useUserInfoStore();
|
|
|
const wheelState = useWheelStore((state) => state);
|
|
@@ -45,9 +47,19 @@ const AutoShowDialog = () => {
|
|
|
}, [data]);
|
|
|
|
|
|
const getData = async () => {
|
|
|
- const res = await getPromotions();
|
|
|
- if (res?.code === 200 && res?.data?.length) {
|
|
|
- setData(res.data);
|
|
|
+ const dom: HTMLDialogElement | null = document.querySelector("#globalMask");
|
|
|
+ if (dom) {
|
|
|
+ dom.style.display = "flex";
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const res = await getPromotions();
|
|
|
+ if (res?.code === 200 && res?.data?.length) {
|
|
|
+ setData(res.data);
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ // if (dom) {
|
|
|
+ // dom.style.display = "none";
|
|
|
+ // }
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -112,6 +124,9 @@ const AutoShowDialog = () => {
|
|
|
}
|
|
|
|
|
|
for (let i = startShow; i < data.length; i++) {
|
|
|
+ if (pathName === "/") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
const curData = data[i];
|
|
|
if (!checkIsCanShow(curData)) {
|
|
|
saveShowIndex(i);
|