From ddda08c03770ce8845ef10b354338f713ffa3e81 Mon Sep 17 00:00:00 2001 From: imsyy Date: Thu, 16 Feb 2023 10:57:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 6 ++++++ README.md | 5 ++++- index.html | 10 ++++++---- public/socialLinks.json | 7 ++++++- src/components/Player/index.vue | 22 +++++++++++----------- src/main.js | 9 ++++++++- vite.config.js | 12 +++++++++--- 7 files changed, 50 insertions(+), 21 deletions(-) diff --git a/.env b/.env index 76d52b8..c747522 100644 --- a/.env +++ b/.env @@ -1,8 +1,14 @@ # 站点名称 VITE_SITE_NAME = "無名の主页" +VITE_SITE_ANTHOR = "無名" +VITE_SITE_KEYWORDS = "無名,个人主页" +VITE_SITE_DES = "一个默默无闻的主页" VITE_SITE_URL = "imsyy.top" VITE_SITE_LOGO = "/images/icon/logo.png" +# 百度统计(若不需要可不填) +VITE_SITE_BAIDUTONGJI = "14e9f35ff8bc67fd4bcb5f07a6e6655a" + # 简介文本 VITE_DESC_HELLO = "Hello World !" VITE_DESC_TEXT = "一个建立于 21 世纪的小站,存活于互联网的边缘" diff --git a/README.md b/README.md index c6de78e..264ccd3 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,16 @@ * **安装** [node.js](https://nodejs.org/zh-cn/) **环境** - > node > 16.16.0 + > node > 16.16.0 > npm > 8.15.0 * 然后以 **管理员权限** 运行 `cmd` 终端,并 `cd` 到 项目根目录 * 在 `终端` 中输入: ```bash +# 安装 yarn +npm install -g yarn + # 安装依赖 yarn install diff --git a/index.html b/index.html index c3e122d..7061aa8 100644 --- a/index.html +++ b/index.html @@ -6,9 +6,9 @@ - - - + + + <%- title %> @@ -24,16 +24,18 @@ window.location.href = "https://support.dmeng.net/upgrade-your-browser.html?referrer=" + encodeURIComponent(window.location.href) + <% if (tongji) { %> + <% } %> diff --git a/public/socialLinks.json b/public/socialLinks.json index 625df14..2be8bef 100644 --- a/public/socialLinks.json +++ b/public/socialLinks.json @@ -18,9 +18,14 @@ "icon": "/images/icon/email.png", "tip": "来封 Email ~", "url": "mailto:one@imsyy.top" +}, { + "name": "Twitter", + "icon": "/images/icon/twitter.png", + "tip": "你懂的 ~", + "url": "https://twitter.com/iimmsyy" }, { "name": "Telegram", "icon": "/images/icon/telegram.png", "tip": "你懂的 ~", - "url": "https://twitter.com/iimmsyy" + "url": "https://t.me/bottom_user" }] \ No newline at end of file diff --git a/src/components/Player/index.vue b/src/components/Player/index.vue index 9f3b49f..2df519e 100644 --- a/src/components/Player/index.vue +++ b/src/components/Player/index.vue @@ -18,7 +18,7 @@ @onSelectSong="onSelectSong" /> - + - - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index 6782128..a5ac7a1 100644 --- a/src/main.js +++ b/src/main.js @@ -14,4 +14,11 @@ const pinia = createPinia(); pinia.use(piniaPluginPersistedstate); app.use(pinia); -app.mount('#app') \ No newline at end of file +app.mount('#app') + +// PWA +navigator.serviceWorker.addEventListener('controllerchange', () => { + // 弹出更新提醒 + console.log("站点已更新,刷新后生效"); + ElMessage("站点已更新,刷新后生效"); +}) \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index da51a30..735a1dd 100644 --- a/vite.config.js +++ b/vite.config.js @@ -36,6 +36,10 @@ export default ({ inject: { data: { title: loadEnv(mode, process.cwd()).VITE_SITE_NAME, + author: loadEnv(mode, process.cwd()).VITE_SITE_ANTHOR, + keywords: loadEnv(mode, process.cwd()).VITE_SITE_KEYWORDS, + description: loadEnv(mode, process.cwd()).VITE_SITE_DES, + tongji: loadEnv(mode, process.cwd()).VITE_SITE_BAIDUTONGJI, }, }, }), @@ -46,6 +50,8 @@ export default ({ navigateFallbackAllowlist: [/^index.html$/] }, workbox: { + skipWaiting: true, + clientsClaim: true, runtimeCaching: [{ urlPattern: /(.*?)\.(js|css|woff2|woff|ttf)/, // js / css 静态资源缓存 handler: 'CacheFirst', @@ -63,9 +69,9 @@ export default ({ ], }, manifest: { - "name": "無名の主页", - "short_name": "無名の主页", - "description": "一个默默无闻的主页", + "name": loadEnv(mode, process.cwd()).VITE_SITE_NAME, + "short_name": loadEnv(mode, process.cwd()).VITE_SITE_NAME, + "description": loadEnv(mode, process.cwd()).VITE_SITE_DES, "display": "standalone", "start_url": "/", "theme_color": "#424242",