update pay function
This commit is contained in:
@@ -40,6 +40,7 @@ import {
|
||||
} from '@services/elasticsearchService';
|
||||
import EventTimeline from './components/EventTimeline';
|
||||
import CommentSection from './components/CommentSection';
|
||||
import ImagePreviewModal from '@components/ImagePreviewModal';
|
||||
|
||||
const MotionBox = motion(Box);
|
||||
|
||||
@@ -53,6 +54,10 @@ const PostDetail = () => {
|
||||
const [isLiked, setIsLiked] = useState(false);
|
||||
const [likes, setLikes] = useState(0);
|
||||
|
||||
// 图片预览相关状态
|
||||
const [isImagePreviewOpen, setIsImagePreviewOpen] = useState(false);
|
||||
const [previewImageIndex, setPreviewImageIndex] = useState(0);
|
||||
|
||||
// 加载帖子数据
|
||||
useEffect(() => {
|
||||
const loadPostData = async () => {
|
||||
@@ -91,6 +96,12 @@ const PostDetail = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 打开图片预览
|
||||
const handleImageClick = (index) => {
|
||||
setPreviewImageIndex(index);
|
||||
setIsImagePreviewOpen(true);
|
||||
};
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (dateString) => {
|
||||
const date = new Date(dateString);
|
||||
@@ -272,6 +283,7 @@ const PostDetail = () => {
|
||||
border="1px solid"
|
||||
borderColor={forumColors.border.default}
|
||||
cursor="pointer"
|
||||
onClick={() => handleImageClick(index)}
|
||||
_hover={{
|
||||
transform: 'scale(1.05)',
|
||||
boxShadow: forumColors.shadows.gold,
|
||||
@@ -363,6 +375,14 @@ const PostDetail = () => {
|
||||
</Box>
|
||||
</SimpleGrid>
|
||||
</Container>
|
||||
|
||||
{/* 图片预览弹窗 */}
|
||||
<ImagePreviewModal
|
||||
isOpen={isImagePreviewOpen}
|
||||
onClose={() => setIsImagePreviewOpen(false)}
|
||||
images={post?.images || []}
|
||||
initialIndex={previewImageIndex}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user