fix: 2
This commit is contained in:
@@ -228,11 +228,35 @@
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
& > .input {
|
||||
width: 100%;
|
||||
// height: 24px;
|
||||
}
|
||||
|
||||
.limit {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
color: #3c3c43;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
font-feature-settings: "liga" off, "clig" off;
|
||||
font-family: "PingFang SC";
|
||||
// background: #fff;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
rgba(255, 255, 255, 0.8) 0%,
|
||||
#fff 100%
|
||||
);
|
||||
z-index: 999;
|
||||
padding: 3px 4px 3px 4px;
|
||||
|
||||
&.red {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sendIcon {
|
||||
|
||||
@@ -100,6 +100,9 @@ const CommentInput = forwardRef<CommentInputRef, CommentInputProps>(function (
|
||||
toast("评论内容不得为空");
|
||||
return;
|
||||
}
|
||||
if (value.length > 200) {
|
||||
return;
|
||||
}
|
||||
onConfirm?.({ content: value, ...params });
|
||||
onClose();
|
||||
}
|
||||
@@ -139,10 +142,18 @@ const CommentInput = forwardRef<CommentInputRef, CommentInputProps>(function (
|
||||
confirmType="send"
|
||||
onConfirm={handleSend}
|
||||
focus
|
||||
maxlength={100}
|
||||
maxlength={-1}
|
||||
autoHeight
|
||||
showCount
|
||||
// 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} />
|
||||
@@ -188,6 +199,8 @@ function CommentItem(props: {
|
||||
const currentUserInfo = useUserInfo();
|
||||
// 判断评论的作者是否是组织者
|
||||
const isGamePublisher = publisher_id === comment.user.id;
|
||||
// 当前用户是否是球局发布者
|
||||
const currentIsGamePublisher = publisher_id === currentUserInfo.id;
|
||||
// 判断当前登录用户是否是评论的作者
|
||||
const isCommentPublisher = currentUserInfo.id === comment.user.id;
|
||||
return (
|
||||
@@ -251,7 +264,7 @@ function CommentItem(props: {
|
||||
>
|
||||
<Text>回复</Text>
|
||||
</View>
|
||||
{(isGamePublisher || isCommentPublisher) && (
|
||||
{(currentIsGamePublisher || isCommentPublisher) && (
|
||||
<View
|
||||
className={styles.delete}
|
||||
onClick={() =>
|
||||
@@ -294,10 +307,15 @@ function CommentItem(props: {
|
||||
}
|
||||
|
||||
export default forwardRef(function Comments(
|
||||
props: { game_id: number; publisher_id: number; message_id?: number },
|
||||
props: {
|
||||
game_id: number;
|
||||
publisher_id: number;
|
||||
message_id?: number;
|
||||
onScrollTo: (id: string) => void;
|
||||
},
|
||||
ref
|
||||
) {
|
||||
const { game_id, publisher_id, message_id } = props;
|
||||
const { game_id, publisher_id, message_id, onScrollTo } = props;
|
||||
const [comments, setComments] = useState<Comment[]>([]);
|
||||
const inputRef = useRef<CommentInputRef>(null);
|
||||
const [blink_id, setBlinkId] = useState<number | undefined>();
|
||||
@@ -350,17 +368,22 @@ export default forwardRef(function Comments(
|
||||
if (item.id !== parent_id) return item;
|
||||
return {
|
||||
...item,
|
||||
replies: [res.data, ...item.replies],
|
||||
replies: [res.data, ...item.replies].sort((a, b) =>
|
||||
dayjs(a.create_time).isAfter(dayjs(b.create_time))
|
||||
? 1
|
||||
: -1
|
||||
),
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
await delay(100);
|
||||
Taro.pageScrollTo({
|
||||
selector: `#comment_id_${res.data.id}`,
|
||||
duration: 300,
|
||||
});
|
||||
await delay(200);
|
||||
onScrollTo?.(`#comment_id_${res.data.id}`);
|
||||
// Taro.pageScrollTo({
|
||||
// selector: `#comment_id_${res.data.id}`,
|
||||
// duration: 300,
|
||||
// });
|
||||
setBlinkId(res.data.id);
|
||||
setTimeout(() => {
|
||||
setBlinkId(undefined);
|
||||
|
||||
Reference in New Issue
Block a user