diff --git a/android/app/build.gradle b/android/app/build.gradle index f311b66..67132d2 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -8,7 +8,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "1.0" + versionName "1.0.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/android/app/src/main/res/drawable-land-hdpi/splash.png b/android/app/src/main/res/drawable-land-hdpi/splash.png index e31573b..1aeb85c 100644 Binary files a/android/app/src/main/res/drawable-land-hdpi/splash.png and b/android/app/src/main/res/drawable-land-hdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-land-mdpi/splash.png b/android/app/src/main/res/drawable-land-mdpi/splash.png index f7a6492..7d3db8c 100644 Binary files a/android/app/src/main/res/drawable-land-mdpi/splash.png and b/android/app/src/main/res/drawable-land-mdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-land-xhdpi/splash.png b/android/app/src/main/res/drawable-land-xhdpi/splash.png index 8077255..6d594e8 100644 Binary files a/android/app/src/main/res/drawable-land-xhdpi/splash.png and b/android/app/src/main/res/drawable-land-xhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-land-xxhdpi/splash.png b/android/app/src/main/res/drawable-land-xxhdpi/splash.png index 14c6c8f..6dee023 100644 Binary files a/android/app/src/main/res/drawable-land-xxhdpi/splash.png and b/android/app/src/main/res/drawable-land-xxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-land-xxxhdpi/splash.png b/android/app/src/main/res/drawable-land-xxxhdpi/splash.png index 244ca25..c8efae7 100644 Binary files a/android/app/src/main/res/drawable-land-xxxhdpi/splash.png and b/android/app/src/main/res/drawable-land-xxxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-hdpi/splash.png b/android/app/src/main/res/drawable-port-hdpi/splash.png index 74faaa5..a452219 100644 Binary files a/android/app/src/main/res/drawable-port-hdpi/splash.png and b/android/app/src/main/res/drawable-port-hdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-mdpi/splash.png b/android/app/src/main/res/drawable-port-mdpi/splash.png index e944f4a..c7ff2b2 100644 Binary files a/android/app/src/main/res/drawable-port-mdpi/splash.png and b/android/app/src/main/res/drawable-port-mdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-xhdpi/splash.png b/android/app/src/main/res/drawable-port-xhdpi/splash.png index 564a82f..2c6ed75 100644 Binary files a/android/app/src/main/res/drawable-port-xhdpi/splash.png and b/android/app/src/main/res/drawable-port-xhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-xxhdpi/splash.png b/android/app/src/main/res/drawable-port-xxhdpi/splash.png index bfabe68..88179e9 100644 Binary files a/android/app/src/main/res/drawable-port-xxhdpi/splash.png and b/android/app/src/main/res/drawable-port-xxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-port-xxxhdpi/splash.png b/android/app/src/main/res/drawable-port-xxxhdpi/splash.png index 6929071..ae9fb5f 100644 Binary files a/android/app/src/main/res/drawable-port-xxxhdpi/splash.png and b/android/app/src/main/res/drawable-port-xxxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable/splash.png b/android/app/src/main/res/drawable/splash.png index f7a6492..7d3db8c 100644 Binary files a/android/app/src/main/res/drawable/splash.png and b/android/app/src/main/res/drawable/splash.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index c023e50..3005913 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png index 2127973..11d2f3c 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index b441f37..783eb9c 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 72905b8..e49b2ae 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png index 8ed0605..e683051 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index 9502e47..4dcb6d5 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 4d1e077..bcc7296 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png index df0f158..e69e4ec 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index 853db04..9bc3b43 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 6cdf97c..99a0533 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png index 2960cbb..e2a4e51 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index 8e3093a..df89b9a 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 46de6e2..7edfb16 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png index d2ea9ab..92eb0a7 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index a40d73e..60c9e33 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/values/ic_launcher_background.xml b/android/app/src/main/res/values/ic_launcher_background.xml index c5d5899..19ea7fc 100644 --- a/android/app/src/main/res/values/ic_launcher_background.xml +++ b/android/app/src/main/res/values/ic_launcher_background.xml @@ -1,4 +1,4 @@ - #FFFFFF + #0F766E \ No newline at end of file diff --git a/capacitor.config.ts b/capacitor.config.ts index 455940e..3e6b27c 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -1,6 +1,12 @@ import type { CapacitorConfig } from "@capacitor/cli"; -const updateUrl = process.env.CAPACITOR_UPDATE_URL; +/** + * 热更新检查接口 + * + * 默认指向生产,可用 CAPACITOR_UPDATE_URL 覆盖后指向本地服务调试 + * 更新时机由应用内控制(设置页手动检查或用户开启自动检查),插件本身不主动拉取 + */ +const updateUrl = process.env.CAPACITOR_UPDATE_URL ?? "https://api.imyeyu.com/app/update/check"; if (updateUrl && !updateUrl.startsWith("https://")) { throw new Error("热更新接口必须使用 HTTPS"); } @@ -11,8 +17,8 @@ const config: CapacitorConfig = { webDir: "dist", plugins: { CapacitorUpdater: { - autoUpdate: updateUrl ? "atBackground" : false, - ...(updateUrl ? { updateUrl } : {}), + autoUpdate: false, + updateUrl, statsUrl: "" } } diff --git a/package.json b/package.json index 67a615f..959cae7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gao-customer-h5", "private": true, - "version": "1.0.0", + "version": "1.0.1", "type": "module", "scripts": { "dev": "vite --host", @@ -54,6 +54,7 @@ "@vue/tsconfig": "^0.7.0", "eslint": "9.26.0", "eslint-plugin-vue": "^9.33.0", + "sharp": "^0.35.5", "typescript": "~5.8.3", "unplugin-auto-import": "^19.1.1", "unplugin-vue-components": "^28.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1e95d00..3ae5af6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -113,6 +113,9 @@ importers: eslint-plugin-vue: specifier: ^9.33.0 version: 9.33.0(eslint@9.26.0) + sharp: + specifier: ^0.35.5 + version: 0.35.5(@types/node@24.13.3) typescript: specifier: ~5.8.3 version: 5.8.3 @@ -214,6 +217,9 @@ packages: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} + '@emnapi/runtime@1.11.3': + resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==} + '@emotion/babel-plugin@11.13.5': resolution: {integrity: sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==} @@ -473,6 +479,168 @@ packages: resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} engines: {node: '>=18.18'} + '@img/colour@1.1.0': + resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==} + engines: {node: '>=18'} + + '@img/sharp-darwin-arm64@0.35.5': + resolution: {integrity: sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [darwin] + + '@img/sharp-darwin-x64@0.35.5': + resolution: {integrity: sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [darwin] + + '@img/sharp-freebsd-wasm32@0.35.5': + resolution: {integrity: sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==} + engines: {node: '>=20.9.0'} + os: [freebsd] + + '@img/sharp-libvips-darwin-arm64@1.3.4': + resolution: {integrity: sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==} + cpu: [arm64] + os: [darwin] + + '@img/sharp-libvips-darwin-x64@1.3.4': + resolution: {integrity: sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==} + cpu: [x64] + os: [darwin] + + '@img/sharp-libvips-linux-arm64@1.3.4': + resolution: {integrity: sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-arm@1.3.4': + resolution: {integrity: sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==} + cpu: [arm] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-ppc64@1.3.4': + resolution: {integrity: sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-riscv64@1.3.4': + resolution: {integrity: sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-s390x@1.3.4': + resolution: {integrity: sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linux-x64@1.3.4': + resolution: {integrity: sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@img/sharp-libvips-linuxmusl-arm64@1.3.4': + resolution: {integrity: sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@img/sharp-libvips-linuxmusl-x64@1.3.4': + resolution: {integrity: sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@img/sharp-linux-arm64@0.35.5': + resolution: {integrity: sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-arm@0.35.5': + resolution: {integrity: sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==} + engines: {node: '>=20.9.0'} + cpu: [arm] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-ppc64@0.35.5': + resolution: {integrity: sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==} + engines: {node: '>=20.9.0'} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-riscv64@0.35.5': + resolution: {integrity: sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==} + engines: {node: '>=20.9.0'} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-s390x@0.35.5': + resolution: {integrity: sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==} + engines: {node: '>=20.9.0'} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@img/sharp-linux-x64@0.35.5': + resolution: {integrity: sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@img/sharp-linuxmusl-arm64@0.35.5': + resolution: {integrity: sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@img/sharp-linuxmusl-x64@0.35.5': + resolution: {integrity: sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@img/sharp-wasm32@0.35.5': + resolution: {integrity: sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==} + engines: {node: '>=20.9.0'} + + '@img/sharp-webcontainers-wasm32@0.35.5': + resolution: {integrity: sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==} + engines: {node: '>=20.9.0'} + cpu: [wasm32] + + '@img/sharp-win32-arm64@0.35.5': + resolution: {integrity: sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==} + engines: {node: '>=20.9.0'} + cpu: [arm64] + os: [win32] + + '@img/sharp-win32-ia32@0.35.5': + resolution: {integrity: sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==} + engines: {node: ^20.9.0} + cpu: [ia32] + os: [win32] + + '@img/sharp-win32-x64@0.35.5': + resolution: {integrity: sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==} + engines: {node: '>=20.9.0'} + cpu: [x64] + os: [win32] + '@ionic/cli-framework-output@2.2.8': resolution: {integrity: sha512-TshtaFQsovB4NWRBydbNFawql6yul7d5bMiW1WYYf17hd99V6xdDdk3vtF51bw6sLkxON3bDQpWsnUc9/hVo3g==} engines: {node: '>=16.0.0'} @@ -1437,6 +1605,10 @@ packages: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} engines: {node: '>= 0.8'} + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + diff@4.0.4: resolution: {integrity: sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==} engines: {node: '>=0.3.1'} @@ -2436,6 +2608,15 @@ packages: setprototypeof@1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + sharp@0.35.5: + resolution: {integrity: sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==} + engines: {node: '>=20.9.0'} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -3031,6 +3212,11 @@ snapshots: dependencies: '@jridgewell/trace-mapping': 0.3.9 + '@emnapi/runtime@1.11.3': + dependencies: + tslib: 2.9.1 + optional: true + '@emotion/babel-plugin@11.13.5': dependencies: '@babel/helper-module-imports': 7.29.7 @@ -3238,6 +3424,112 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} + '@img/colour@1.1.0': {} + + '@img/sharp-darwin-arm64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-darwin-arm64': 1.3.4 + optional: true + + '@img/sharp-darwin-x64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-darwin-x64': 1.3.4 + optional: true + + '@img/sharp-freebsd-wasm32@0.35.5': + dependencies: + '@img/sharp-wasm32': 0.35.5 + optional: true + + '@img/sharp-libvips-darwin-arm64@1.3.4': + optional: true + + '@img/sharp-libvips-darwin-x64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-arm64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-arm@1.3.4': + optional: true + + '@img/sharp-libvips-linux-ppc64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-riscv64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-s390x@1.3.4': + optional: true + + '@img/sharp-libvips-linux-x64@1.3.4': + optional: true + + '@img/sharp-libvips-linuxmusl-arm64@1.3.4': + optional: true + + '@img/sharp-libvips-linuxmusl-x64@1.3.4': + optional: true + + '@img/sharp-linux-arm64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm64': 1.3.4 + optional: true + + '@img/sharp-linux-arm@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm': 1.3.4 + optional: true + + '@img/sharp-linux-ppc64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-ppc64': 1.3.4 + optional: true + + '@img/sharp-linux-riscv64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-riscv64': 1.3.4 + optional: true + + '@img/sharp-linux-s390x@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-s390x': 1.3.4 + optional: true + + '@img/sharp-linux-x64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-x64': 1.3.4 + optional: true + + '@img/sharp-linuxmusl-arm64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-arm64': 1.3.4 + optional: true + + '@img/sharp-linuxmusl-x64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-x64': 1.3.4 + optional: true + + '@img/sharp-wasm32@0.35.5': + dependencies: + '@emnapi/runtime': 1.11.3 + optional: true + + '@img/sharp-webcontainers-wasm32@0.35.5': + dependencies: + '@img/sharp-wasm32': 0.35.5 + optional: true + + '@img/sharp-win32-arm64@0.35.5': + optional: true + + '@img/sharp-win32-ia32@0.35.5': + optional: true + + '@img/sharp-win32-x64@0.35.5': + optional: true + '@ionic/cli-framework-output@2.2.8': dependencies: '@ionic/utils-terminal': 2.3.5 @@ -4265,6 +4557,8 @@ snapshots: depd@2.0.0: {} + detect-libc@2.1.2: {} + diff@4.0.4: {} dunder-proto@1.0.1: @@ -5373,6 +5667,39 @@ snapshots: setprototypeof@1.2.0: {} + sharp@0.35.5(@types/node@24.13.3): + dependencies: + '@img/colour': 1.1.0 + detect-libc: 2.1.2 + semver: 7.8.5 + optionalDependencies: + '@img/sharp-darwin-arm64': 0.35.5 + '@img/sharp-darwin-x64': 0.35.5 + '@img/sharp-freebsd-wasm32': 0.35.5 + '@img/sharp-libvips-darwin-arm64': 1.3.4 + '@img/sharp-libvips-darwin-x64': 1.3.4 + '@img/sharp-libvips-linux-arm': 1.3.4 + '@img/sharp-libvips-linux-arm64': 1.3.4 + '@img/sharp-libvips-linux-ppc64': 1.3.4 + '@img/sharp-libvips-linux-riscv64': 1.3.4 + '@img/sharp-libvips-linux-s390x': 1.3.4 + '@img/sharp-libvips-linux-x64': 1.3.4 + '@img/sharp-libvips-linuxmusl-arm64': 1.3.4 + '@img/sharp-libvips-linuxmusl-x64': 1.3.4 + '@img/sharp-linux-arm': 0.35.5 + '@img/sharp-linux-arm64': 0.35.5 + '@img/sharp-linux-ppc64': 0.35.5 + '@img/sharp-linux-riscv64': 0.35.5 + '@img/sharp-linux-s390x': 0.35.5 + '@img/sharp-linux-x64': 0.35.5 + '@img/sharp-linuxmusl-arm64': 0.35.5 + '@img/sharp-linuxmusl-x64': 0.35.5 + '@img/sharp-webcontainers-wasm32': 0.35.5 + '@img/sharp-win32-arm64': 0.35.5 + '@img/sharp-win32-ia32': 0.35.5 + '@img/sharp-win32-x64': 0.35.5 + '@types/node': 24.13.3 + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 diff --git a/scripts/generate-android-icons.mjs b/scripts/generate-android-icons.mjs new file mode 100644 index 0000000..ac0dea1 --- /dev/null +++ b/scripts/generate-android-icons.mjs @@ -0,0 +1,95 @@ +/** + * 从 public/icons/icon-512.png 生成 Android 各密度的启动图标 + * + * 传统图标用完整图,圆形图标裁圆,自适应前景留 10% 余量避免被系统裁切 + * + * 运行:node scripts/generate-android-icons.mjs + */ +import sharp from "sharp"; + +const SOURCE = "public/icons/icon-512.png"; +const RES = "android/app/src/main/res"; + +/** 传统图标边长 */ +const LEGACY = { mdpi: 48, hdpi: 72, xhdpi: 96, xxhdpi: 144, xxxhdpi: 192 }; + +/** 自适应前景边长,108dp 基准 */ +const FOREGROUND = { mdpi: 108, hdpi: 162, xhdpi: 216, xxhdpi: 324, xxxhdpi: 432 }; + +/** 前景内容占画布的比例,低于安全区 66.7%,留余量 */ +const FOREGROUND_RATIO = 0.9; + +const { data } = await sharp(SOURCE).raw().toBuffer({ resolveWithObject: true }); +const hex = `#${[data[0], data[1], data[2]].map(v => v.toString(16).padStart(2, "0")).join("")}`; +console.log(`图标底色:${hex}`); + +for (const [density, size] of Object.entries(LEGACY)) { + const dir = `${RES}/mipmap-${density}`; + await sharp(SOURCE).resize(size, size, { fit: "cover" }).png().toFile(`${dir}/ic_launcher.png`); + + const circle = Buffer.from( + `` + ); + await sharp(SOURCE) + .resize(size, size, { fit: "cover" }) + .composite([{ input: circle, blend: "dest-in" }]) + .png() + .toFile(`${dir}/ic_launcher_round.png`); + + console.log(`${density}: 传统 ${size},圆形 ${size}`); +} + +for (const [density, size] of Object.entries(FOREGROUND)) { + const inner = Math.round(size * FOREGROUND_RATIO); + const offset = Math.round((size - inner) / 2); + const scaled = await sharp(SOURCE).resize(inner, inner, { fit: "cover" }).png().toBuffer(); + await sharp({ + create: { width: size, height: size, channels: 4, background: { r: 0, g: 0, b: 0, alpha: 0 } } + }) + .composite([{ input: scaled, top: offset, left: offset }]) + .png() + .toFile(`${RES}/mipmap-${density}/ic_launcher_foreground.png`); + + console.log(`${density}: 前景 ${size}(内容 ${inner})`); +} + +/** + * 启动图尺寸,背景铺图标底色,中间放 logo + * + * 键为 drawable 目录名,值为画布宽高 + */ +const SPLASH = { + "drawable": [480, 320], + "drawable-land-mdpi": [480, 320], + "drawable-land-hdpi": [800, 480], + "drawable-land-xhdpi": [1280, 720], + "drawable-land-xxhdpi": [1600, 960], + "drawable-land-xxxhdpi": [1920, 1280], + "drawable-port-mdpi": [320, 480], + "drawable-port-hdpi": [480, 800], + "drawable-port-xhdpi": [720, 1280], + "drawable-port-xxhdpi": [960, 1600], + "drawable-port-xxxhdpi": [1280, 1920] +}; + +/** logo 占短边的比例 */ +const SPLASH_LOGO_RATIO = 0.28; + +for (const [dir, [width, height]] of Object.entries(SPLASH)) { + const logo = Math.round(Math.min(width, height) * SPLASH_LOGO_RATIO); + const scaled = await sharp(SOURCE).resize(logo, logo, { fit: "cover" }).png().toBuffer(); + await sharp({ + create: { width, height, channels: 3, background: { r: data[0], g: data[1], b: data[2] } } + }) + .composite([{ + input: scaled, + top: Math.round((height - logo) / 2), + left: Math.round((width - logo) / 2) + }]) + .png() + .toFile(`${RES}/${dir}/splash.png`); + + console.log(`${dir}: ${width}x${height},logo ${logo}`); +} + +console.log("完成"); diff --git a/src/components/CodeScanner.vue b/src/components/CodeScanner.vue index b7063e1..ae715ea 100644 --- a/src/components/CodeScanner.vue +++ b/src/components/CodeScanner.vue @@ -309,6 +309,31 @@ function updateOverlay(result: Result): void { drawOverlay(); } +/** 根据摄像头支持的模式启用自动对焦。 */ +async function enableAutoFocus(video: HTMLVideoElement): Promise { + const stream = video.srcObject; + if (!(stream instanceof MediaStream)) { + return; + } + + const track = stream.getVideoTracks()[0]; + if (!track || typeof track.getCapabilities !== "function") { + return; + } + + try { + const capabilities = track.getCapabilities() as MediaTrackCapabilities & { focusMode?: string[] }; + const focusMode = capabilities.focusMode?.includes("continuous") + ? "continuous" + : capabilities.focusMode?.includes("single-shot") ? "single-shot" : undefined; + if (focusMode) { + await track.applyConstraints({ advanced: [{ focusMode } as MediaTrackConstraintSet] }); + } + } catch { + // 不支持对焦控制时继续使用摄像头默认设置。 + } +} + async function startScanner(): Promise { if (!props.visible) { return; @@ -329,6 +354,7 @@ async function startScanner(): Promise { return; } + const video = scannerVideoRef.value; syncCanvasSize(); try { scannerControls.value = await scannerReader.decodeFromConstraints({ @@ -338,7 +364,7 @@ async function startScanner(): Promise { ideal: "environment" } } - }, scannerVideoRef.value, (result, error) => { + }, video, (result, error) => { if (result) { updateOverlay(result); clearOverlay(900); @@ -362,6 +388,7 @@ async function startScanner(): Promise { clearOverlay(); } }); + await enableAutoFocus(video); } catch { updateStatus(props.permissionDeniedText); } diff --git a/src/composables/useAppUpdate.ts b/src/composables/useAppUpdate.ts new file mode 100644 index 0000000..7564f95 --- /dev/null +++ b/src/composables/useAppUpdate.ts @@ -0,0 +1,148 @@ +import { Capacitor } from "@capacitor/core"; +import { CapacitorUpdater, type BundleInfo, type LatestVersion } from "@capgo/capacitor-updater"; +import { ref } from "vue"; + +/** 自动检查更新的存储键 */ +export const AUTO_UPDATE_KEY = "app.autoUpdate"; + +/** + * 应用热更新 + * + * 只在原生环境可用,Web 端调用会得到 supported = false + * + * 下载完成后调用 next 排队,下次切后台或重启自动生效,不打断当前操作 + */ +export function useAppUpdate() { + const supported = Capacitor.isNativePlatform(); + const currentVersion = ref(""); + const nativeVersion = ref(""); + const latest = ref(null); + const checking = ref(false); + const downloading = ref(false); + const percent = ref(0); + const ready = ref(null); + const error = ref(""); + + /** 读取当前运行的 Web 包版本与原生壳版本 */ + async function loadCurrent(): Promise { + if (!supported) { + return; + } + try { + const result = await CapacitorUpdater.current(); + currentVersion.value = result.bundle?.version ?? "builtin"; + nativeVersion.value = result.native ?? ""; + } catch { + currentVersion.value = ""; + nativeVersion.value = ""; + } + } + + /** 查询服务端最新版本 */ + async function check(): Promise { + if (!supported) { + error.value = "仅在 App 内可用"; + return null; + } + checking.value = true; + error.value = ""; + try { + const result = await CapacitorUpdater.getLatest(); + latest.value = result; + return result; + } catch (e) { + error.value = e instanceof Error ? e.message : "检查更新失败"; + return null; + } finally { + checking.value = false; + } + } + + /** 是否发现新版本 */ + function hasUpdate(): boolean { + const target = latest.value; + return Boolean(target?.url) && target?.version !== currentVersion.value; + } + + /** 下载最新版本并排队等待生效 */ + async function download(): Promise { + const target = latest.value; + if (!target?.url) { + error.value = "没有可下载的版本"; + return null; + } + downloading.value = true; + percent.value = 0; + error.value = ""; + const listener = await CapacitorUpdater.addListener("download", info => { + percent.value = info.percent; + }); + try { + const bundle = await CapacitorUpdater.download({ + url: target.url, + version: target.version, + checksum: target.checksum, + sessionKey: target.sessionKey + }); + await CapacitorUpdater.next({ id: bundle.id }); + ready.value = bundle; + return bundle; + } catch (e) { + error.value = e instanceof Error ? e.message : "下载失败"; + return null; + } finally { + downloading.value = false; + await listener.remove(); + } + } + + /** 立即重启应用使更新生效 */ + async function reload(): Promise { + await CapacitorUpdater.reload(); + } + + /** 检查并下载,供启动时自动更新调用 */ + async function checkAndDownload(): Promise { + await loadCurrent(); + const result = await check(); + if (!result?.url || result.version === currentVersion.value) { + return false; + } + return (await download()) !== null; + } + + return { + supported, + currentVersion, + nativeVersion, + latest, + checking, + downloading, + percent, + ready, + error, + loadCurrent, + check, + hasUpdate, + download, + reload, + checkAndDownload + }; +} + +/** 是否开启自动检查更新 */ +export function isAutoUpdateEnabled(): boolean { + return localStorage.getItem(AUTO_UPDATE_KEY) === "1"; +} + +/** + * 启动时静默检查更新 + * + * 只下载排队,不重启,下次打开 App 自动生效 + */ +export async function runAutoUpdate(): Promise { + if (!Capacitor.isNativePlatform() || !isAutoUpdateEnabled()) { + return; + } + await useAppUpdate().checkAndDownload(); +} diff --git a/src/main.ts b/src/main.ts index d06eb08..00f8d0a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,6 +11,7 @@ import Network from "timi-web-api/utils/Network"; import { VCan, VRole } from "timi-web-api/utils/directives/Access"; import type { ApiResponse } from "timi-web-api"; import { Message } from "@/utils/message"; +import { runAutoUpdate } from "@/composables/useAppUpdate"; import { initializeTwaBridge } from "@/utils/twaBridge"; import { VEntranceTransition } from "timi-tdesign-mobile"; import timiWebStyle from "timi-web/src/assets/style/timi-web.less?inline"; @@ -92,6 +93,8 @@ async function bootstrap(): Promise { app.mount("#root"); if (Capacitor.isNativePlatform()) { await CapacitorUpdater.notifyAppReady(); + // 用户开启自动检查才执行,只下载排队,不打断当前会话 + void runAutoUpdate().catch(() => undefined); } } diff --git a/src/pages/setting/AppSettings.vue b/src/pages/setting/AppSettings.vue index 0706c67..5fc722c 100644 --- a/src/pages/setting/AppSettings.vue +++ b/src/pages/setting/AppSettings.vue @@ -47,6 +47,30 @@ + + + + + + + +
+ +
+ +
@@ -57,6 +81,8 @@ import type { ThemeMode } from "@/store/globalUI"; import { useGlobalUIStore } from "@/store/globalUI"; import SegmentedSlider from "@/components/SegmentedSlider.vue"; import { useSettingStore } from "@/store/settingStore"; +import { AUTO_UPDATE_KEY, isAutoUpdateEnabled, useAppUpdate } from "@/composables/useAppUpdate"; +import { Message } from "@/utils/message"; defineOptions({ name: "AppSettings" @@ -112,6 +138,83 @@ async function playSettingSoundPreview(type: "scanSuccess" | "registerSuccess"): await settingStore.playRegisterSuccessSound(); } + +// ---------- 版本更新 ---------- + +const { + supported: updateSupported, + currentVersion, + nativeVersion, + latest, + checking, + downloading, + percent, + ready, + error: updateError, + loadCurrent, + check, + hasUpdate, + download, + reload +} = useAppUpdate(); + +const autoUpdate = ref(isAutoUpdateEnabled()); + +const canCheckUpdate = computed(() => updateSupported && !checking.value && !downloading.value); + +const updateNote = computed(() => { + if (!updateSupported) { + return "仅在 App 内可用"; + } + if (downloading.value) { + return `下载中 ${percent.value}%`; + } + if (ready.value) { + return "已下载,下次启动生效"; + } + if (checking.value) { + return "检查中"; + } + if (latest.value) { + return hasUpdate() ? `发现 v${latest.value.version}` : "已是最新"; + } + return ""; +}); + +onMounted(async () => { + await loadCurrent(); +}); + +function handleAutoUpdateChange(value: boolean | string | number): void { + const enabled = value === true; + autoUpdate.value = enabled; + localStorage.setItem(AUTO_UPDATE_KEY, enabled ? "1" : "0"); +} + +async function handleCheckUpdate(): Promise { + if (!canCheckUpdate.value) { + return; + } + const result = await check(); + if (!result) { + Message.error(updateError.value || "检查更新失败"); + return; + } + if (!hasUpdate()) { + Message.info("已是最新版本"); + return; + } + const bundle = await download(); + if (bundle) { + Message.success(`v${bundle.version} 已下载,下次启动生效`); + return; + } + Message.error(updateError.value || "下载失败"); +} + +async function handleReload(): Promise { + await reload(); +}