diff --git a/src/components/AlbumGallery.vue b/src/components/AlbumGallery.vue index 61fe8fd..556bd23 100644 --- a/src/components/AlbumGallery.vue +++ b/src/components/AlbumGallery.vue @@ -72,7 +72,8 @@ const thumbnails = ref({}) // 存储压缩后的 Blob URL let observer = null let imageObserver = null -const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +// const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +const getImgUrl = (path) => path ? `/t-oss${path}` : '' // --- 核心优化:浏览器端 Canvas 压缩 --- // 目的:虽然网络流量没变(还是下载了原图),但渲染到 DOM 上的是 resizing 后的 canvas blob, diff --git a/src/components/CinematicSlideshow.vue b/src/components/CinematicSlideshow.vue index 6757499..e608410 100644 --- a/src/components/CinematicSlideshow.vue +++ b/src/components/CinematicSlideshow.vue @@ -194,7 +194,8 @@ const getCurrentAnimationClass = (index) => { return 'anim-ken-burns-4' } -const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +// const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +const getImgUrl = (path) => path ? `/t-oss${path}` : '' const formatNumber = (num) => num < 10 ? `0${num}` : num const formatDate = (dateStr) => { if(!dateStr) return '' diff --git a/src/components/PhotoPlanet.vue b/src/components/PhotoPlanet.vue index 338fe16..7609aa2 100644 --- a/src/components/PhotoPlanet.vue +++ b/src/components/PhotoPlanet.vue @@ -78,7 +78,8 @@ let animationId let photoMeshes = [] let particleSystem -const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +// const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +const getImgUrl = (path) => path ? `/t-oss${path}` : '' // --- 核心优化:图片压缩与纹理生成 (带 CORS 代理回退) --- const createCompressedTexture = (originalUrl) => { diff --git a/src/components/PhotoWall.vue b/src/components/PhotoWall.vue index 4485467..146e7dc 100644 --- a/src/components/PhotoWall.vue +++ b/src/components/PhotoWall.vue @@ -69,7 +69,8 @@ const emit = defineEmits(['loadMore']) const loadTrigger = ref(null) let observer = null -const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +// const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +const getImgUrl = (path) => path ? `/t-oss${path}` : '' const formatDate = (dateStr) => { if (!dateStr) return 'Unknown Date' diff --git a/src/components/SwipeSlideshow.vue b/src/components/SwipeSlideshow.vue index 6098c38..035876d 100644 --- a/src/components/SwipeSlideshow.vue +++ b/src/components/SwipeSlideshow.vue @@ -144,7 +144,8 @@ const showToolbar = ref(true) const showSettings = ref(false) let toolbarTimer = null -const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +// const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +const getImgUrl = (path) => path ? `/t-oss${path}` : '' const onSlideChange = (swiper) => { currentIndex.value = swiper.activeIndex diff --git a/src/views/index/index.vue b/src/views/index/index.vue index e28307f..19f4a8d 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -242,7 +242,8 @@ const loading = ref(true) const viewMode = ref('grid') // 'grid' | 'list' | 'timeline' | 'stack' | 'coverflow' const swiperModules = [EffectCoverflow, EffectCards, Pagination] -const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +// const getImgUrl = (path) => path ? `http://i.nailaoyun.cn${path}` : '' +const getImgUrl = (path) => path ? `/t-oss${path}` : '' const getList = async () => { loading.value = true diff --git a/vite.config.js b/vite.config.js index fb095c2..299bdf4 100644 --- a/vite.config.js +++ b/vite.config.js @@ -23,6 +23,11 @@ export default defineConfig({ target: 'http://i.nailaoyun.cn/api/', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '') + }, + '/t-oss': { + target: 'http://i.nailaoyun.cn/', + changeOrigin: true, + rewrite: (path) => path.replace(/^\/t-oss/, '') } } }