master
lion 2 months ago
parent 33bec2bf14
commit 4583c43447

@ -894,30 +894,16 @@ export default {
sort:this.form.sort, sort:this.form.sort,
content: (() => { content: (() => {
let content = this.form.content || '' let content = this.form.content || ''
const baseUrl = `${process.env.VUE_APP_BASE_API}storage/files` // / //storage/files
// 使 http:// https:// const apiBase = (process.env.VUE_APP_BASE_API || '').replace(/\/$/, '')
// ../storage/files http:// https:// const baseUrl = `${apiBase}/storage/files/`
content = content.replace(/\.\.\/storage\/files/g, (match, offset) => { // img src /storage/files ../storage/files http(s)
// http:// https:// content = content.replace(
const before = content.substring(Math.max(0, offset - 50), offset) /(<img[^>]+src=["'])(?:\.\.\/)?\/?storage\/files\/([^"']+)(["'][^>]*>)/g,
if (before.indexOf('http://') !== -1 || before.indexOf('https://') !== -1) { (match, prefix, filePath, suffix) => {
return match return `${prefix}${baseUrl}${filePath}${suffix}`
} }
return baseUrl )
})
// /storage/files http:// https://
content = content.replace(/\/storage\/files/g, (match, offset) => {
// http:// https://
const before = content.substring(Math.max(0, offset - 50), offset)
if (before.indexOf('http://') !== -1 || before.indexOf('https://') !== -1) {
return match
}
// URL
if (before.indexOf(baseUrl) !== -1) {
return match
}
return baseUrl
})
return content return content
})() })()
@ -966,30 +952,14 @@ export default {
sort:this.form.sort, sort:this.form.sort,
content: (() => { content: (() => {
let content = this.form.content || '' let content = this.form.content || ''
const baseUrl = `${process.env.VUE_APP_BASE_API}storage/files` const apiBase = (process.env.VUE_APP_BASE_API || '').replace(/\/$/, '')
// 使 http:// https:// const baseUrl = `${apiBase}/storage/files/`
// ../storage/files http:// https:// content = content.replace(
content = content.replace(/\.\.\/storage\/files/g, (match, offset) => { /(<img[^>]+src=["'])(?:\.\.\/)?\/?storage\/files\/([^"']+)(["'][^>]*>)/g,
// http:// https:// (match, prefix, filePath, suffix) => {
const before = content.substring(Math.max(0, offset - 50), offset) return `${prefix}${baseUrl}${filePath}${suffix}`
if (before.indexOf('http://') !== -1 || before.indexOf('https://') !== -1) {
return match
} }
return baseUrl )
})
// /storage/files http:// https://
content = content.replace(/\/storage\/files/g, (match, offset) => {
// http:// https://
const before = content.substring(Math.max(0, offset - 50), offset)
if (before.indexOf('http://') !== -1 || before.indexOf('https://') !== -1) {
return match
}
// URL
if (before.indexOf(baseUrl) !== -1) {
return match
}
return baseUrl
})
return content return content
})(), })(),
// audit_status:1 // audit_status:1
@ -1084,3 +1054,4 @@ export default {
} }
} }
</style> </style>

@ -602,30 +602,16 @@
end_time: this.form.time[1], end_time: this.form.time[1],
content: (() => { content: (() => {
let content = this.form.content || '' let content = this.form.content || ''
const baseUrl = `${process.env.VUE_APP_BASE_API}storage/files` // / //storage/files
// 使 http:// https:// const apiBase = (process.env.VUE_APP_BASE_API || '').replace(/\/$/, '')
// ../storage/files http:// https:// const baseUrl = `${apiBase}/storage/files/`
content = content.replace(/\.\.\/storage\/files/g, (match, offset) => { // img src /storage/files ../storage/files
// http:// https:// content = content.replace(
const before = content.substring(Math.max(0, offset - 50), offset) /(<img[^>]+src=["'])(?:\.\.\/)?\/?storage\/files\/([^"']+)(["'][^>]*>)/g,
if (before.indexOf('http://') !== -1 || before.indexOf('https://') !== -1) { (match, prefix, filePath, suffix) => {
return match return `${prefix}${baseUrl}${filePath}${suffix}`
} }
return baseUrl )
})
// /storage/files http:// https://
content = content.replace(/\/storage\/files/g, (match, offset) => {
// http:// https://
const before = content.substring(Math.max(0, offset - 50), offset)
if (before.indexOf('http://') !== -1 || before.indexOf('https://') !== -1) {
return match
}
// URL
if (before.indexOf(baseUrl) !== -1) {
return match
}
return baseUrl
})
return content return content
})() })()
}).then(res => { }).then(res => {
@ -664,30 +650,14 @@
end_time: this.form.time[1], end_time: this.form.time[1],
content: (() => { content: (() => {
let content = this.form.content || '' let content = this.form.content || ''
const baseUrl = `${process.env.VUE_APP_BASE_API}storage/files` const apiBase = (process.env.VUE_APP_BASE_API || '').replace(/\/$/, '')
// 使 http:// https:// const baseUrl = `${apiBase}/storage/files/`
// ../storage/files http:// https:// content = content.replace(
content = content.replace(/\.\.\/storage\/files/g, (match, offset) => { /(<img[^>]+src=["'])(?:\.\.\/)?\/?storage\/files\/([^"']+)(["'][^>]*>)/g,
// http:// https:// (match, prefix, filePath, suffix) => {
const before = content.substring(Math.max(0, offset - 50), offset) return `${prefix}${baseUrl}${filePath}${suffix}`
if (before.indexOf('http://') !== -1 || before.indexOf('https://') !== -1) { }
return match )
}
return baseUrl
})
// /storage/files http:// https://
content = content.replace(/\/storage\/files/g, (match, offset) => {
// http:// https://
const before = content.substring(Math.max(0, offset - 50), offset)
if (before.indexOf('http://') !== -1 || before.indexOf('https://') !== -1) {
return match
}
// URL
if (before.indexOf(baseUrl) !== -1) {
return match
}
return baseUrl
})
return content return content
})() })()
}).then(res => { }).then(res => {

Loading…
Cancel
Save