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}`);
|
return request.get(`/book/${bookId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addVisitCount(params) {
|
||||||
|
return request.post('/book/visit', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function getLastChapterAbout(params) {
|
export function getLastChapterAbout(params) {
|
||||||
return request.get('/book/lastChapterAbout', { params });
|
return request.get('/book/lastChapterAbout', { params });
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@
|
|||||||
import "@/assets/styles/book.css";
|
import "@/assets/styles/book.css";
|
||||||
import { reactive, toRefs, onMounted } from "vue";
|
import { reactive, toRefs, onMounted } from "vue";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
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 Header from "@/components/common/Header";
|
||||||
import Footer from "@/components/common/Footer";
|
import Footer from "@/components/common/Footer";
|
||||||
import author_head from "@/assets/images/author_head.png";
|
import author_head from "@/assets/images/author_head.png";
|
||||||
@ -292,6 +292,7 @@ export default {
|
|||||||
const loadBook = async (bookId) => {
|
const loadBook = async (bookId) => {
|
||||||
const { data } = await getBookById(bookId);
|
const { data } = await getBookById(bookId);
|
||||||
state.book = data;
|
state.book = data;
|
||||||
|
addBookVisit(bookId)
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadRecBooks = async (bookId) => {
|
const loadRecBooks = async (bookId) => {
|
||||||
@ -315,6 +316,10 @@ export default {
|
|||||||
loadLastChapterAbout(bookId)
|
loadLastChapterAbout(bookId)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const addBookVisit = async (bookId) => {
|
||||||
|
addVisitCount({bookId: bookId})
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
author_head,
|
author_head,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user