diff --git a/components.d.ts b/components.d.ts index cda9eef..e7d88d3 100644 --- a/components.d.ts +++ b/components.d.ts @@ -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'] } } diff --git a/src/api/index.ts b/src/api/index.ts index 5503436..036077a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -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' diff --git a/src/views/Culture.vue b/src/views/Culture.vue index 8324755..bfe1200 100644 --- a/src/views/Culture.vue +++ b/src/views/Culture.vue @@ -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 diff --git a/src/views/Heritage.vue b/src/views/Heritage.vue index 060b6e4..3be0791 100644 --- a/src/views/Heritage.vue +++ b/src/views/Heritage.vue @@ -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 diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index 9dc791e..c6ae40a 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -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 diff --git a/src/views/Products.vue b/src/views/Products.vue index c7f7e77..94840ca 100644 --- a/src/views/Products.vue +++ b/src/views/Products.vue @@ -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}` } // 图片加载错误处理