feat: request function

mack-mac
mackt 8 months ago
parent 081be29323
commit 956a36378b

@ -1,9 +1,9 @@
export { default as useUserInfo } from './useUserInfo';
export { default as useVerify } from './useVerify';
export { default as useDisclosure } from './useDisclosure';
export { default as useMediaQuery } from './useMediaQuery';
export { default as useChangeRoute } from './useChangeRoute';
export { default as useUrlQuery } from './useUrlQuery';
// export { default as useUserInfo } from './useUserInfo';
// export { default as useVerify } from './useVerify';
// export { default as useDisclosure } from './useDisclosure';
// export { default as useMediaQuery } from './useMediaQuery';
// export { default as useChangeRoute } from './useChangeRoute';
// export { default as useUrlQuery } from './useUrlQuery';
export { default as useDebounce } from './useDebounce';
export { default as useTitle } from './useTitle';

@ -0,0 +1,6 @@
import { request, verifyResponse } from '@/utils';
export const apiThanks = async () => {
const res = await request('/luoo-user/my/thanks');
return verifyResponse(res);
};

@ -0,0 +1,3 @@
export * from './about';
export * from './journal';
// export * from './music';

@ -0,0 +1,87 @@
// 期刊
import { request, verifyResponse } from '@/utils';
export interface journalList {
total: number;
row: JournalInfo[];
}
export interface Comment {
_id: string;
avatar: string;
commentCount: number;
content: string;
journalId: string;
location: string;
nickName: string;
parentId: string;
publishTime: string;
state: number;
thumbupCount: number;
userId: string;
}
export interface JournalInfo {
/** 期刊评论top5 */
commentList: Comment[];
/** 文案 */
content: string;
/** 编辑日期 */
date: string;
/** 编辑人 */
editor: string;
/** 已收藏 */
haveCollect: boolean;
id: string;
/** 期刊封面 */
image: string;
/** 期刊发布于 */
ipLocation: string;
/** 剘刊号 */
journalNo: string;
/** 概要 */
summary: string;
/** 期刊标签 */
tags: string[];
/** 期刊名 */
title: string;
/** 期刊总评论数,大于99显示99+ */
totalCommentReply: string;
/** 期刊总评论数 int */
totalCommentReplyInt: number;
}
/**
* @description 10
*/
export const getJournalList = async () => {
const result = await request('/luoo-music/journal/list');
return result;
};
/**
* @description
*/
export const getJournalFilter = async () => {
const result = await request('/luoo-music/journal/filter');
return result;
};
/**
* @description
* @level
* @parentId id
* @state
*/
export const apiTagName = async ({
level = 1,
parentId = '',
state = 1,
}: {
level?: number;
parentId?: string;
state?: number;
}) => {
const result = await request(`/luoo-tag/tag/name?level=${level}&parentId=${parentId}&state=${state}`);
return verifyResponse(result);
};

@ -0,0 +1,5 @@
declare interface FetchResponse<T> {
code: number;
message: string;
data: T;
}

16
src/types/tag.d.ts vendored

@ -0,0 +1,16 @@
declare interface TagName {
/** ID */
id: string;
/** 是否显示 */
isShow: number;
/** 等级 */
level: number;
/** 中文名称 */
nameCh: string;
/** 英文名称 */
nameEn: string;
/** 父类别ID */
parentId: string;
/** 状态 */
state: number;
}
Loading…
Cancel
Save