fix: 修改分享初始化逻辑、去除小猫图

This commit is contained in:
2026-02-08 23:58:37 +08:00
parent 70a66fabdc
commit 28955e9da1
3 changed files with 38 additions and 27 deletions

View File

@@ -25,9 +25,10 @@ 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 publishFlag = from === "publish";
// const posterRef = useRef();
const { max_participants, participant_count } = detail || {};
@@ -57,18 +58,20 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => {
}
useImperativeHandle(ref, () => ({
show: async (publish_flag = false) => {
setPublishFlag(publish_flag);
if (publish_flag) {
try {
const url = await generateShareImageUrl();
setShareImageUrl(url);
} catch (e) {}
}
show: async () => {
setVisible(true);
},
}));
useEffect(() => {
if (from === "publish") {
generateShareImageUrl().then((url) => {
setShareImageUrl(url);
setVisible(true);
});
}
}, [from]);
async function generateShareImageUrl() {
const {
play_type,
@@ -183,7 +186,6 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => {
function onClose() {
setVisible(false);
setPublishFlag(false);
}
return (