mirror of
https://github.com/201206030/novel-front-web.git
synced 2025-04-27 07:50:50 +00:00
feat: 增加小说点击量
This commit is contained in:
parent
04ff469b3a
commit
b7b4920650
@ -4,6 +4,11 @@ export function getBookById(bookId) {
|
||||
return request.get(`/book/${bookId}`);
|
||||
}
|
||||
|
||||
export function addVisitCount(params) {
|
||||
return request.post('/book/visit', params);
|
||||
}
|
||||
|
||||
|
||||
export function getLastChapterAbout(params) {
|
||||
return request.get('/book/lastChapterAbout', { params });
|
||||
}
|
||||
|
@ -261,7 +261,7 @@
|
||||
import "@/assets/styles/book.css";
|
||||
import { reactive, toRefs, onMounted } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { getBookById,getLastChapterAbout,listRecBooks } from "@/api/book";
|
||||
import { getBookById,addVisitCount,getLastChapterAbout,listRecBooks } from "@/api/book";
|
||||
import Header from "@/components/common/Header";
|
||||
import Footer from "@/components/common/Footer";
|
||||
import author_head from "@/assets/images/author_head.png";
|
||||
@ -292,6 +292,7 @@ export default {
|
||||
const loadBook = async (bookId) => {
|
||||
const { data } = await getBookById(bookId);
|
||||
state.book = data;
|
||||
addBookVisit(bookId)
|
||||
};
|
||||
|
||||
const loadRecBooks = async (bookId) => {
|
||||
@ -315,6 +316,10 @@ export default {
|
||||
loadLastChapterAbout(bookId)
|
||||
};
|
||||
|
||||
const addBookVisit = async (bookId) => {
|
||||
addVisitCount({bookId: bookId})
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
author_head,
|
||||
|
Loading…
x
Reference in New Issue
Block a user