提交 9d0b72e1 编写于 作者: X xinla

优化:统一系统共用文件上传接口,统一为img的src不是绝对地址的src拼接接口地址

上级 81c4b476
......@@ -28,11 +28,10 @@ export default {
data() {
return {
loading: false,
action:
process.env.VUE_APP_BASE_API +
(this.type == 0
? '/wecom/material/uploadimg'
: '/common/uploadFile2Cos'),
action: process.env.VUE_APP_BASE_API + '/common/uploadFile2Cos',
// (this.type == 0
// ? '/wecom/material/uploadimg'
// : '/common/uploadFile2Cos'),
headers: window.CONFIG.headers,
domain: process.env.VUE_APP_BASE_API,
}
......
......@@ -45,4 +45,21 @@ window.CONFIG = {
return { Authorization: 'Bearer ' + getToken() }
},
}
// 统一为img的src不是绝对地址的拼接接口地址
document.addEventListener(
'error',
function(e) {
let target = e.target
let src = target.attributes.getNamedItem('src').value
if (
target.tagName.toUpperCase() === 'IMG' &&
src &&
!src.includes('http')
) {
target.src = process.env.VUE_APP_BASE_API + src
}
},
true
)
export default window.CONFIG
......@@ -67,20 +67,29 @@ Vue.prototype.msgInfo = function(msg) {
import { pickerOptions } from '@/utils/index'
Vue.prototype.pickerOptions = pickerOptions
import VideoPlayer from 'vue-video-player'
Vue.use(VideoPlayer);
import AudioPlayer from '@liripeng/vue-audio-player'
Vue.use(VideoPlayer)
import AudioPlayer from '@liripeng/vue-audio-player'
import '@liripeng/vue-audio-player/lib/vue-audio-player.css'
Vue.use(AudioPlayer)
import VueAMap from 'vue-amap';
import VueAMap from 'vue-amap'
Vue.use(VueAMap);
Vue.use(VueAMap)
VueAMap.initAMapApiLoader({
  key: '32396af00cd726deed804cf5b63ed2d8',
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  v: '1.4.4'
});
key: '32396af00cd726deed804cf5b63ed2d8',
plugin: [
'AMap.Autocomplete',
'AMap.PlaceSearch',
'AMap.Scale',
'AMap.OverView',
'AMap.ToolBar',
'AMap.MapType',
'AMap.PolyEditor',
'AMap.CircleEditor',
],
v: '1.4.4',
})
// 全局组件挂载
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
......
......@@ -10,7 +10,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL:
process.env.NODE_ENV === 'development'
? process.env.VUE_APP_BASE_API
? '/api'
: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册