|
|
|
|
@ -461,7 +461,6 @@ import {index as indexType} from "@/api/activityType"
|
|
|
|
|
import { Message } from 'element-ui'
|
|
|
|
|
import { getparameter,listparameter } from "@/api/system/dictionary";
|
|
|
|
|
import xyTinymce from "@/components/XyTinymce/index.vue";
|
|
|
|
|
import {replaceAll} from "@/utils/index"
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components:{
|
|
|
|
|
@ -893,7 +892,34 @@ export default {
|
|
|
|
|
active_playbill:this.form.activePlaybill,
|
|
|
|
|
illustration:this.form.illustration,
|
|
|
|
|
sort:this.form.sort,
|
|
|
|
|
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({
|
|
|
|
|
@ -938,7 +964,34 @@ export default {
|
|
|
|
|
active_playbill:this.form.activePlaybill,
|
|
|
|
|
illustration:this.form.illustration,
|
|
|
|
|
sort:this.form.sort,
|
|
|
|
|
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
|
|
|
|
|
})(),
|
|
|
|
|
// audit_status:1
|
|
|
|
|
}).then(res => {
|
|
|
|
|
Message({
|
|
|
|
|
|