From f6b8d76906ed1c16d6e1f1aa1a55f1da920f2082 Mon Sep 17 00:00:00 2001 From: Sunwuyuan Date: Sun, 28 Dec 2025 13:16:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0KV=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E5=9C=B0=E5=9D=80=EF=BC=8C=E6=B7=BB=E5=8A=A0PWA?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=8D=A1=E7=89=87=E5=8F=8A=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 2 +- .github/workflows/deploy.yml | 2 +- src/App.vue | 6 + src/components/PwaInstallCard.vue | 350 ++++++++++++++++++++++++++++++ src/pages/index.vue | 4 + src/stores/app.js | 1 - src/utils/dataProvider.js | 6 +- src/utils/settings.js | 19 +- 8 files changed, 378 insertions(+), 12 deletions(-) create mode 100644 src/components/PwaInstallCard.vue diff --git a/.env.example b/.env.example index a5a7217..e56f6d7 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ # Classworks KV 默认服务器域名 -VITE_DEFAULT_KV_SERVER=https://kv.wuyuan.dev +VITE_DEFAULT_KV_SERVER=https://kv-service.houlang.cloud # Classworks KV 授权服务器域名 VITE_DEFAULT_AUTH_SERVER=https://kv.houlang.cloud diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index de72770..3eeffa4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,7 +34,7 @@ jobs: - name: Build env: VITE_APP_ID: d158067f53627d2b98babe8bffd2fd7d - VITE_DEFAULT_KV_SERVER: https://kv.wuyuan.dev + VITE_DEFAULT_KV_SERVER: https://kv-service.houlang.cloud VITE_DEFAULT_AUTH_SERVER: https://kv.houlang.cloud run: | npm install diff --git a/src/App.vue b/src/App.vue index fbf1bf6..4a2989e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -23,6 +23,12 @@ onMounted(() => { // 应用保存的主题设置 const savedTheme = getSetting("theme.mode"); theme.global.name.value = savedTheme; + + window.addEventListener('beforeinstallprompt', (e) => { + e.preventDefault(); + window.deferredPwaPrompt = e; + window.dispatchEvent(new Event('pwa-prompt-ready')); + }); });