feat: 修改两处海报logo-text图片、修改创建球局后跳转详情页打开分享弹窗位置、修改分享二维码接口取值、修改ntrp修改弹窗的初始值、增加复制链接功能
This commit is contained in:
@@ -34,7 +34,7 @@ function toast(msg) {
|
||||
|
||||
interface CommentInputProps {
|
||||
onConfirm?: (
|
||||
value: { content: string } & Partial<CommentInputReplyParamsType>
|
||||
value: { content: string } & Partial<CommentInputReplyParamsType>,
|
||||
) => void;
|
||||
}
|
||||
|
||||
@@ -49,119 +49,118 @@ interface CommentInputReplyParamsType {
|
||||
nickname: string;
|
||||
}
|
||||
|
||||
const CommentInput = forwardRef<CommentInputRef, CommentInputProps>(function (
|
||||
props,
|
||||
ref
|
||||
) {
|
||||
const { onConfirm } = props;
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [value, setValue] = useState("");
|
||||
const [params, setParams] = useState<
|
||||
CommentInputReplyParamsType | undefined
|
||||
>();
|
||||
const CommentInput = forwardRef<CommentInputRef, CommentInputProps>(
|
||||
function (props, ref) {
|
||||
const { onConfirm } = props;
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [value, setValue] = useState("");
|
||||
const [params, setParams] = useState<
|
||||
CommentInputReplyParamsType | undefined
|
||||
>();
|
||||
|
||||
const {
|
||||
keyboardHeight,
|
||||
isKeyboardVisible,
|
||||
addListener,
|
||||
initializeKeyboardListener,
|
||||
} = useKeyboardHeight();
|
||||
const {
|
||||
keyboardHeight,
|
||||
isKeyboardVisible,
|
||||
addListener,
|
||||
initializeKeyboardListener,
|
||||
} = useKeyboardHeight();
|
||||
|
||||
// 使用全局键盘状态监听
|
||||
useEffect(() => {
|
||||
// 初始化全局键盘监听器
|
||||
initializeKeyboardListener();
|
||||
// 使用全局键盘状态监听
|
||||
useEffect(() => {
|
||||
// 初始化全局键盘监听器
|
||||
initializeKeyboardListener();
|
||||
|
||||
// 添加本地监听器
|
||||
const removeListener = addListener((height, visible) => {
|
||||
console.log("PublishBall 收到键盘变化:", height, visible);
|
||||
// 这里只记录或用于其他逻辑,布局是否响应交由 shouldReactToKeyboard 决定
|
||||
});
|
||||
// 添加本地监听器
|
||||
const removeListener = addListener(() => {
|
||||
// 布局是否响应交由 shouldReactToKeyboard 决定
|
||||
});
|
||||
|
||||
return () => {
|
||||
removeListener();
|
||||
};
|
||||
}, [initializeKeyboardListener, addListener]);
|
||||
return () => {
|
||||
removeListener();
|
||||
};
|
||||
}, [initializeKeyboardListener, addListener]);
|
||||
|
||||
const inputDomRef = useRef(null);
|
||||
const inputDomRef = useRef(null);
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
show: (_params: CommentInputReplyParamsType | undefined) => {
|
||||
setVisible(true);
|
||||
setTimeout(() => {
|
||||
inputDomRef.current && inputDomRef.current?.focus();
|
||||
}, 100);
|
||||
setParams(_params);
|
||||
},
|
||||
}));
|
||||
useImperativeHandle(ref, () => ({
|
||||
show: (_params: CommentInputReplyParamsType | undefined) => {
|
||||
setVisible(true);
|
||||
setTimeout(() => {
|
||||
inputDomRef.current && inputDomRef.current?.focus();
|
||||
}, 100);
|
||||
setParams(_params);
|
||||
},
|
||||
}));
|
||||
|
||||
function handleSend() {
|
||||
if (!value) {
|
||||
toast("评论内容不得为空");
|
||||
return;
|
||||
function handleSend() {
|
||||
if (!value) {
|
||||
toast("评论内容不得为空");
|
||||
return;
|
||||
}
|
||||
if (value.length > 200) {
|
||||
return;
|
||||
}
|
||||
onConfirm?.({ content: value, ...params });
|
||||
onClose();
|
||||
}
|
||||
if (value.length > 200) {
|
||||
return;
|
||||
}
|
||||
onConfirm?.({ content: value, ...params });
|
||||
onClose();
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
setVisible(false);
|
||||
setValue("");
|
||||
inputDomRef.current && inputDomRef.current?.blur();
|
||||
}
|
||||
console.log(keyboardHeight, "keyboardHeight");
|
||||
return (
|
||||
<CommonPopup
|
||||
visible={visible}
|
||||
showHeader={false}
|
||||
hideFooter
|
||||
zIndex={1002}
|
||||
onClose={onClose}
|
||||
style={{
|
||||
// height: "60px!important",
|
||||
minHeight: "unset",
|
||||
bottom:
|
||||
isKeyboardVisible && keyboardHeight > 0 ? `${keyboardHeight}px` : "0",
|
||||
}}
|
||||
enableDragToClose={false}
|
||||
>
|
||||
<View className={styles.inputContainer}>
|
||||
<View className={styles.inputWrapper}>
|
||||
<Textarea
|
||||
adjustPosition={false}
|
||||
ref={inputDomRef}
|
||||
className={styles.input}
|
||||
value={value}
|
||||
onInput={(e) => setValue(e.detail.value)}
|
||||
placeholder={
|
||||
params?.reply_to_user_id ? `回复 @${params.nickname}` : "写评论"
|
||||
}
|
||||
confirmType="send"
|
||||
onConfirm={handleSend}
|
||||
focus
|
||||
maxlength={-1}
|
||||
autoHeight
|
||||
// showCount
|
||||
/>
|
||||
<View
|
||||
className={classnames(
|
||||
styles.limit,
|
||||
value.length > 200 ? styles.red : ""
|
||||
)}
|
||||
>
|
||||
<Text>{value.length}</Text>/<Text>200</Text>
|
||||
function onClose() {
|
||||
setVisible(false);
|
||||
setValue("");
|
||||
inputDomRef.current && inputDomRef.current?.blur();
|
||||
}
|
||||
return (
|
||||
<CommonPopup
|
||||
visible={visible}
|
||||
showHeader={false}
|
||||
hideFooter
|
||||
zIndex={1002}
|
||||
onClose={onClose}
|
||||
style={{
|
||||
// height: "60px!important",
|
||||
minHeight: "unset",
|
||||
bottom:
|
||||
isKeyboardVisible && keyboardHeight > 0
|
||||
? `${keyboardHeight}px`
|
||||
: "0",
|
||||
}}
|
||||
enableDragToClose={false}
|
||||
>
|
||||
<View className={styles.inputContainer}>
|
||||
<View className={styles.inputWrapper}>
|
||||
<Textarea
|
||||
adjustPosition={false}
|
||||
ref={inputDomRef}
|
||||
className={styles.input}
|
||||
value={value}
|
||||
onInput={(e) => setValue(e.detail.value)}
|
||||
placeholder={
|
||||
params?.reply_to_user_id ? `回复 @${params.nickname}` : "写评论"
|
||||
}
|
||||
confirmType="send"
|
||||
onConfirm={handleSend}
|
||||
focus
|
||||
maxlength={-1}
|
||||
autoHeight
|
||||
// showCount
|
||||
/>
|
||||
<View
|
||||
className={classnames(
|
||||
styles.limit,
|
||||
value.length > 200 ? styles.red : "",
|
||||
)}
|
||||
>
|
||||
<Text>{value.length}</Text>/<Text>200</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.sendIcon} onClick={handleSend}>
|
||||
<Image className={styles.sendImage} src={sendImg} />
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.sendIcon} onClick={handleSend}>
|
||||
<Image className={styles.sendImage} src={sendImg} />
|
||||
</View>
|
||||
</View>
|
||||
</CommonPopup>
|
||||
);
|
||||
});
|
||||
</CommonPopup>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
function isReplyComment(item: BaseComment<any>): item is ReplyComment {
|
||||
return "reply_to_user" in item;
|
||||
@@ -208,7 +207,7 @@ function CommentItem(props: {
|
||||
className={classnames(
|
||||
styles.commentItem,
|
||||
blink_id === comment.id && styles.blink,
|
||||
styles.weight_super
|
||||
styles.weight_super,
|
||||
)}
|
||||
key={comment.id}
|
||||
id={`comment_id_${comment.id}`}
|
||||
@@ -293,7 +292,8 @@ function CommentItem(props: {
|
||||
/>
|
||||
))}
|
||||
{!isReplyComment(comment) &&
|
||||
comment.replies.length !== comment.reply_count && (
|
||||
comment.replies.length !== comment.reply_count &&
|
||||
comment.replies.length > 3 && (
|
||||
<View
|
||||
className={styles.viewMore}
|
||||
onClick={() => handleLoadMore(comment)}
|
||||
@@ -313,7 +313,7 @@ export default forwardRef(function Comments(
|
||||
message_id?: number;
|
||||
onScrollTo: (id: string) => void;
|
||||
},
|
||||
ref
|
||||
ref,
|
||||
) {
|
||||
const { game_id, publisher_id, message_id, onScrollTo } = props;
|
||||
const [comments, setComments] = useState<Comment[]>([]);
|
||||
@@ -371,7 +371,7 @@ export default forwardRef(function Comments(
|
||||
replies: [res.data, ...item.replies].sort((a, b) =>
|
||||
dayjs(a.create_time).isAfter(dayjs(b.create_time))
|
||||
? 1
|
||||
: -1
|
||||
: -1,
|
||||
),
|
||||
};
|
||||
});
|
||||
@@ -435,7 +435,7 @@ export default forwardRef(function Comments(
|
||||
item.replies.splice(
|
||||
page === 1 ? 0 : page * PAGESIZE - 1,
|
||||
newReplies.length,
|
||||
...newReplies
|
||||
...newReplies,
|
||||
);
|
||||
item.reply_count = res.data.count;
|
||||
}
|
||||
@@ -502,7 +502,7 @@ export default forwardRef(function Comments(
|
||||
return {
|
||||
...item,
|
||||
replies: item.replies.filter(
|
||||
(replyItem) => replyItem.id !== id
|
||||
(replyItem) => replyItem.id !== id,
|
||||
),
|
||||
reply_count: item.reply_count - 1,
|
||||
};
|
||||
|
||||
@@ -105,10 +105,10 @@ const NTRPEvaluatePopup = (props: NTRPEvaluatePopupProps, ref) => {
|
||||
if (match) {
|
||||
setNtrp(match[0]);
|
||||
} else {
|
||||
setNtrp("");
|
||||
setNtrp("1.5");
|
||||
}
|
||||
} else {
|
||||
setNtrp("");
|
||||
setNtrp("1.5");
|
||||
}
|
||||
}
|
||||
}, [visible, userInfo?.ntrp_level]);
|
||||
|
||||
Reference in New Issue
Block a user