upper Article api to timi-web
This commit is contained in:
@ -1,37 +1,15 @@
|
||||
import { Article, ArticleView, axios, Page, PageResult } from "timi-web";
|
||||
import { Article, axios, Page, PageResult } from "timi-web";
|
||||
import { ArticleRanking } from "@/types/Article.ts";
|
||||
|
||||
async function page(page: Page): Promise<PageResult<Article<any>>> {
|
||||
return axios.post("/article/list", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章
|
||||
*
|
||||
* @param id 文章 ID
|
||||
* @returns 文章数据
|
||||
*/
|
||||
async function view(id: number): Promise<ArticleView<any>> {
|
||||
return axios.get(`/article/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 喜欢文章,后端有限调用,1240ms 一次
|
||||
*
|
||||
* @param id 文章 ID
|
||||
* @returns 最新喜欢数量
|
||||
*/
|
||||
async function like(id: number): Promise<number> {
|
||||
return axios.get(`/article/like/${id}`);
|
||||
}
|
||||
|
||||
async function listRanking(): Promise<ArticleRanking[]> {
|
||||
return axios.get("/article/list/ranking");
|
||||
}
|
||||
|
||||
export default {
|
||||
view,
|
||||
like,
|
||||
page,
|
||||
listRanking
|
||||
};
|
||||
|
||||
@ -25,8 +25,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ArticleView, CommentBizType, MarkdownView, SettingKey, SettingMapper, Time } from "timi-web";
|
||||
import ArticleAPI from "@/api/ArticleAPI";
|
||||
import { ArticleAPI, ArticleView, CommentBizType, MarkdownView, SettingKey, SettingMapper, Time } from "timi-web";
|
||||
import { Comment } from "timi-tdesign-pc";
|
||||
|
||||
// 文章
|
||||
|
||||
@ -37,8 +37,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ArticleView, Icon } from "timi-web";
|
||||
import ArticleAPI from "@/api/ArticleAPI";
|
||||
import { ArticleAPI, ArticleView, Icon } from "timi-web";
|
||||
import ArticleAbout from "@/components/article/template/ArticleAbout.vue";
|
||||
import ArticleMusic from "@/components/article/template/ArticleMusic.vue";
|
||||
import ArticlePublic from "@/components/article/template/ArticlePublic.vue";
|
||||
|
||||
Reference in New Issue
Block a user