feat: 发布后分享弹窗自动弹出

This commit is contained in:
2025-10-14 14:54:28 +08:00
parent a0a544b2cc
commit 9333be9a9c
2 changed files with 56 additions and 6 deletions

View File

@@ -333,7 +333,9 @@ function Coursel(props) {
// 分享弹窗 // 分享弹窗
const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => { const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [publishFlag, setPublishFlag] = useState(false);
// const posterRef = useRef(); // const posterRef = useRef();
const { max_participants, participant_count } = detail || {};
useEffect(() => { useEffect(() => {
if (id) { if (id) {
@@ -361,7 +363,8 @@ const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => {
} }
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
show: () => { show: (publish_flag = false) => {
setPublishFlag(publish_flag);
setVisible(true); setVisible(true);
}, },
})); }));
@@ -451,6 +454,7 @@ const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => {
function onClose() { function onClose() {
setVisible(false); setVisible(false);
setPublishFlag(false);
} }
return ( return (
@@ -467,11 +471,27 @@ const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => {
> >
<View className={styles.shareContainer}> <View className={styles.shareContainer}>
<View catchMove className={styles.title}> <View catchMove className={styles.title}>
<Text></Text> {publishFlag ? (
<Text className={styles.publishText}> 🎉</Text>
) : (
<Text></Text>
)}
<View className={styles.closeIconWrap} onClick={onClose}> <View className={styles.closeIconWrap} onClick={onClose}>
<Image className={styles.closeIcon} src={CrossIcon} /> <Image className={styles.closeIcon} src={CrossIcon} />
</View> </View>
</View> </View>
{publishFlag && (
<View className={styles.shareTip}>
<Text>
<Text className={styles.specialCount}>
{" "}
{max_participants - participant_count}{" "}
</Text>
</Text>
</View>
)}
<View className={styles.shareItems}> <View className={styles.shareItems}>
<Button className={styles.button} openType="share"> <Button className={styles.button} openType="share">
<View className={classnames(styles.icon, styles.wechatIcon)}> <View className={classnames(styles.icon, styles.wechatIcon)}>
@@ -690,7 +710,10 @@ function StickyButton(props) {
<> <>
<View className="sticky-bottom-bar"> <View className="sticky-bottom-bar">
<View className="sticky-bottom-bar-share-and-comment"> <View className="sticky-bottom-bar-share-and-comment">
<View className="sticky-bottom-bar-share" onClick={handleShare}> <View
className="sticky-bottom-bar-share"
onClick={() => handleShare()}
>
<Image <Image
className="sticky-bottom-bar-share-icon" className="sticky-bottom-bar-share-icon"
src={img.ICON_DETAIL_SHARE} src={img.ICON_DETAIL_SHARE}
@@ -1403,6 +1426,9 @@ function Index() {
useEffect(() => { useEffect(() => {
updateLocation(); updateLocation();
fetchUserInfo(); fetchUserInfo();
if (from === "publish") {
handleShare(true);
}
}, []); }, []);
useDidShow(async () => { useDidShow(async () => {
@@ -1458,8 +1484,8 @@ function Index() {
} }
} }
function handleShare() { function handleShare(flag = false) {
sharePopupRef.current.show(); sharePopupRef.current.show(flag);
} }
const handleJoinGame = async () => { const handleJoinGame = async () => {

View File

@@ -1,6 +1,6 @@
.shareContainer { .shareContainer {
.title { .title {
padding: 20px; padding: 20px 20px 16px;
color: #000; color: #000;
// text-align: center; // text-align: center;
font-family: "PingFang SC"; font-family: "PingFang SC";
@@ -12,6 +12,15 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.publishText {
color: #2a4d44;
font-family: "Noto Sans SC";
font-size: 18px;
font-style: normal;
font-weight: 900;
line-height: 28px;
}
.closeIconWrap { .closeIconWrap {
display: flex; display: flex;
width: 40px; width: 40px;
@@ -32,10 +41,25 @@
} }
} }
.shareTip {
padding: 0 24px 24px;
color: #2a4d44;
font-family: "Noto Sans SC";
font-size: 28px;
font-style: normal;
font-weight: 900;
line-height: 40px;
.specialCount {
color: #00e5ad;
}
}
.shareItems { .shareItems {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
padding-top: 12px;
padding-bottom: 60px; padding-bottom: 60px;
.button { .button {