diff --git a/scripts/uploadAssets2volOSS.ts b/scripts/uploadAssets2volOSS.ts index ef8460e..48cdb1d 100644 --- a/scripts/uploadAssets2volOSS.ts +++ b/scripts/uploadAssets2volOSS.ts @@ -8,6 +8,7 @@ import { TosClient } from '@volcengine/tos-sdk'; import * as fs from 'fs'; import * as path from 'path'; +import { fileURLToPath } from 'url'; // 配置信息 @@ -97,15 +98,15 @@ async function uploadDirectory(dirPath: string): Promise { try { const basePath = path.resolve(dirPath, '..'); const allFiles = await getAllFiles(dirPath); - + console.log(`找到 ${allFiles.length} 个文件需要上传`); - + // 创建上传任务队列 const uploadTasks = allFiles.map(filePath => uploadFile(filePath, basePath)); - + // 并发上传文件 await Promise.all(uploadTasks); - + console.log('所有文件上传完成'); } catch (error) { console.error('上传目录失败:', error); @@ -114,11 +115,10 @@ async function uploadDirectory(dirPath: string): Promise { // 主函数 async function main() { - // 使用 import.meta.url 替代 __dirname (ES 模块兼容) - const currentFileUrl = import.meta.url; - const currentFilePath = new URL(currentFileUrl).pathname; - const currentDir = path.dirname(currentFilePath); - const assetsDir = path.resolve(currentDir, '../dist/assets'); + // ES 模块中获取当前文件目录的正确方式 + const __filename = fileURLToPath(import.meta.url); + const __dirname = path.dirname(__filename); + const assetsDir = path.resolve(__dirname, '../dist/assets'); console.log(`开始上传目录: ${assetsDir}`); await uploadDirectory(assetsDir); } @@ -128,4 +128,3 @@ main().catch(error => { console.error('程序执行失败:', error); process.exit(1); }); - diff --git a/src/components/Aboutus.vue b/src/components/Aboutus.vue index 2c49ab6..d4b9196 100644 --- a/src/components/Aboutus.vue +++ b/src/components/Aboutus.vue @@ -142,7 +142,51 @@ const { breakpoint } = useBootstrapBreakpoint(); diff --git a/src/components/Examples.vue b/src/components/Examples.vue index 8ca43f3..686899a 100644 --- a/src/components/Examples.vue +++ b/src/components/Examples.vue @@ -11,9 +11,6 @@ const { breakpoint } = useBootstrapBreakpoint();