diff --git a/src/game_pages/detail/components/SharePopup/index.tsx b/src/game_pages/detail/components/SharePopup/index.tsx index 9abe2d8..5e46c7a 100644 --- a/src/game_pages/detail/components/SharePopup/index.tsx +++ b/src/game_pages/detail/components/SharePopup/index.tsx @@ -60,8 +60,10 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => { show: async (publish_flag = false) => { setPublishFlag(publish_flag); if (publish_flag) { - const url = await generateShareImageUrl(); - setShareImageUrl(url); + try { + const url = await generateShareImageUrl(); + setShareImageUrl(url); + } catch (e) {} } setVisible(true); }, @@ -81,6 +83,7 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => { const endTime = dayjs(end_time); const dayofWeek = DayOfWeekMap.get(startTime.day()); const gameLength = `${endTime.diff(startTime, "hour")}小时`; + console.log(userInfo, "userInfo"); const url = await generateShareImage({ userAvatar: userInfo.avatar_url, userNickname: userInfo.nickname, diff --git a/src/game_pages/detail/index.tsx b/src/game_pages/detail/index.tsx index 59bc817..e475fe9 100644 --- a/src/game_pages/detail/index.tsx +++ b/src/game_pages/detail/index.tsx @@ -23,6 +23,7 @@ import SupplementalNotes from "./components/SupplementalNotes"; import OrganizerInfo from "./components/OrganizerInfo"; import SharePopup from "./components/SharePopup"; import { navto, toast } from "@/utils/helper"; +import { delay } from "@/utils"; import ArrowLeft from "@/static/detail/icon-arrow-left.svg"; // import Logo from "@/static/detail/icon-logo-go.svg"; import styles from "./index.module.scss"; @@ -53,6 +54,12 @@ function Index() { await waitForAuthInit(); // 然后再获取用户信息 await fetchUserInfo(); + + await delay(1000); + + if (from !== "publish") { + handleShare(true); + } }; init(); }, []); @@ -105,10 +112,6 @@ function Index() { fetchUserInfoById(res.data.publisher_id); } - if (from === "publish") { - handleShare(true); - } - // Taro.hideLoading(); };