Просмотр исходного кода

build: 调整静态资源路径与API配置

1. 修正预览图片生成脚本的输出路径,将预览图输出到public目录
2. 更新dist/index.html中的资源引用文件名
3. 优化API基础地址配置,支持通过环境变量覆盖并修复混合内容问题
4. 将tif格式源文件加入gitignore
wenhongquan 1 месяц назад
Родитель
Сommit
585d30415c

+ 1 - 0
.gitignore

@@ -19,3 +19,4 @@ docs/
 # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
 # should NOT be excluded as they contain compiler settings and other important
 # information for Eclipse / Flash Builder.
+de99928f1689454084d1af33ec3cc155.tif

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/assets/index-tOdE2X96.js


BIN
dist/de99928f-preview.png


+ 1 - 1
dist/index.html

@@ -7,7 +7,7 @@
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>3D 大屏 - 倾斜摄影</title>
-    <script type="module" crossorigin src="/assets/index-DCNMMEJK.js"></script>
+    <script type="module" crossorigin src="/assets/index-tOdE2X96.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-Co3HZtGW.css">
   </head>
   <body>

BIN
public/de99928f-preview.png


+ 1 - 1
scripts/gen-preview.cjs

@@ -5,7 +5,7 @@ const path = require('path')
 
 async function main() {
   const tiffPath = path.resolve(__dirname, '../de99928f1689454084d1af33ec3cc155.tif')
-  const outPath = path.resolve(__dirname, '../de99928f-preview.png')
+  const outPath = path.resolve(__dirname, '../public/de99928f-preview.png')
 
   if (!fs.existsSync(tiffPath)) {
     console.error('TIFF not found:', tiffPath)

+ 9 - 3
src/config.js

@@ -1,10 +1,16 @@
 // 全局配置文件
 export const config = {
-  // API 基础地址(自动根据浏览器访问地址获取)
+  // API 基础地址
+  // 1. 优先读取环境变量 VITE_API_BASE_URL,方便通过反向代理或 HTTPS 部署时覆盖
+  // 2. 默认根据当前页面协议动态拼接,避免 HTTPS 页面请求 HTTP API 被浏览器拦截(mixed content)
   get baseUrl() {
-    return `http://59.32.228.147:81`
+    const defaultHost = '59.32.228.147:81'
+    if (import.meta.env?.VITE_API_BASE_URL) {
+      return import.meta.env.VITE_API_BASE_URL
+    }
+    return `${window.location.protocol}//${defaultHost}`
   },
-  
+
   // 用户密钥
   userKey: 'b01a6a38926a47c2b55fc364b9afeccd',
   

Некоторые файлы не были показаны из-за большого количества измененных файлов