|
|
|
|
@ -584,7 +584,34 @@
|
|
|
|
|
start_time: this.form.time[0],
|
|
|
|
|
sortnumber: this.form.sortnumber,
|
|
|
|
|
end_time: this.form.time[1],
|
|
|
|
|
content: replaceAll(this.form.content,'../storage/files',`${process.env.VUE_APP_BASE_API}storage/files`)
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
return baseUrl
|
|
|
|
|
})
|
|
|
|
|
return content
|
|
|
|
|
})()
|
|
|
|
|
}).then(res => {
|
|
|
|
|
Message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
@ -618,7 +645,34 @@
|
|
|
|
|
start_time: this.form.time[0],
|
|
|
|
|
sortnumber: this.form.sortnumber,
|
|
|
|
|
end_time: this.form.time[1],
|
|
|
|
|
content: replaceAll(this.form.content,'../storage/files',`${process.env.VUE_APP_BASE_API}storage/files`)
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
return baseUrl
|
|
|
|
|
})
|
|
|
|
|
return content
|
|
|
|
|
})()
|
|
|
|
|
}).then(res => {
|
|
|
|
|
Message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
|