feat: 发布后分享弹窗自动弹出
This commit is contained in:
@@ -333,7 +333,9 @@ function Coursel(props) {
|
||||
// 分享弹窗
|
||||
const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [publishFlag, setPublishFlag] = useState(false);
|
||||
// const posterRef = useRef();
|
||||
const { max_participants, participant_count } = detail || {};
|
||||
|
||||
useEffect(() => {
|
||||
if (id) {
|
||||
@@ -361,7 +363,8 @@ const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => {
|
||||
}
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
show: () => {
|
||||
show: (publish_flag = false) => {
|
||||
setPublishFlag(publish_flag);
|
||||
setVisible(true);
|
||||
},
|
||||
}));
|
||||
@@ -451,6 +454,7 @@ const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => {
|
||||
|
||||
function onClose() {
|
||||
setVisible(false);
|
||||
setPublishFlag(false);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -467,11 +471,27 @@ const SharePopup = forwardRef(({ id, from, detail, userInfo }, ref) => {
|
||||
>
|
||||
<View className={styles.shareContainer}>
|
||||
<View catchMove className={styles.title}>
|
||||
<Text>分享至</Text>
|
||||
{publishFlag ? (
|
||||
<Text className={styles.publishText}>球局发布成功 🎉</Text>
|
||||
) : (
|
||||
<Text>分享至</Text>
|
||||
)}
|
||||
<View className={styles.closeIconWrap} onClick={onClose}>
|
||||
<Image className={styles.closeIcon} src={CrossIcon} />
|
||||
</View>
|
||||
</View>
|
||||
{publishFlag && (
|
||||
<View className={styles.shareTip}>
|
||||
<Text>
|
||||
还剩
|
||||
<Text className={styles.specialCount}>
|
||||
{" "}
|
||||
{max_participants - participant_count}{" "}
|
||||
</Text>
|
||||
人加入完成组局, 去邀请好友加入吧~
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
<View className={styles.shareItems}>
|
||||
<Button className={styles.button} openType="share">
|
||||
<View className={classnames(styles.icon, styles.wechatIcon)}>
|
||||
@@ -690,7 +710,10 @@ function StickyButton(props) {
|
||||
<>
|
||||
<View className="sticky-bottom-bar">
|
||||
<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
|
||||
className="sticky-bottom-bar-share-icon"
|
||||
src={img.ICON_DETAIL_SHARE}
|
||||
@@ -1403,6 +1426,9 @@ function Index() {
|
||||
useEffect(() => {
|
||||
updateLocation();
|
||||
fetchUserInfo();
|
||||
if (from === "publish") {
|
||||
handleShare(true);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useDidShow(async () => {
|
||||
@@ -1458,8 +1484,8 @@ function Index() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleShare() {
|
||||
sharePopupRef.current.show();
|
||||
function handleShare(flag = false) {
|
||||
sharePopupRef.current.show(flag);
|
||||
}
|
||||
|
||||
const handleJoinGame = async () => {
|
||||
|
||||
Reference in New Issue
Block a user