add mainView, reward, community pages
Change-Id: I70da6ed3e91ebf4124c2074b6508192a19ed9909
diff --git "a/src/app/community/thread-detail/\133threadId\135/page.tsx" "b/src/app/community/thread-detail/\133threadId\135/page.tsx"
index 2189402..89ae1e8 100644
--- "a/src/app/community/thread-detail/\133threadId\135/page.tsx"
+++ "b/src/app/community/thread-detail/\133threadId\135/page.tsx"
@@ -7,7 +7,6 @@
import { InputText } from "primereact/inputtext";
// 页面跳转
import { useParams } from 'next/navigation'
-import { useRouter } from 'next/navigation';
// 接口传输
import axios from 'axios';
// 回复评论
@@ -69,7 +68,6 @@
// 获取URL参数,页面跳转
const params = useParams<{ threadId: string }>()
const threadId = decodeURIComponent(params.threadId); // 防止中文路径乱码
- const router = useRouter();
// 消息提醒
const toast = useRef<Toast>(null);
// 帖子信息
@@ -103,7 +101,7 @@
const fetchThreadInfo = async () => {
try {
- const { data } = await axios.get(`http://127.0.0.1:4523/m1/6387307-6083949-default/thread?threadId=${threadId}`);
+ const { data } = await axios.get(process.env.PUBLIC_URL + `/thread?threadId=${threadId}`);
setThreadInfo(data);
setTotalComments(data.commentNumber);
} catch (err) {
@@ -116,7 +114,7 @@
useEffect(() => {
if (!threadInfo) return;
// 发帖人
- axios.get(`http://127.0.0.1:4523/m1/6387307-6083949-default/user/info?userId=${threadInfo.userId}`)
+ axios.get(process.env.PUBLIC_URL + `/user/info?userId=${threadInfo.userId}`)
.then(res => setUserInfo(res.data))
.catch(console.error);
}, [threadInfo]);
@@ -127,7 +125,7 @@
if (!threadInfo.isLike) {
try {
const response = await axios.post(
- `http://127.0.0.1:4523/m1/6387307-6083949-default/thread/like`, {
+ process.env.PUBLIC_URL + `/thread/like`, {
params: { threadId, userId: 22301145 }
}
);
@@ -143,7 +141,7 @@
} else {
try {
const response = await axios.delete(
- `http://127.0.0.1:4523/m1/6387307-6083949-default/thread/like`, {
+ process.env.PUBLIC_URL + `/thread/like`, {
params: { threadId, userId: 22301145 }
}
);
@@ -180,11 +178,11 @@
// 获取评论列表
const fetchComments = async () => {
try {
- const page = first / rows + 1;
- console.log("当前页" + page + "size" + rows);
+ const pageNumber = first / rows + 1;
+ console.log("当前页" + pageNumber + "size" + rows);
const response = await axios.get<CommentList>(
- `http://127.0.0.1:4523/m1/6387307-6083949-default/comments`, {
- params: { threadId, page, rows }
+ process.env.PUBLIC_URL + `/comments`, {
+ params: { threadId, pageNumber, rows }
}
);
console.log('获取评论列表:', response.data.records);
@@ -193,7 +191,7 @@
response.data.records.forEach(comment => {
if (comment.userId != null && !commentUserInfos.has(comment.userId)) {
axios.get<UserInfo>(
- `http://127.0.0.1:4523/m1/6387307-6083949-default/user/info`,
+ process.env.PUBLIC_URL + `/user/info`,
{ params: { userId: comment.userId } }
).then(res => {
setCommentUserInfos(prev => new Map(prev).set(comment.userId!, res.data));
@@ -220,7 +218,7 @@
createdAt: new Date().toISOString().slice(0, 19).replace('T', ' ')
};
- const response = await axios.post('http://127.0.0.1:4523/m1/6387307-6083949-default/comment', newComment);
+ const response = await axios.post(process.env.PUBLIC_URL + '/comment', newComment);
if (response.status === 200) {
toast.current?.show({ severity: 'success', summary: 'Success', detail: '回复成功' });
@@ -250,7 +248,7 @@
createdAt: new Date().toISOString().slice(0, 19).replace('T', ' ')
};
- const response = await axios.post('http://127.0.0.1:4523/m1/6387307-6083949-default/comment', newComment);
+ const response = await axios.post(process.env.PUBLIC_URL + '/comment', newComment);
if (response.status === 200) {
toast.current?.show({ severity: 'success', summary: 'Success', detail: '评论成功' });
@@ -272,7 +270,7 @@
try {
// 调用 DELETE 接口,URL 中最后一段是要删除的 commentId
const response = await axios.delete(
- `http://127.0.0.1:4523/m1/6387307-6083949-default/comment?commentId=${commentId}`
+ process.env.PUBLIC_URL + `/comment?commentId=${commentId}`
);
if (response.status === 200) {
@@ -334,7 +332,6 @@
<div className="comments-section">
<div className="comments-header">
<h2>评论 ({totalComments})</h2>
- <Button label="返回社区" link onClick={() => router.push(`/community/community-detail/${threadInfo.communityId}`)} />
</div>
<div className="comments-input">
<Avatar image={process.env.NEXT_PUBLIC_NGINX_URL + "users/" + userInfo.avatar} size="large" shape="circle" />
diff --git "a/src/app/community/thread-detail/\133threadId\135/thread.scss" "b/src/app/community/thread-detail/\133threadId\135/thread.scss"
index b2524f0..37cbe4d 100644
--- "a/src/app/community/thread-detail/\133threadId\135/thread.scss"
+++ "b/src/app/community/thread-detail/\133threadId\135/thread.scss"
@@ -77,125 +77,4 @@
}
}
}
-
- // 评论区域
- .comments-section {
- .comments-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- h2 {
- font-size: 1.5rem;
- color: #2d3748;
- margin-bottom: 1.5rem;
- }
- }
-
- // 评论输入区
- .comments-input {
- display: flex;
- align-items: center;
- gap: 1rem;
- padding: 1rem;
- border-radius: 0.5rem;
-
- .p-inputtext {
- flex: 1; // 输入框占据剩余空间
- height: 3rem;
- }
-
- .p-button {
- height: 3rem;
- }
- }
-
- // 评论列表
- .comments-list {
- display: flex;
- flex-direction: column;
- margin-top: 1rem;
- gap: 0.5rem;
-
- .comment-item {
- padding: 1.5rem;
- border-radius: 0.5rem;
-
- .comment-user {
- display: flex;
- align-items: center;
- gap: 1rem;
- margin-bottom: 1rem;
-
- .comment-meta {
- display: flex;
- align-items: center;
- width: 100%;
- justify-content: space-between;
- gap: 0.5rem;
-
- .comment-time {
- justify-content: space-between;
- gap: 0.75rem
- }
-
- .username {
- margin-left: 0.5rem;
- font-weight: 600;
- color: #2d3748;
- }
-
- .floor {
- color: #718096;
- margin-right: 0.75rem;
- font-size: 0.875rem;
- }
-
- .time {
- color: #a0aec0;
- font-size: 0.875rem;
- }
- }
- }
-
- .comment-content {
- padding-left: 3.5rem;
-
- .reply-to {
- display: inline-block;
- color: #93C4C1;
- font-size: 0.875rem;
- margin-bottom: 0.5rem;
- }
-
- p {
- color: #4a5568;
- margin: 0;
- line-height: 1.5;
- }
- }
- }
- }
- }
-}
-
-.p-sidebar-header,
-.p-sidebar-custom-header {
- padding: 10px !important;
-}
-
-.p-overlaypanel-content {
- padding: 0 !important;
-}
-
-.reply {
-
- .reply-input {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-self: center;
- gap: 3rem;
- padding: 1rem;
- }
}
\ No newline at end of file