diff --git a/src/game_pages/detail/components/SharePopup/index.module.scss b/src/game_pages/detail/components/SharePopup/index.module.scss index 6ac57ce..6dab538 100644 --- a/src/game_pages/detail/components/SharePopup/index.module.scss +++ b/src/game_pages/detail/components/SharePopup/index.module.scss @@ -1,4 +1,32 @@ .shareContainer { + .opacityContainer { + height: 140px; + width: 100%; + } + .shareImageContainer { + position: absolute; + top: 10px; + left: 50%; + width: 220px; + height: 180px; + padding: 6px; + background-color: #fafafa; + border-radius: 16px; + transform: rotateZ(-5deg) translateX(-50%); + box-shadow: 0 3px 32px 0 rgba(0, 0, 0, 0.16); + + .shareImage { + width: 100%; + height: 100%; + border-radius: 12px; + } + } + .contentContainer { + background-color: #fafafa; + border-top-left-radius: 16px; + border-top-right-radius: 16px; + } + .title { padding: 20px 20px 16px; color: #000; @@ -12,6 +40,18 @@ align-items: center; justify-content: space-between; + &.publishTitle { + height: 100px; + + .publishText { + align-self: flex-end; + } + + .closeIconWrap { + align-self: flex-start; + } + } + .publishText { color: #2a4d44; font-family: "Noto Sans SC"; @@ -62,6 +102,21 @@ padding-top: 12px; padding-bottom: 60px; + .customBtnWrapper { + position: relative; + } + + .button { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + opacity: 0; + z-index: 1; + } + + .customButton, .button { display: flex; flex-direction: column; @@ -76,7 +131,7 @@ font-weight: 600; line-height: normal; - background-color: #fff; + // background-color: #fff; border: none; padding: 0; margin: 0; diff --git a/src/game_pages/detail/components/SharePopup/index.tsx b/src/game_pages/detail/components/SharePopup/index.tsx index f175aca..be2af80 100644 --- a/src/game_pages/detail/components/SharePopup/index.tsx +++ b/src/game_pages/detail/components/SharePopup/index.tsx @@ -26,6 +26,7 @@ dayjs.locale("zh-cn"); export default forwardRef(({ id, from, detail, userInfo }, ref) => { const [visible, setVisible] = useState(false); const [publishFlag, setPublishFlag] = useState(false); + const [shareImageUrl, setShareImageUrl] = useState(""); const { fetchUserInfo } = useUserActions(); // const posterRef = useRef(); const { max_participants, participant_count } = detail || {}; @@ -56,13 +57,17 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => { } useImperativeHandle(ref, () => ({ - show: (publish_flag = false) => { + show: async (publish_flag = false) => { setPublishFlag(publish_flag); + if (publish_flag) { + const url = await generateShareImageUrl(); + setShareImageUrl(url); + } setVisible(true); }, })); - useShareAppMessage(async (res) => { + async function generateShareImageUrl() { const { play_type, skill_level_max, @@ -76,7 +81,6 @@ 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")}小时`; - await changeMessageType(); const url = await generateShareImage({ userAvatar: userInfo.avatar_url, userNickname: userInfo.nickname, @@ -90,6 +94,12 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => { venueName: location_name, venueImages: image_list ? image_list : [], }); + return url; + } + + useShareAppMessage(async (res) => { + await changeMessageType(); + const url = await generateShareImageUrl(); // console.log(res, "res"); return { title: detail.title, @@ -168,51 +178,96 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => { showHeader={false} hideFooter enableDragToClose={false} - style={{ minHeight: "100px" }} + style={{ minHeight: "100px", background: "unset" }} zIndex={1000} > - - {publishFlag ? ( - 球局发布成功 🎉 - ) : ( - 分享至 - )} - - - - {publishFlag && ( - - - 还剩 - - {" "} - {max_participants - participant_count}{" "} - - 人加入完成组局, 去邀请好友加入吧~ - - + <> + + + + + )} - - - - + + + + + 微信好友 + - 复制链接 - + + + + + + + 生成分享图 + + + + + + + + + 复制链接 + + +