fix(mini-program): 修复 logo.svg 500 错误

问题:
- 小程序请求 /static/logo.svg 返回 500 错误
- logo.svg 文件在 src/static/ 目录,但编译后未被复制到输出目录

修复:
1. 在 mini-program/ 根目录创建 static/ 目录
2. 将 logo.svg 复制到 mini-program/static/logo.svg
3. 修改 vite.config.js 添加 publicDir 配置,让 Vite 复制 static 目录
4. 更新图片路径:/static/logo.svg → /logo.svg
   - pages/splash/index.vue
   - pages/main/index.vue

效果:
- logo.svg 正确编译到 unpackage/dist/dev/mp-weixin/logo.svg
- 小程序正常加载 logo 图片
- 不再出现 500 错误
This commit is contained in:
2026-04-07 23:39:12 +08:00
parent b6bf97bc36
commit fbf76611d1
4 changed files with 76 additions and 2 deletions
+1 -1
View File
@@ -28,7 +28,7 @@
<view class="header" :style="{ paddingTop: safeAreaTop + 20 + 'px' }">
<view class="header-left">
<view class="logo-box">
<image class="logo" src="/static/logo.svg" mode="aspectFit" />
<image class="logo" src="/logo.svg" mode="aspectFit" />
</view>
<view class="brand">
<text class="brand-title font-serif">人生 OS</text>
+7 -1
View File
@@ -7,7 +7,7 @@
<view class="overlay">
<view class="status-bar-space" :style="{ height: statusBarHeight + 'px' }"></view>
<view class="content-area" :style="{ paddingBottom: safeAreaBottom + 'px' }">
<image class="logo" src="/static/logo.svg" mode="widthFix"></image>
<image class="logo" src="/logo.svg" mode="widthFix"></image>
<text class="app-name font-serif">人生OS</text>
<text class="app-version">LIFE HARMONY v3.1</text>
</view>
@@ -52,6 +52,12 @@ onLoad(() => {
min-height: 100vh;
height: 100vh;
background: linear-gradient(180deg, #0F071A 0%, #1A0B2E 50%, #0F071A 100%);
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* 标题字体 - Cinzel (原型标准) */
.app-name.font-serif {
font-family: 'Cinzel', 'Inter', serif;
}
.status-bar-space {
+67
View File
@@ -0,0 +1,67 @@
<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
<defs>
<!-- 主渐变:使用项目主题色 -->
<linearGradient id="bgGradient" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#A855F7;stop-opacity:1" />
<stop offset="50%" style="stop-color:#9333EA;stop-opacity:1" />
<stop offset="100%" style="stop-color:#7C3AED;stop-opacity:1" />
</linearGradient>
<!-- 柱廊渐变 -->
<linearGradient id="pillarGradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" style="stop-color:#C084FC;stop-opacity:0.9" />
<stop offset="100%" style="stop-color:#A855F7;stop-opacity:0.7" />
</linearGradient>
<!-- 核心发光渐变 -->
<radialGradient id="coreGlow" cx="50%" cy="50%" r="50%">
<stop offset="0%" style="stop-color:#E879F9;stop-opacity:1" />
<stop offset="50%" style="stop-color:#A855F7;stop-opacity:0.8" />
<stop offset="100%" style="stop-color:#A855F7;stop-opacity:0" />
</radialGradient>
<!-- 发光滤镜 -->
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feGaussianBlur stdDeviation="15" result="coloredBlur"/>
<feMerge>
<feMergeNode in="coloredBlur"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</defs>
<!-- 背景圆角正方形 -->
<rect x="40" y="40" width="944" height="944" rx="200" fill="url(#bgGradient)"/>
<!-- 背景光晕 -->
<circle cx="512" cy="512" r="300" fill="url(#coreGlow)" opacity="0.5"/>
<!-- 神殿柱廊:三根柱子 -->
<!-- 左柱 -->
<rect x="280" y="320" width="60" height="384" rx="30" fill="url(#pillarGradient)" filter="url(#glow)"/>
<!-- 中柱 -->
<rect x="482" y="280" width="60" height="464" rx="30" fill="url(#pillarGradient)" filter="url(#glow)"/>
<!-- 右柱 -->
<rect x="684" y="320" width="60" height="384" rx="30" fill="url(#pillarGradient)" filter="url(#glow)"/>
<!-- 柱顶横梁 -->
<path d="M240 300 L784 300 L784 340 L240 340 Z" fill="url(#pillarGradient)" opacity="0.8"/>
<!-- 中心情绪核心:发光的椭圆 -->
<ellipse cx="512" cy="540" rx="80" ry="100" fill="white" filter="url(#glow)" opacity="0.95"/>
<ellipse cx="512" cy="540" rx="50" ry="70" fill="url(#coreGlow)" filter="url(#glow)"/>
<!-- 顶部星芒:呼应星海概念 -->
<path d="M512 180 L524 220 L564 220 L532 244 L544 284 L512 260 L480 284 L492 244 L460 220 L500 220 Z"
fill="#E879F9" filter="url(#glow)"/>
<!-- 底部装饰弧线 -->
<path d="M320 780 Q512 840 704 780" stroke="#C084FC" stroke-width="6" stroke-linecap="round" fill="none" opacity="0.6"/>
<path d="M360 820 Q512 860 664 820" stroke="#C084FC" stroke-width="4" stroke-linecap="round" fill="none" opacity="0.4"/>
<!-- 四角装饰:星光点缀 -->
<circle cx="160" cy="160" r="8" fill="#C084FC" filter="url(#glow)" opacity="0.8"/>
<circle cx="864" cy="160" r="8" fill="#C084FC" filter="url(#glow)" opacity="0.8"/>
<circle cx="160" cy="864" r="8" fill="#C084FC" filter="url(#glow)" opacity="0.8"/>
<circle cx="864" cy="864" r="8" fill="#C084FC" filter="url(#glow)" opacity="0.8"/>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

+1
View File
@@ -36,6 +36,7 @@ export default defineConfig(({ command }) => {
: 'dist'
return {
envDir: __dirname,
publicDir: resolve(__dirname, 'static'),
server: {
watch: {
usePolling: true,