添加配置项

This commit is contained in:
imsyy 2023-02-16 10:57:30 +08:00
parent 8f46b8dd46
commit ddda08c037
7 changed files with 50 additions and 21 deletions

6
.env
View File

@ -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 世纪的小站,存活于互联网的边缘"

View File

@ -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

View File

@ -6,9 +6,9 @@
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="一个默默无闻的主页" />
<meta name="keywords" content="無名,个人主页" />
<meta name="author" content="無名" />
<meta name="description" content="<%- description %>" />
<meta name="keywords" content="<%- keywords %>" />
<meta name="author" content="<%- author %>" />
<meta name="theme-color" content="#424242" />
<title><%- title %></title>
<!-- HarmonyOS Sans -->
@ -24,16 +24,18 @@
window.location.href =
"https://support.dmeng.net/upgrade-your-browser.html?referrer=" + encodeURIComponent(window.location.href)
</script>
<% if (tongji) { %>
<!-- 百度统计 -->
<script>
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?14e9f35ff8bc67fd4bcb5f07a6e6655a";
hm.src = "https://hm.baidu.com/hm.js?<%- tongji %>";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<% } %>
</head>
<body class="loading">

View File

@ -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"
}]

View File

@ -18,7 +18,7 @@
@onSelectSong="onSelectSong"
/>
</template>
<script setup>
import { MusicOne, PlayWrong } from "@icon-park/vue-next";
import aplayer from "vue3-aplayer";
@ -114,13 +114,6 @@ onMounted(() => {
playListCount.value = res.length;
//
store.musicIsOk = true;
console.log(
"音乐加载完成",
res,
playIndex.value,
playListCount.value,
props.volume
);
//
res.forEach((v) => {
playList.value.push({
@ -131,6 +124,13 @@ onMounted(() => {
lrc: v.lrc,
});
});
console.log(
"音乐加载完成",
playList.value,
playIndex.value,
playListCount.value,
props.volume
);
})
.catch(() => {
store.musicIsOk = false;
@ -213,8 +213,8 @@ const changeSong = (type) => {
//
defineExpose({ playToggle, changeVolume, changeSong });
</script>
<style lang='scss' scoped>
<style lang="scss" scoped>
.aplayer {
width: 80%;
background: transparent;
@ -296,4 +296,4 @@ defineExpose({ playToggle, changeVolume, changeSong });
}
}
}
</style>
</style>

View File

@ -14,4 +14,11 @@ const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(pinia);
app.mount('#app')
app.mount('#app')
// PWA
navigator.serviceWorker.addEventListener('controllerchange', () => {
// 弹出更新提醒
console.log("站点已更新,刷新后生效");
ElMessage("站点已更新,刷新后生效");
})

View File

@ -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",