fix(avatar): bundle uni bridge and add favicon

This commit is contained in:
stefanfeng
2026-08-25 17:19:30 +08:00
parent e24e89d326
commit 4029c31ed7
6 changed files with 28 additions and 2 deletions
+1 -2
View File
@@ -7,8 +7,7 @@
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
/>
<title>会会数字分身</title>
<!-- uniapp web-view 桥接:加载后全局出现 window.uni.webView,H5 才能与原生壳通信 -->
<script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.10/index.js"></script>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<!-- 混合架构部署配置:web-view 内请把 apiBase 设为后端公网地址(如 'https://geo.99hui.com/api')。
留空则回退为 '/api'(开发态由 Vite 代理到 :8000)。 -->
<script type="text/javascript">
+7
View File
@@ -8,6 +8,7 @@
"name": "digital-avatar-app",
"version": "1.0.0",
"dependencies": {
"@dcloudio/uni-webview-js": "^0.0.3",
"axios": "^1.6.0",
"pinia": "^2.1.0",
"vue": "^3.3.0",
@@ -66,6 +67,12 @@
"node": ">=6.9.0"
}
},
"node_modules/@dcloudio/uni-webview-js": {
"version": "0.0.3",
"resolved": "https://registry.npmmirror.com/@dcloudio/uni-webview-js/-/uni-webview-js-0.0.3.tgz",
"integrity": "sha512-3XDnLXg22QKC/aTLtGim6zbOK+euiDYoRf98BjGDE0lqMm1U4SLFHAvOlAHa0qck91phaceKwo73ScQQgSojQg==",
"license": "Apache-2.0"
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.21.5",
"resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
+1
View File
@@ -9,6 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@dcloudio/uni-webview-js": "^0.0.3",
"axios": "^1.6.0",
"pinia": "^2.1.0",
"vue": "^3.3.0",
+11
View File
@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<defs>
<linearGradient id="avatar-gradient" x1="8" y1="8" x2="56" y2="56" gradientUnits="userSpaceOnUse">
<stop stop-color="#fb923c"/>
<stop offset="1" stop-color="#f97316"/>
</linearGradient>
</defs>
<rect width="64" height="64" rx="16" fill="url(#avatar-gradient)"/>
<circle cx="32" cy="24" r="10" fill="#fff"/>
<path d="M15 52c1.8-10 8-15 17-15s15.2 5 17 15" fill="#fff"/>
</svg>

After

Width:  |  Height:  |  Size: 474 B

+4
View File
@@ -1,4 +1,5 @@
import { createApp } from 'vue'
import uniWebView from '@dcloudio/uni-webview-js'
import App from './App.vue'
import router from './router'
import pinia from './store'
@@ -7,6 +8,9 @@ import { useAvatarStore } from '@/store/avatar'
import { useUserStore } from '@/store/user'
import { setAuthToken } from '@/api'
// Bundle the bridge locally so the H5 does not depend on an external CDN.
;(window as any).uni = (window as any).uni || uniWebView
const app = createApp(App)
app.use(router)
app.use(pinia)
+4
View File
@@ -0,0 +1,4 @@
declare module '@dcloudio/uni-webview-js' {
const uniWebView: unknown
export default uniWebView
}