mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-05-06 20:42:52 +08:00
Fixed the problem of abnormal display of front-end page pictures in docker deployment
This commit is contained in:
@@ -52,7 +52,8 @@ const MarkdownViewer: FC<MarkdownViewerProps> = ({ status }) => {
|
||||
const [modelName, setModelName] = useState<string>('')
|
||||
const [style, setStyle] = useState<string>('')
|
||||
const [createTime, setCreateTime] = useState<string>('')
|
||||
const baseURL = String(import.meta.env.VITE_API_BASE_URL).replace('/api','') || ''
|
||||
// 确保baseURL没有尾部斜杠
|
||||
const baseURL = (String(import.meta.env.VITE_API_BASE_URL || '').replace('/api','') || '').replace(/\/$/, '')
|
||||
const getCurrentTask = useTaskStore.getState().getCurrentTask
|
||||
const currentTask = useTaskStore(state => state.getCurrentTask())
|
||||
const taskStatus = currentTask?.status || 'PENDING'
|
||||
@@ -307,14 +308,14 @@ const MarkdownViewer: FC<MarkdownViewerProps> = ({ status }) => {
|
||||
|
||||
// Enhanced image with zoom capability
|
||||
img: ({ node, ...props }) =>{
|
||||
|
||||
let src = baseURL +props.src
|
||||
// Fix the URL by removing the 'undefined' prefix if it exists
|
||||
let src = props.src
|
||||
if (src.startsWith('/')) {
|
||||
src = baseURL + src
|
||||
}
|
||||
props.src = src
|
||||
|
||||
|
||||
return(
|
||||
|
||||
|
||||
<div className="my-8 flex justify-center">
|
||||
<Zoom>
|
||||
<img
|
||||
|
||||
@@ -24,7 +24,8 @@ interface NoteHistoryProps {
|
||||
const NoteHistory: FC<NoteHistoryProps> = ({ onSelect, selectedId }) => {
|
||||
const tasks = useTaskStore(state => state.tasks)
|
||||
const removeTask = useTaskStore(state => state.removeTask)
|
||||
const baseURL = import.meta.env.VITE_API_BASE_URL || 'api/'
|
||||
// 确保baseURL没有尾部斜杠
|
||||
const baseURL = (String(import.meta.env.VITE_API_BASE_URL || 'api')).replace(/\/$/, '')
|
||||
const [rawSearch, setRawSearch] = useState('')
|
||||
const [search, setSearch] = useState('')
|
||||
const fuse = new Fuse(tasks, {
|
||||
@@ -101,7 +102,7 @@ const NoteHistory: FC<NoteHistoryProps> = ({ onSelect, selectedId }) => {
|
||||
|
||||
src={
|
||||
task.audioMeta.cover_url
|
||||
? baseURL+`/image_proxy?url=${encodeURIComponent(task.audioMeta.cover_url)}`
|
||||
? `${baseURL}/image_proxy?url=${encodeURIComponent(task.audioMeta.cover_url)}`
|
||||
: '/placeholder.png'
|
||||
}
|
||||
alt="封面"
|
||||
|
||||
Reference in New Issue
Block a user