master
lion 2 months ago
parent 33bec2bf14
commit 4583c43447

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

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

Loading…
Cancel
Save