mirror of
https://github.com/201206030/novel-front-web.git
synced 2025-04-27 07:50:50 +00:00
fix: 修复小说详情页封面错误图显示
This commit is contained in:
parent
9c9332079e
commit
9fe9a6a0e7
@ -11,8 +11,8 @@ novel 是一套基于时下**最新** Java 技术栈 Spring Boot 3 + Vue 3 开
|
|||||||
## 项目地址
|
## 项目地址
|
||||||
|
|
||||||
- 后端项目(更新中):[GitHub](https://github.com/201206030/novel) | [码云](https://gitee.com/novel_dev_team/novel)
|
- 后端项目(更新中):[GitHub](https://github.com/201206030/novel) | [码云](https://gitee.com/novel_dev_team/novel)
|
||||||
- 后端微服务版本项目(待更新):[GitHub](https://github.com/201206030/novel-cloud) | [码云](https://gitee.com/novel_dev_team/novel-cloud)
|
|
||||||
- 线上应用版:[GitHub](https://github.com/201206030/novel-plus) | [码云](https://gitee.com/novel_dev_team/novel-plus) |[演示地址](http://47.106.243.172:8888/)
|
- 线上应用版:[GitHub](https://github.com/201206030/novel-plus) | [码云](https://gitee.com/novel_dev_team/novel-plus) |[演示地址](http://47.106.243.172:8888/)
|
||||||
|
- 微服务版:[GitHub](https://github.com/201206030/novel-cloud) | [码云](https://gitee.com/novel_dev_team/novel-cloud)
|
||||||
|
|
||||||
## 前端技术选型
|
## 前端技术选型
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
<div class="bookCover cf">
|
<div class="bookCover cf">
|
||||||
<a class="book_cover">
|
<a class="book_cover">
|
||||||
<img
|
<img
|
||||||
|
id="bookCover"
|
||||||
class="cover"
|
class="cover"
|
||||||
:src="`${imgBaseUrl}` + `${book.picUrl}`"
|
:src="`${imgBaseUrl}` + `${book.picUrl}`"
|
||||||
:alt="book.bookName"
|
:alt="book.bookName"
|
||||||
onerror="this.src='default.gif';this.onerror=null"
|
|
||||||
/></a>
|
/></a>
|
||||||
<div class="book_info">
|
<div class="book_info">
|
||||||
<div class="tit">
|
<div class="tit">
|
||||||
@ -155,9 +155,15 @@
|
|||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<div class="user_heads fl" vals="389">
|
<div class="user_heads fl" vals="389">
|
||||||
<img :src="item.commentUserPhoto ? uploadImgBaseUrl + item.commentUserPhoto : man" class="user_head" alt="" /><span
|
<img
|
||||||
class="user_level1"
|
:src="
|
||||||
style="display: none"
|
item.commentUserPhoto
|
||||||
|
? uploadImgBaseUrl + item.commentUserPhoto
|
||||||
|
: man
|
||||||
|
"
|
||||||
|
class="user_head"
|
||||||
|
alt=""
|
||||||
|
/><span class="user_level1" style="display: none"
|
||||||
>见习</span
|
>见习</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -169,10 +175,14 @@
|
|||||||
><span class="fr" v-if="item.commentUserId == uid"
|
><span class="fr" v-if="item.commentUserId == uid"
|
||||||
><a
|
><a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
@click="updateUserComment(item.id,item.commentContent)"
|
@click="
|
||||||
|
updateUserComment(item.id, item.commentContent)
|
||||||
|
"
|
||||||
class="zan"
|
class="zan"
|
||||||
>修改</a
|
>修改</a
|
||||||
> | <a
|
>
|
||||||
|
|
|
||||||
|
<a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
@click="deleteUserComment(item.id)"
|
@click="deleteUserComment(item.id)"
|
||||||
class="zan"
|
class="zan"
|
||||||
@ -187,12 +197,9 @@
|
|||||||
v-model="dialogUpdateCommentFormVisible"
|
v-model="dialogUpdateCommentFormVisible"
|
||||||
title="评论修改"
|
title="评论修改"
|
||||||
>
|
>
|
||||||
<el-form >
|
<el-form>
|
||||||
<el-form-item
|
<el-form-item label="评论内容">
|
||||||
label="评论内容"
|
<el-input type="textarea" v-model="updateComment" />
|
||||||
|
|
||||||
>
|
|
||||||
<el-input type="textarea" v-model="updateComment"/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@ -291,9 +298,9 @@
|
|||||||
<div class="cover">
|
<div class="cover">
|
||||||
<a href="javascript:void(0)" @click="bookDetail(item.id)"
|
<a href="javascript:void(0)" @click="bookDetail(item.id)"
|
||||||
><img
|
><img
|
||||||
|
:id="'bookCover' + `${index}`"
|
||||||
:src="`${imgBaseUrl}` + `${item.picUrl}`"
|
:src="`${imgBaseUrl}` + `${item.picUrl}`"
|
||||||
:alt="item.bookName"
|
:alt="item.bookName"
|
||||||
onerror="this.src='default.gif';this.onerror=null"
|
|
||||||
/></a>
|
/></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="dec">
|
<div class="dec">
|
||||||
@ -323,7 +330,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import "@/assets/styles/book.css";
|
import "@/assets/styles/book.css";
|
||||||
import man from "@/assets/images/man.png";
|
import man from "@/assets/images/man.png";
|
||||||
import { reactive, toRefs, onMounted } from "vue";
|
import { reactive, toRefs, onMounted, onUpdated } from "vue";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import {
|
import {
|
||||||
@ -331,10 +338,10 @@ import {
|
|||||||
addVisitCount,
|
addVisitCount,
|
||||||
getLastChapterAbout,
|
getLastChapterAbout,
|
||||||
listRecBooks,
|
listRecBooks,
|
||||||
listNewestComments
|
listNewestComments,
|
||||||
} from "@/api/book";
|
} from "@/api/book";
|
||||||
import { comment, deleteComment, updateComment } from "@/api/user";
|
import { comment, deleteComment, updateComment } from "@/api/user";
|
||||||
import {getUid} from "@/utils/auth"
|
import { getUid } from "@/utils/auth";
|
||||||
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";
|
||||||
@ -353,7 +360,7 @@ export default {
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
uid: getUid(),
|
uid: getUid(),
|
||||||
book: {},
|
book: {},
|
||||||
books: {},
|
books: [],
|
||||||
chapterAbout: {},
|
chapterAbout: {},
|
||||||
commentContent: "",
|
commentContent: "",
|
||||||
newestComments: {},
|
newestComments: {},
|
||||||
@ -361,7 +368,7 @@ export default {
|
|||||||
uploadImgBaseUrl: process.env.VUE_APP_BASE_UPLOAD_IMG_URL,
|
uploadImgBaseUrl: process.env.VUE_APP_BASE_UPLOAD_IMG_URL,
|
||||||
dialogUpdateCommentFormVisible: false,
|
dialogUpdateCommentFormVisible: false,
|
||||||
commentId: "",
|
commentId: "",
|
||||||
updateComment: ""
|
updateComment: "",
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const bookId = route.params.id;
|
const bookId = route.params.id;
|
||||||
@ -371,9 +378,21 @@ export default {
|
|||||||
loadNewestComments(bookId);
|
loadNewestComments(bookId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUpdated(() => {
|
||||||
|
console.log("onUpdated==========================");
|
||||||
|
for (let i = 0; i < state.books.length; i++) {
|
||||||
|
document
|
||||||
|
.getElementById("bookCover" + i)
|
||||||
|
.setAttribute("onerror", "this.src='default.gif';this.onerror=null");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const loadBook = async (bookId) => {
|
const loadBook = async (bookId) => {
|
||||||
const { data } = await getBookById(bookId);
|
const { data } = await getBookById(bookId);
|
||||||
state.book = data;
|
state.book = data;
|
||||||
|
document
|
||||||
|
.getElementById("bookCover")
|
||||||
|
.setAttribute("onerror", "this.src='default.gif';this.onerror=null");
|
||||||
addBookVisit(bookId);
|
addBookVisit(bookId);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -433,10 +452,10 @@ export default {
|
|||||||
loadNewestComments(state.book.id);
|
loadNewestComments(state.book.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateUserComment = async (id,comment) => {
|
const updateUserComment = async (id, comment) => {
|
||||||
state.dialogUpdateCommentFormVisible = true
|
state.dialogUpdateCommentFormVisible = true;
|
||||||
state.updateComment = comment
|
state.updateComment = comment;
|
||||||
state.commentId = id
|
state.commentId = id;
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteUserComment = async (id) => {
|
const deleteUserComment = async (id) => {
|
||||||
@ -445,8 +464,8 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const goUpdateComment = async (id) => {
|
const goUpdateComment = async (id) => {
|
||||||
state.dialogUpdateCommentFormVisible = false
|
state.dialogUpdateCommentFormVisible = false;
|
||||||
await updateComment(state.commentId,{"content":state.updateComment})
|
await updateComment(state.commentId, { content: state.updateComment });
|
||||||
loadNewestComments(state.book.id);
|
loadNewestComments(state.book.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -462,7 +481,7 @@ export default {
|
|||||||
deleteUserComment,
|
deleteUserComment,
|
||||||
man,
|
man,
|
||||||
updateUserComment,
|
updateUserComment,
|
||||||
goUpdateComment
|
goUpdateComment,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -492,24 +511,22 @@ export default {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.el-button:not(.is-text) {
|
.el-button:not(.is-text) {
|
||||||
border: #f80;
|
border: #f80;
|
||||||
border-color: #f80;
|
border-color: #f80;
|
||||||
}
|
}
|
||||||
.el-button--primary {
|
.el-button--primary {
|
||||||
--el-button-hover-bg-color: #f80;
|
--el-button-hover-bg-color: #f80;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-button--primary {
|
.el-button--primary {
|
||||||
--el-button-bg-color: #f70;
|
--el-button-bg-color: #f70;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-button {
|
.el-button {
|
||||||
|
--el-button-hover-text-color: #fafafa;
|
||||||
--el-button-hover-text-color: #fafafa;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-button {
|
.el-button {
|
||||||
|
--el-button-hover-bg-color: #ff880061;
|
||||||
--el-button-hover-bg-color: #ff880061;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user