优化
This commit is contained in:
parent
7e1e542a6c
commit
171eb28566
2
components.d.ts
vendored
2
components.d.ts
vendored
@ -26,9 +26,7 @@ declare module 'vue' {
|
||||
ElTabs: typeof import('element-plus/es')['ElTabs']
|
||||
Footer: typeof import('./src/components/Footer.vue')['default']
|
||||
Header: typeof import('./src/components/Header.vue')['default']
|
||||
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
VideoPlayer: typeof import('./src/components/VideoPlayer.vue')['default']
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import axios from 'axios'
|
||||
|
||||
// 创建axios实例
|
||||
const api = axios.create({
|
||||
baseURL: 'http://localhost:8080/jeecg-boot', // 后端API地址
|
||||
baseURL: 'http://43.138.83.20:10002/jeecg-boot', // 后端API地址
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
@ -375,6 +375,24 @@ const getRandomColor = () => {
|
||||
return colors[Math.floor(Math.random() * colors.length)]
|
||||
}
|
||||
|
||||
// 获取文件访问URL的工具函数
|
||||
const getFileAccessHttpUrl = (path: string) => {
|
||||
if (!path) return ''
|
||||
|
||||
// 如果已经是完整的HTTP URL或blob URL,直接返回
|
||||
if (path.startsWith('http://') || path.startsWith('https://') || path.startsWith('blob:')) {
|
||||
return path
|
||||
}
|
||||
|
||||
// 如果是相对路径,转换为静态资源URL
|
||||
if (path.startsWith('/')) {
|
||||
return `http://43.138.83.20:10002/jeecg-boot/sys/common/static${path}`
|
||||
}
|
||||
|
||||
// 为产品图片添加默认路径
|
||||
return `http://43.138.83.20:10002/jeecg-boot/sys/common/static/${path}`
|
||||
}
|
||||
|
||||
// 方法
|
||||
const openMediaGallery = (type: string) => {
|
||||
currentMediaType.value = type
|
||||
|
@ -1022,7 +1022,7 @@ const getFileAccessHttpUrl = (filePath: string) => {
|
||||
}
|
||||
|
||||
// 处理相对路径,转换为完整的静态资源访问路径
|
||||
const baseUrl = 'http://localhost:8080/jeecg-boot/sys/common/static/'
|
||||
const baseUrl = 'http://43.138.83.20:10002/jeecg-boot/sys/common/static/'
|
||||
|
||||
// 移除开头的斜杠(如果有)
|
||||
let cleanPath = filePath.startsWith('/') ? filePath.substring(1) : filePath
|
||||
|
@ -586,7 +586,7 @@ const getFileAccessHttpUrl = (filePath: string) => {
|
||||
}
|
||||
|
||||
// 处理相对路径,转换为完整的静态资源访问路径
|
||||
const baseUrl = 'http://localhost:8080/jeecg-boot/sys/common/static/'
|
||||
const baseUrl = 'http://43.138.83.20:10002/jeecg-boot/sys/common/static/'
|
||||
|
||||
// 移除开头的斜杠(如果有)
|
||||
let cleanPath = filePath.startsWith('/') ? filePath.substring(1) : filePath
|
||||
|
@ -317,11 +317,11 @@ const getFileAccessHttpUrl = (path: string) => {
|
||||
|
||||
// 如果是相对路径,转换为静态资源URL
|
||||
if (path.startsWith('/')) {
|
||||
return `http://localhost:8080/jeecg-boot/sys/common/static${path}`
|
||||
return `http://43.138.83.20:10002/jeecg-boot/sys/common/static${path}`
|
||||
}
|
||||
|
||||
// 为产品图片添加默认路径
|
||||
return `http://localhost:8080/jeecg-boot/sys/common/static/${path}`
|
||||
return `http://43.138.83.20:10002/jeecg-boot/sys/common/static/${path}`
|
||||
}
|
||||
|
||||
// 图片加载错误处理
|
||||
|
Loading…
Reference in New Issue
Block a user