功能复制

master
lion 3 months ago
parent 1ce726412c
commit 1f58dc3648

@ -2,7 +2,7 @@
ENV = 'development'
# base api
VUE_APP_BASE_API = http://yunyubang-test.ali251.langye.net/
#VUE_APP_BASE_API = https://yunyubang.ali251.langye.net/
#VUE_APP_BASE_API = http://yunyubang-test.ali251.langye.net/
VUE_APP_BASE_API = https://yunyubang.ali251.langye.net/
#VUE_APP_BASE_DEV_API = https://yunyubang.ali251.langye.net/

@ -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({

Loading…
Cancel
Save