diff --git a/src/app/vol/[journalId]/page.tsx b/src/app/vol/[journalId]/page.tsx
index 812ff63..cda0df6 100644
--- a/src/app/vol/[journalId]/page.tsx
+++ b/src/app/vol/[journalId]/page.tsx
@@ -1,11 +1,10 @@
/** 期刊详情 */
-import Image from 'next/image';
import Link from 'next/link';
import { notFound } from 'next/navigation';
import { JournalCard, SongCardList, HotJournalList, Comment, Coolect } from '@/components';
-import { apiGetJournalInfoById, apiGetSongsByJournalNo, apiCollect } from '@/services';
+import { apiGetJournalInfoById, apiGetSongsByJournalNo } from '@/services';
const getData = async (journalId: string) => {
const [journalInfoRes, songListRes] = await Promise.all([
@@ -16,13 +15,6 @@ const getData = async (journalId: string) => {
return { journalInfo: journalInfoRes.data, songList: songListRes.data };
};
-// 收藏/取消收藏
-const handleCollect = async ({ isAdd, id }: { isAdd: boolean; id: string }) => {
- const res = await apiCollect({ isAdd: !isAdd, objectId: id, collectType: '1' });
- if (res.code === 200) {
- }
-};
-
export default async function JournalDetail({ params: { journalId } }: { params: { journalId: string } }) {
const { journalInfo, songList } = await getData(journalId);
@@ -66,20 +58,9 @@ export default async function JournalDetail({ params: { journalId } }: { params:
id={journalInfo.id}
type="1"
/>
- {/*
-
{`${journalInfo.totalCommentReply}人收藏`}
-
handleCollect({ id: journalInfo.id, isAdd: !journalInfo.haveCollect })}>
-
-
-
*/}
{/* 内容 */}
-
@@ -96,7 +77,7 @@ export default async function JournalDetail({ params: { journalId } }: { params:
{/* 热门推荐 */}
-
+
);
diff --git a/src/app/vol/list/[category]/[[...page]]/page.tsx b/src/app/vol/list/[category]/[[...page]]/page.tsx
index 736e175..c52a957 100644
--- a/src/app/vol/list/[category]/[[...page]]/page.tsx
+++ b/src/app/vol/list/[category]/[[...page]]/page.tsx
@@ -1,3 +1,5 @@
+/** 期刊列表 */
+
import { Category, JournalList, HotJournalList } from '@/components';
import { apiSearchCategory } from '@/services';
diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx
index 5d0d4ea..b0f322c 100644
--- a/src/components/Avatar.tsx
+++ b/src/components/Avatar.tsx
@@ -1,16 +1,13 @@
import Image from 'next/image';
-const Avatar = ({
- src,
- alt = 'avatar',
- size,
- className = '',
-}: {
+interface Props {
src: string;
alt?: string;
size: number;
className?: string;
-}) => {
+}
+
+const Avatar = ({ src, alt = 'avatar', size, className = '' }: Props) => {
return (
diff --git a/src/components/Journal/HotJournalCard.tsx b/src/components/Journal/HotJournalCard.tsx
index a94924f..0c7711a 100644
--- a/src/components/Journal/HotJournalCard.tsx
+++ b/src/components/Journal/HotJournalCard.tsx
@@ -1,18 +1,14 @@
import Image from 'next/image';
-import Link from 'next/link';
export default function JournalItem({ title, image, totalCommentReply, journalNo }: JournalInfo) {
return (
-
-
-
{' '}
-
-
+
+
{' '}
-
+
{title}
-
{`${totalCommentReply}人收藏`}
+
{`${totalCommentReply}人收藏`}
);
diff --git a/src/components/Journal/HotJournalList.tsx b/src/components/Journal/HotJournalList.tsx
index b0d815b..bc83f1b 100644
--- a/src/components/Journal/HotJournalList.tsx
+++ b/src/components/Journal/HotJournalList.tsx
@@ -1,4 +1,5 @@
import Link from 'next/link';
+
import HotJournalCard from './HotJournalCard';
import { apiJournalRecommend } from '@/services/server/journal';
@@ -12,22 +13,28 @@ interface JournalProp {
journalId: string;
}
-// const RecommondJournal = async (prop: HotProp | JournalProp) => {
-const RecommondJournal = async (prop: any) => {
+const getData = async (id: string) => {
+ const res = await apiJournalRecommend({ id });
+ return res.code === 200 ? res.data : [];
+};
+
+const RecommondJournal = async (prop: HotProp | JournalProp) => {
let journalList: JournalInfo[] = [];
- const res = await apiJournalRecommend({ id: prop.journalId });
- if (res) {
- journalList = res;
- }
+ if (prop.type === 'hot') journalList = [];
+ if (prop.type === 'journal') journalList = await getData(prop.journalId);
return (
{/* 分类 & 电台 */}
热门推荐
-
{/* 期刊 list */}
- {journalList?.length && journalList.map((item: JournalInfo) => )}
+ {!!journalList?.length &&
+ journalList.map((item: JournalInfo) => (
+
+
+
+ ))}
);
diff --git a/src/services/server/journal.ts b/src/services/server/journal.ts
index d4338a1..75787a4 100644
--- a/src/services/server/journal.ts
+++ b/src/services/server/journal.ts
@@ -85,7 +85,7 @@ export const apiGetJournalInfoById: (params: { id: string }) => Promise
Promise> = async ({
+export const apiGetSongsByJournalNo: (params: { id: string }) => Promise> = async ({
id,
}) => {
const request = new Request('http://localhost/', {