v1.0.1 #2
@@ -8,7 +8,7 @@ android {
|
|||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0.0"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
aaptOptions {
|
aaptOptions {
|
||||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 10 KiB |
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="ic_launcher_background">#FFFFFF</color>
|
<color name="ic_launcher_background">#0F766E</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
import type { CapacitorConfig } from "@capacitor/cli";
|
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://")) {
|
if (updateUrl && !updateUrl.startsWith("https://")) {
|
||||||
throw new Error("热更新接口必须使用 HTTPS");
|
throw new Error("热更新接口必须使用 HTTPS");
|
||||||
}
|
}
|
||||||
@@ -11,8 +17,8 @@ const config: CapacitorConfig = {
|
|||||||
webDir: "dist",
|
webDir: "dist",
|
||||||
plugins: {
|
plugins: {
|
||||||
CapacitorUpdater: {
|
CapacitorUpdater: {
|
||||||
autoUpdate: updateUrl ? "atBackground" : false,
|
autoUpdate: false,
|
||||||
...(updateUrl ? { updateUrl } : {}),
|
updateUrl,
|
||||||
statsUrl: ""
|
statsUrl: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "gao-customer-h5",
|
"name": "gao-customer-h5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host",
|
"dev": "vite --host",
|
||||||
@@ -54,6 +54,7 @@
|
|||||||
"@vue/tsconfig": "^0.7.0",
|
"@vue/tsconfig": "^0.7.0",
|
||||||
"eslint": "9.26.0",
|
"eslint": "9.26.0",
|
||||||
"eslint-plugin-vue": "^9.33.0",
|
"eslint-plugin-vue": "^9.33.0",
|
||||||
|
"sharp": "^0.35.5",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.8.3",
|
||||||
"unplugin-auto-import": "^19.1.1",
|
"unplugin-auto-import": "^19.1.1",
|
||||||
"unplugin-vue-components": "^28.4.1",
|
"unplugin-vue-components": "^28.4.1",
|
||||||
|
|||||||
@@ -113,6 +113,9 @@ importers:
|
|||||||
eslint-plugin-vue:
|
eslint-plugin-vue:
|
||||||
specifier: ^9.33.0
|
specifier: ^9.33.0
|
||||||
version: 9.33.0(eslint@9.26.0)
|
version: 9.33.0(eslint@9.26.0)
|
||||||
|
sharp:
|
||||||
|
specifier: ^0.35.5
|
||||||
|
version: 0.35.5(@types/node@24.13.3)
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ~5.8.3
|
specifier: ~5.8.3
|
||||||
version: 5.8.3
|
version: 5.8.3
|
||||||
@@ -214,6 +217,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
|
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
|
'@emnapi/runtime@1.11.3':
|
||||||
|
resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==}
|
||||||
|
|
||||||
'@emotion/babel-plugin@11.13.5':
|
'@emotion/babel-plugin@11.13.5':
|
||||||
resolution: {integrity: sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==}
|
resolution: {integrity: sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==}
|
||||||
|
|
||||||
@@ -473,6 +479,168 @@ packages:
|
|||||||
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
|
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
|
||||||
engines: {node: '>=18.18'}
|
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':
|
'@ionic/cli-framework-output@2.2.8':
|
||||||
resolution: {integrity: sha512-TshtaFQsovB4NWRBydbNFawql6yul7d5bMiW1WYYf17hd99V6xdDdk3vtF51bw6sLkxON3bDQpWsnUc9/hVo3g==}
|
resolution: {integrity: sha512-TshtaFQsovB4NWRBydbNFawql6yul7d5bMiW1WYYf17hd99V6xdDdk3vtF51bw6sLkxON3bDQpWsnUc9/hVo3g==}
|
||||||
engines: {node: '>=16.0.0'}
|
engines: {node: '>=16.0.0'}
|
||||||
@@ -1437,6 +1605,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
|
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
|
||||||
engines: {node: '>= 0.8'}
|
engines: {node: '>= 0.8'}
|
||||||
|
|
||||||
|
detect-libc@2.1.2:
|
||||||
|
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
diff@4.0.4:
|
diff@4.0.4:
|
||||||
resolution: {integrity: sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==}
|
resolution: {integrity: sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==}
|
||||||
engines: {node: '>=0.3.1'}
|
engines: {node: '>=0.3.1'}
|
||||||
@@ -2436,6 +2608,15 @@ packages:
|
|||||||
setprototypeof@1.2.0:
|
setprototypeof@1.2.0:
|
||||||
resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
|
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:
|
shebang-command@2.0.0:
|
||||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@@ -3031,6 +3212,11 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@jridgewell/trace-mapping': 0.3.9
|
'@jridgewell/trace-mapping': 0.3.9
|
||||||
|
|
||||||
|
'@emnapi/runtime@1.11.3':
|
||||||
|
dependencies:
|
||||||
|
tslib: 2.9.1
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@emotion/babel-plugin@11.13.5':
|
'@emotion/babel-plugin@11.13.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/helper-module-imports': 7.29.7
|
'@babel/helper-module-imports': 7.29.7
|
||||||
@@ -3238,6 +3424,112 @@ snapshots:
|
|||||||
|
|
||||||
'@humanwhocodes/retry@0.4.3': {}
|
'@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':
|
'@ionic/cli-framework-output@2.2.8':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ionic/utils-terminal': 2.3.5
|
'@ionic/utils-terminal': 2.3.5
|
||||||
@@ -4265,6 +4557,8 @@ snapshots:
|
|||||||
|
|
||||||
depd@2.0.0: {}
|
depd@2.0.0: {}
|
||||||
|
|
||||||
|
detect-libc@2.1.2: {}
|
||||||
|
|
||||||
diff@4.0.4: {}
|
diff@4.0.4: {}
|
||||||
|
|
||||||
dunder-proto@1.0.1:
|
dunder-proto@1.0.1:
|
||||||
@@ -5373,6 +5667,39 @@ snapshots:
|
|||||||
|
|
||||||
setprototypeof@1.2.0: {}
|
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:
|
shebang-command@2.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
shebang-regex: 3.0.0
|
shebang-regex: 3.0.0
|
||||||
|
|||||||
@@ -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(
|
||||||
|
`<svg width="${size}" height="${size}"><circle cx="${size / 2}" cy="${size / 2}" r="${size / 2}" fill="#fff"/></svg>`
|
||||||
|
);
|
||||||
|
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("完成");
|
||||||
@@ -309,6 +309,31 @@ function updateOverlay(result: Result): void {
|
|||||||
drawOverlay();
|
drawOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 根据摄像头支持的模式启用自动对焦。 */
|
||||||
|
async function enableAutoFocus(video: HTMLVideoElement): Promise<void> {
|
||||||
|
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<void> {
|
async function startScanner(): Promise<void> {
|
||||||
if (!props.visible) {
|
if (!props.visible) {
|
||||||
return;
|
return;
|
||||||
@@ -329,6 +354,7 @@ async function startScanner(): Promise<void> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const video = scannerVideoRef.value;
|
||||||
syncCanvasSize();
|
syncCanvasSize();
|
||||||
try {
|
try {
|
||||||
scannerControls.value = await scannerReader.decodeFromConstraints({
|
scannerControls.value = await scannerReader.decodeFromConstraints({
|
||||||
@@ -338,7 +364,7 @@ async function startScanner(): Promise<void> {
|
|||||||
ideal: "environment"
|
ideal: "environment"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, scannerVideoRef.value, (result, error) => {
|
}, video, (result, error) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
updateOverlay(result);
|
updateOverlay(result);
|
||||||
clearOverlay(900);
|
clearOverlay(900);
|
||||||
@@ -362,6 +388,7 @@ async function startScanner(): Promise<void> {
|
|||||||
clearOverlay();
|
clearOverlay();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
await enableAutoFocus(video);
|
||||||
} catch {
|
} catch {
|
||||||
updateStatus(props.permissionDeniedText);
|
updateStatus(props.permissionDeniedText);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<LatestVersion | null>(null);
|
||||||
|
const checking = ref(false);
|
||||||
|
const downloading = ref(false);
|
||||||
|
const percent = ref(0);
|
||||||
|
const ready = ref<BundleInfo | null>(null);
|
||||||
|
const error = ref("");
|
||||||
|
|
||||||
|
/** 读取当前运行的 Web 包版本与原生壳版本 */
|
||||||
|
async function loadCurrent(): Promise<void> {
|
||||||
|
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<LatestVersion | null> {
|
||||||
|
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<BundleInfo | null> {
|
||||||
|
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<void> {
|
||||||
|
await CapacitorUpdater.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 检查并下载,供启动时自动更新调用 */
|
||||||
|
async function checkAndDownload(): Promise<boolean> {
|
||||||
|
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<void> {
|
||||||
|
if (!Capacitor.isNativePlatform() || !isAutoUpdateEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await useAppUpdate().checkAndDownload();
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import Network from "timi-web-api/utils/Network";
|
|||||||
import { VCan, VRole } from "timi-web-api/utils/directives/Access";
|
import { VCan, VRole } from "timi-web-api/utils/directives/Access";
|
||||||
import type { ApiResponse } from "timi-web-api";
|
import type { ApiResponse } from "timi-web-api";
|
||||||
import { Message } from "@/utils/message";
|
import { Message } from "@/utils/message";
|
||||||
|
import { runAutoUpdate } from "@/composables/useAppUpdate";
|
||||||
import { initializeTwaBridge } from "@/utils/twaBridge";
|
import { initializeTwaBridge } from "@/utils/twaBridge";
|
||||||
import { VEntranceTransition } from "timi-tdesign-mobile";
|
import { VEntranceTransition } from "timi-tdesign-mobile";
|
||||||
import timiWebStyle from "timi-web/src/assets/style/timi-web.less?inline";
|
import timiWebStyle from "timi-web/src/assets/style/timi-web.less?inline";
|
||||||
@@ -92,6 +93,8 @@ async function bootstrap(): Promise<void> {
|
|||||||
app.mount("#root");
|
app.mount("#root");
|
||||||
if (Capacitor.isNativePlatform()) {
|
if (Capacitor.isNativePlatform()) {
|
||||||
await CapacitorUpdater.notifyAppReady();
|
await CapacitorUpdater.notifyAppReady();
|
||||||
|
// 用户开启自动检查才执行,只下载排队,不打断当前会话
|
||||||
|
void runAutoUpdate().catch(() => undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,30 @@
|
|||||||
</template>
|
</template>
|
||||||
</t-cell>
|
</t-cell>
|
||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
|
<t-cell-group title="版本更新" theme="card" v-entrance-transition>
|
||||||
|
<t-cell title="外壳版本" :note="nativeVersion || '—'" />
|
||||||
|
<t-cell title="系统版本" :note="currentVersion || '—'" />
|
||||||
|
<t-cell title="自动检查更新">
|
||||||
|
<template #right-icon>
|
||||||
|
<t-switch :model-value="autoUpdate" @change="handleAutoUpdateChange" />
|
||||||
|
</template>
|
||||||
|
</t-cell>
|
||||||
|
<t-cell
|
||||||
|
title="检查更新"
|
||||||
|
:note="updateNote"
|
||||||
|
:arrow="canCheckUpdate"
|
||||||
|
@click="handleCheckUpdate"
|
||||||
|
/>
|
||||||
|
<div v-if="downloading" class="update-progress">
|
||||||
|
<t-progress :percentage="percent" :label="false" />
|
||||||
|
</div>
|
||||||
|
<t-cell
|
||||||
|
v-if="ready"
|
||||||
|
title="立即重启生效"
|
||||||
|
arrow
|
||||||
|
@click="handleReload"
|
||||||
|
/>
|
||||||
|
</t-cell-group>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,6 +81,8 @@ import type { ThemeMode } from "@/store/globalUI";
|
|||||||
import { useGlobalUIStore } from "@/store/globalUI";
|
import { useGlobalUIStore } from "@/store/globalUI";
|
||||||
import SegmentedSlider from "@/components/SegmentedSlider.vue";
|
import SegmentedSlider from "@/components/SegmentedSlider.vue";
|
||||||
import { useSettingStore } from "@/store/settingStore";
|
import { useSettingStore } from "@/store/settingStore";
|
||||||
|
import { AUTO_UPDATE_KEY, isAutoUpdateEnabled, useAppUpdate } from "@/composables/useAppUpdate";
|
||||||
|
import { Message } from "@/utils/message";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "AppSettings"
|
name: "AppSettings"
|
||||||
@@ -112,6 +138,83 @@ async function playSettingSoundPreview(type: "scanSuccess" | "registerSuccess"):
|
|||||||
|
|
||||||
await settingStore.playRegisterSuccessSound();
|
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<string>(() => {
|
||||||
|
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<void> {
|
||||||
|
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<void> {
|
||||||
|
await reload();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
@@ -150,6 +253,10 @@ async function playSettingSoundPreview(type: "scanSuccess" | "registerSuccess"):
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.update-progress {
|
||||||
|
padding: 0 1rem .75rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(html.theme-dark) {
|
:global(html.theme-dark) {
|
||||||
|
|||||||