add mainView, reward, community pages
Change-Id: I70da6ed3e91ebf4124c2074b6508192a19ed9909
diff --git "a/src/app/community/community-detail/\133communityId\135/page.tsx" "b/src/app/community/community-detail/\133communityId\135/page.tsx"
index 40200f7..850c54e 100644
--- "a/src/app/community/community-detail/\133communityId\135/page.tsx"
+++ "b/src/app/community/community-detail/\133communityId\135/page.tsx"
@@ -88,7 +88,7 @@
useEffect(() => {
const fetchThreadInfo = async () => {
try {
- const { data } = await axios.get(`http://127.0.0.1:4523/m1/6387307-6083949-default/community/info?communityId=${communityId}`);
+ const { data } = await axios.get(process.env.PUBLIC_URL + `/community/info?communityId=${communityId}`);
setCommunityInfo(data);
setTotalThreads(data.threadNumber);
} catch (err) {
@@ -106,12 +106,12 @@
const fetchThreads = async () => {
try {
- const page = first / rows + 1;
- console.log("当前页" + page + "size" + rows + "搜索内容" + searchValue);
+ const pageNumber = first / rows + 1;
+ console.log("当前页" + pageNumber + "size" + rows + "搜索内容" + searchValue);
const option = selectedOption.name // 添加排序参数
const response = await axios.get<ThreadList>(
- `http://127.0.0.1:4523/m1/6387307-6083949-default/community/threads`, {
- params: { communityId, page, rows, option, searchValue }
+ process.env.PUBLIC_URL + `/community/threads`, {
+ params: { communityId, pageNumber, rows, option, searchValue }
}
);
console.log('获取帖子列表:', response.data.records);
@@ -147,7 +147,7 @@
communityId: communityId // 从URL参数获取的社区ID
};
// 发送POST请求
- const response = await axios.post('http://127.0.0.1:4523/m1/6387307-6083949-default/thread', postData);
+ const response = await axios.post(process.env.PUBLIC_URL + '/thread', postData);
if (response.status === 200) {
toast.current?.show({ severity: 'success', summary: 'Success', detail: '帖子发布成功' });
@@ -187,9 +187,8 @@
</div>
</div>
<div className="input">
- <Button label="返回列表" link onClick={() => router.push(`/community/resource-community-list/${communityInfo?.type}`)} />
<div className="action-section">
- <div className="communities-searchBar">
+ <div className="searchBar">
<i className="pi pi-search" />
<InputText type="search" className="search-helper" placeholder="搜索你感兴趣的帖子" onChange={(e) => { const target = e.target as HTMLInputElement; debouncedSearch(target.value); }} />
</div>
@@ -274,7 +273,7 @@
<FileUpload
mode="basic"
name="thread-image"
- url="/file" // 与后端交互的URL
+ url={process.env.PUBLIC_URL + "/file"} // 与后端交互的URL
accept="image/*"
maxFileSize={10000000000}
chooseLabel="选择图片"
diff --git "a/src/app/community/community-detail/\133communityId\135/resource-community.scss" "b/src/app/community/community-detail/\133communityId\135/resource-community.scss"
index a40ebaa..543a846 100644
--- "a/src/app/community/community-detail/\133communityId\135/resource-community.scss"
+++ "b/src/app/community/community-detail/\133communityId\135/resource-community.scss"
@@ -76,10 +76,10 @@
display: flex;
align-items: center;
- .communities-searchBar {
+ .searchBar {
max-width: 100%;
position: relative;
-
+ border-radius: 0px 10px 10px 0px;
.pi-search {
position: absolute;
left: 1rem;
diff --git a/src/app/community/community.scss b/src/app/community/community.scss
index 42bfda1..5762301 100644
--- a/src/app/community/community.scss
+++ b/src/app/community/community.scss
@@ -9,7 +9,7 @@
// 热门社区样式
.hot-communities {
margin: 3rem 0;
-
+ cursor: pointer;
h1 {
margin-bottom: 1.5rem;
text-align: center; // 页面居中
@@ -121,7 +121,7 @@
border-radius: 0.5rem;
transition: transform 0.3s ease;
box-shadow: none !important; // 取消阴影
-
+ cursor: pointer;
//填充卡片
&.p-card.p-component {
padding: 0;
diff --git a/src/app/community/page.tsx b/src/app/community/page.tsx
index a47cb47..764e358 100644
--- a/src/app/community/page.tsx
+++ b/src/app/community/page.tsx
@@ -55,7 +55,7 @@
useEffect(() => {
const fetchHotCommunity = async () => {
try {
- const { data } = await axios.get(`http://127.0.0.1:4523/m1/6387307-6083949-default/community/hot`);
+ const { data } = await axios.get(process.env.PUBLIC_URL + `/community/hot`);
setHotCommunities(data.communityList);
} catch (err) {
console.error(err);
@@ -69,7 +69,7 @@
useEffect(() => {
const fetchCommunity = async () => {
try {
- const { data } = await axios.get(`http://127.0.0.1:4523/m1/6387307-6083949-default/community/common`);
+ const { data } = await axios.get(process.env.PUBLIC_URL + `/community/common`);
setCommunities(data.communityList);
console.log(data.communityList);
} catch (err) {
@@ -106,7 +106,7 @@
width="24"
height="24"
/></div>
- <Image src={process.env.NEXT_PUBLIC_NGINX_URL + item.communityPicture} alt={item.communityName} height="200" className="w-full h-48 object-cover" />
+ <Image src={process.env.NEXT_PUBLIC_NGINX_URL + item.communityPicture} alt={item.communityName} height="200" className="w-full h-48 object-cover" />
</div>
}
>
diff --git "a/src/app/community/resource-community-list/\133category\135/page.tsx" "b/src/app/community/resource-community-list/\133category\135/page.tsx"
index a34fc07..16f6bd6 100644
--- "a/src/app/community/resource-community-list/\133category\135/page.tsx"
+++ "b/src/app/community/resource-community-list/\133category\135/page.tsx"
@@ -73,12 +73,12 @@
const fetchCommunities = async () => {
try {
- const page = first / rows + 1;
+ const pageNumber = first / rows + 1;
const type = category === 'all' ? '全部' : category;
- console.log("当前页" + page + "size" + rows + "type" + type + "searchValue" + searchValue);
+ console.log("当前页" + pageNumber + "size" + rows + "type" + type + "searchValue" + searchValue);
const response = await axios.get<CommunityList>(
- `http://127.0.0.1:4523/m1/6387307-6083949-default/community`, {
- params: { type, page, rows, searchValue }
+ process.env.PUBLIC_URL + `/community`, {
+ params: { type, pageNumber, rows, searchValue }
}
);
console.log('获取社区列表:', response.data.records);
@@ -101,7 +101,7 @@
</div>
{/* 社区搜索栏 */}
- <div className="communities-searchBar">
+ <div className="searchBar">
<i className="pi pi-search" />
<InputText type="search" className="search-helper" placeholder="搜索你感兴趣的社区" onChange={(e) => { const target = e.target as HTMLInputElement; debouncedSearch(target.value); }} />
</div>
diff --git "a/src/app/community/resource-community-list/\133category\135/resource-community-list.scss" "b/src/app/community/resource-community-list/\133category\135/resource-community-list.scss"
index c8a0018..9b863bf 100644
--- "a/src/app/community/resource-community-list/\133category\135/resource-community-list.scss"
+++ "b/src/app/community/resource-community-list/\133category\135/resource-community-list.scss"
@@ -17,6 +17,7 @@
padding: 1rem;
&-card {
+ cursor: pointer;
height: 140px;
padding: 1.5rem;
margin-bottom: 1rem;
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