整体链接
Change-Id: Id3379c6188613acdc95548964f19e317eda8dc4f
diff --git a/src/components/postsPanel/postsPanel.module.css b/src/components/postsPanel/postsPanel.module.css
index b4b75ce..f639c77 100644
--- a/src/components/postsPanel/postsPanel.module.css
+++ b/src/components/postsPanel/postsPanel.module.css
@@ -4,7 +4,9 @@
width:100%;
padding:0px 5px;
}
-
+span {
+ color:var(--text-color)
+}
.header{
border-bottom:1px solid var(--border-color);
box-shadow: 1px;
diff --git a/src/components/postsPanel/postsPanel.tsx b/src/components/postsPanel/postsPanel.tsx
index 2916753..c99e40e 100644
--- a/src/components/postsPanel/postsPanel.tsx
+++ b/src/components/postsPanel/postsPanel.tsx
@@ -1,5 +1,5 @@
import { useApi } from '@/hooks/request';
-import React, { useCallback } from 'react';
+import React, { useCallback, useEffect, useState } from 'react';
import request from '@/utils/request'
import style from './postsPanel.module.css'
import { useNavigate } from 'react-router';
@@ -18,6 +18,14 @@
const handlePostCheck =(postId:string) =>{
nav('/postDetail?postId=' + postId);
}
+
+ useEffect(()=>{
+ if(data){
+ console.log("data!!!")
+ console.log(data)
+ }
+ }, [data])
+
return (
<div className={style.panel}>
<div className={style.header}>
@@ -25,11 +33,11 @@
<span className={style.more}>更多</span>
</div>
<div className={style.content} >
- {data && data.length > 0 ?
- data?.map((item: {postId:string, postTitle: string; createdAt: string }, index: number) => (
+ {data && data.records && data.records.length > 0 ?
+ data.records.map((item: {postId:string, postTitle: string; createdAt: string }, index: number) => (
<div key={index} className={style.item} onClick={()=> handlePostCheck(item.postId)} >
<span className={style.text}>{item.postTitle}</span>
- <span>{item.createdAt}</span>
+ <span>{new Date(item.createdAt).toLocaleString()}</span>
</div>
)) :(
<div>未查询到相关记录</div>