|
@@ -8,11 +8,13 @@ import axios2 from 'axios'
|
|
|
|
|
|
import { setStorage, getStorage, removeStorage } from '@/common/utils/storage.js'
|
|
import { setStorage, getStorage, removeStorage } from '@/common/utils/storage.js'
|
|
|
|
|
|
-export function replaceStringInObject(obj, target, replacement) {
|
|
|
|
|
|
+export function replaceStringInObject(obj, targets, replacement) {
|
|
// 将对象转换为字符串
|
|
// 将对象转换为字符串
|
|
let str = JSON.stringify(obj)
|
|
let str = JSON.stringify(obj)
|
|
// 替换所有目标字符串为替换字符串
|
|
// 替换所有目标字符串为替换字符串
|
|
- str = str.replace(new RegExp(target, 'g'), replacement)
|
|
|
|
|
|
+ for (var target of targets) {
|
|
|
|
+ str = str.replace(new RegExp(target, 'g'), replacement)
|
|
|
|
+ }
|
|
// 将字符串转换回对象
|
|
// 将字符串转换回对象
|
|
return JSON.parse(str)
|
|
return JSON.parse(str)
|
|
}
|
|
}
|
|
@@ -410,7 +412,7 @@ export const uploadImgFull = async function (file) {
|
|
resolve(
|
|
resolve(
|
|
replaceStringInObject(
|
|
replaceStringInObject(
|
|
res.data.data,
|
|
res.data.data,
|
|
- 'https://zfire-jsm-h.oss-cn-shenzhen.aliyuncs.com/',
|
|
|
|
|
|
+ ['https://zfire-jsm-h.oss-cn-shenzhen.aliyuncs.com/', 'https://zfire-jsm-h.oss-cn-shenzhen.aliyuncs.com/'],
|
|
process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API + '/common/img/get?key='
|
|
process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API + '/common/img/get?key='
|
|
)
|
|
)
|
|
)
|
|
)
|
|
@@ -431,7 +433,7 @@ export const uploadImgFull = async function (file) {
|
|
resolve(
|
|
resolve(
|
|
replaceStringInObject(
|
|
replaceStringInObject(
|
|
JSON.parse(res.data).data,
|
|
JSON.parse(res.data).data,
|
|
- 'https://zfire-jsm-h.oss-cn-shenzhen.aliyuncs.com/',
|
|
|
|
|
|
+ ['https://zfire-jsm-h.oss-cn-shenzhen.aliyuncs.com/', 'https://zfire-jsm-h.oss-cn-shenzhen.aliyuncs.com/'],
|
|
process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API + '/common/img/get?key='
|
|
process.env.VUE_APP_BASE_URL + process.env.VUE_APP_BASE_API + '/common/img/get?key='
|
|
)
|
|
)
|
|
)
|
|
)
|