mirror of
https://github.com/imsyy/home.git
synced 2025-05-19 20:50:14 +09:00
修改配置
This commit is contained in:
parent
e7a4cf7171
commit
c0d2afe8d8
@ -1,12 +1,12 @@
|
||||
# 站点信息
|
||||
VITE_SITE_NAME = "無名の主页" # 名称
|
||||
VITE_SITE_ANTHOR = "無名" # 作者
|
||||
VITE_SITE_KEYWORDS = "無名,个人主页" # 关键词
|
||||
VITE_SITE_NAME = "E一夜俱乐部-主页" # 名称
|
||||
VITE_SITE_ANTHOR = "RainPaper" # 作者
|
||||
VITE_SITE_KEYWORDS = "E一夜俱乐部,主页" # 关键词
|
||||
VITE_SITE_DES = "一个默默无闻的主页" # 站点简介
|
||||
VITE_SITE_URL = "imsyy.top" # 站点地址
|
||||
VITE_SITE_URL = "E一夜.icu" # 站点地址
|
||||
VITE_SITE_LOGO = "/images/icon/favicon.ico" # 站点主图标
|
||||
VITE_SITE_MAIN_LOGO = "/images/icon/logo.png" # 主页图标
|
||||
VITE_SITE_APPLE_LOGO = "/images/logo/apple-touch-icon.png" # Apple 端图标
|
||||
VITE_SITE_APPLE_LOGO = "/images/icon/favicon.ico" # Apple 端图标
|
||||
|
||||
# 简介文本
|
||||
VITE_DESC_HELLO = "Hello World !"
|
||||
@ -31,11 +31,11 @@ VITE_WEATHER_KEY = ""
|
||||
# 建站日期
|
||||
## 若不需要,请设为空即可
|
||||
## 请按照 YYYY-MM-DD 格式填写或者仅填写年份 YYYY
|
||||
VITE_SITE_START = "2020-10-24"
|
||||
VITE_SITE_START = "2023-07-27"
|
||||
|
||||
# ICP 备案号
|
||||
## 若不需要,请设为空即可
|
||||
VITE_SITE_ICP = "豫ICP备2022018134号-1"
|
||||
VITE_SITE_ICP = ""
|
||||
|
||||
# 歌曲 API 地址
|
||||
## 请参照 https://github.com/xizeyoupan/Meting-API#deno-deploy 进行 API 服务部署
|
||||
@ -48,4 +48,4 @@ VITE_SONG_SERVER = "netease"
|
||||
# 播放类型 ( song-歌曲, playlist-播放列表, album-专辑, search-搜索, artist-艺术家 )
|
||||
VITE_SONG_TYPE = "playlist"
|
||||
# 播放 ID ( 若无需播放器,请设为空即可 )
|
||||
VITE_SONG_ID = "9379831714"
|
||||
VITE_SONG_ID = ""
|
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@ -22,14 +22,6 @@ jobs:
|
||||
uses: actions/setup-node@v4.0.0
|
||||
with:
|
||||
node-version: "18.x"
|
||||
# 复制环境变量文件
|
||||
- name: Copy .env.example
|
||||
run: |
|
||||
if (-not (Test-Path .env)) {
|
||||
Copy-Item .env.example .env
|
||||
} else {
|
||||
Write-Host ".env file already exists. Skipping the copy step."
|
||||
}
|
||||
# 安装项目依赖
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,7 +11,6 @@ node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
.env
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
|
@ -4,7 +4,6 @@ WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN [ ! -e ".env" ] && cp .env.example .env || true
|
||||
RUN npm run build
|
||||
|
||||
# 最小化镜像
|
||||
|
56
README.md
56
README.md
@ -9,7 +9,7 @@
|
||||
|
||||
>主页的 Logo 字体已经过压缩,若用本站 Logo 以外的字母会变回默认字体,这里是 [完整字体](https://file.imsyy.top/font/Other/Pacifico-Regular.ttf),若无法下载,可将字体目录下的 `Pacifico-Regular-all.ttf` 进行替换
|
||||
|
||||
### 👀 Demo
|
||||
### Demo
|
||||
|
||||
>由于 CDN 缓存原因,查看最新效果可能需要 `Ctrl` + `F5` 强制刷新浏览器缓存
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
- [無名の主页 - Dev](https://home-imsyy.vercel.app)
|
||||
- [無名の主页 - 备用线路](https://home-5iw.pages.dev)
|
||||
|
||||
### 🎉 功能
|
||||
### 功能
|
||||
|
||||
- [x] 载入动画
|
||||
- [x] 站点简介
|
||||
@ -28,7 +28,7 @@
|
||||
- [x] 音乐播放器
|
||||
- [x] 移动端适配
|
||||
|
||||
### ⚙️ 自动部署
|
||||
### 自动部署
|
||||
|
||||
如果遇到构建环境或者打包过程出现错误,则可以采用 `Github Actions` 来进行自动构建
|
||||
|
||||
@ -40,15 +40,15 @@
|
||||
|
||||

|
||||
|
||||
### ⚙️ 手动部署
|
||||
### 手动部署
|
||||
|
||||
- **安装** [node.js](https://nodejs.org/zh-cn/) **环境**
|
||||
* **安装** [node.js](https://nodejs.org/zh-cn/) **环境**
|
||||
|
||||
> node > 16.16.0
|
||||
> npm > 8.15.0
|
||||
|
||||
- 然后以 **管理员权限** 运行 `cmd` 终端,并 `cd` 到 项目根目录
|
||||
- 在 `终端` 中输入:
|
||||
* 然后以 **管理员权限** 运行 `cmd` 终端,并 `cd` 到 项目根目录
|
||||
* 在 `终端` 中输入:
|
||||
|
||||
```bash
|
||||
# 安装 pnpm
|
||||
@ -63,10 +63,9 @@ pnpm dev
|
||||
# 构建
|
||||
pnpm build
|
||||
```
|
||||
|
||||
> 构建完成后,静态资源会在 **`dist` 目录** 中生成,可将 **`dist` 文件夹下的文件**上传至服务器,也可使用 `Vercel` 等托管平台一键导入并自动部署
|
||||
|
||||
### ⚙️ Docker 部署
|
||||
### Docker 部署
|
||||
|
||||
> 安装及配置 Docker 将不在此处说明,请自行解决
|
||||
|
||||
@ -77,15 +76,6 @@ docker build -t home .
|
||||
docker run -p 12445:12445 -d home
|
||||
```
|
||||
|
||||
### ⚙️ Vercel 部署
|
||||
|
||||
> 其他部署平台大致相同,在此不做说明
|
||||
|
||||
1. 点击本仓库右上角的 `Fork`,复制本仓库到你的 `GitHub` 账号
|
||||
2. 复制 `/.env.example` 文件并重命名为 `/.env`( 重要 )
|
||||
3. 按需修改 `/.env` 文件中的配置
|
||||
4. 点击 `Deploy`,即可成功部署
|
||||
|
||||
### 网站链接
|
||||
|
||||
在 `src/assets/siteLinks.json` 中可以自定义网站链接(以指向自己的网站):
|
||||
@ -140,10 +130,11 @@ const siteIcon = {
|
||||
|
||||
也可自行更换其他方式
|
||||
|
||||
|
||||
### 音乐
|
||||
|
||||
>本项目采用了基于 `MetingJS` 的 `Aplayer` 音乐播放器,可实现快速自定义歌单
|
||||
> \*仅支持 **中国大陆地区**
|
||||
>*仅支持 **中国大陆地区**
|
||||
|
||||
请在 `.env` 文件中更改歌曲相关参数即可实现自定义歌单列表
|
||||
|
||||
@ -210,9 +201,12 @@ make clean all
|
||||
如果想要添加更多的本地图片作为网站背景,可以将图片重命名 `background+数字` 的形式,并在 `src/components/Background/index.vue` 中进行修改:
|
||||
|
||||
```js
|
||||
|
||||
if (type == 0) {
|
||||
// 修改此处 Math.random() 后面的第一个数字为图片的数量
|
||||
bgUrl.value = `/images/background${Math.floor(Math.random() * 10 + 1)}.webp`;
|
||||
bgUrl.value = `/images/background${Math.floor(
|
||||
Math.random() * 10 + 1
|
||||
)}.webp`;
|
||||
}
|
||||
```
|
||||
|
||||
@ -222,20 +216,20 @@ if (type == 0) {
|
||||
|
||||
### 技术栈
|
||||
|
||||
- [Vue](https://cn.vuejs.org/)
|
||||
- [Vite](https://vitejs.cn/vite3-cn/)
|
||||
- [Pinia](https://pinia.vuejs.org/zh/)
|
||||
- [IconPark](https://iconpark.oceanengine.com/official)
|
||||
- [xicons](https://xicons.org/)
|
||||
- [Aplayer](https://aplayer.js.org/)
|
||||
* [Vue](https://cn.vuejs.org/)
|
||||
* [Vite](https://vitejs.cn/vite3-cn/)
|
||||
* [Pinia](https://pinia.vuejs.org/zh/)
|
||||
* [IconPark](https://iconpark.oceanengine.com/official)
|
||||
* [xicons](https://xicons.org/)
|
||||
* [Aplayer](https://aplayer.js.org/)
|
||||
|
||||
### API
|
||||
|
||||
- [小歪 API](https://api.aixiaowai.cn)
|
||||
- [搏天 API](https://api.btstu.cn/doc/sjbz.php)
|
||||
- [教书先生 API](https://api.oioweb.cn/doc/weather/GetWeather)
|
||||
- [高德开放平台](https://lbs.amap.com/)
|
||||
- [Hitokoto 一言](https://hitokoto.cn/)
|
||||
* [小歪 API](https://api.aixiaowai.cn)
|
||||
* [搏天 API](https://api.btstu.cn/doc/sjbz.php)
|
||||
* [教书先生 API](https://api.oioweb.cn/doc/weather/GetWeather)
|
||||
* [高德开放平台](https://lbs.amap.com/)
|
||||
* [Hitokoto 一言](https://hitokoto.cn/)
|
||||
|
||||
## Star History
|
||||
|
||||
|
17
package.json
17
package.json
@ -16,14 +16,13 @@
|
||||
"dependencies": {
|
||||
"@worstone/vue-aplayer": "^1.0.6",
|
||||
"aplayer": "^1.10.1",
|
||||
"axios": "^1.6.8",
|
||||
"dayjs": "^1.11.10",
|
||||
"element-plus": "^2.7.1",
|
||||
"axios": "^1.6.7",
|
||||
"element-plus": "^2.6.1",
|
||||
"fetch-jsonp": "^1.3.0",
|
||||
"pinia": "^2.1.7",
|
||||
"pinia-plugin-persistedstate": "^3.2.1",
|
||||
"swiper": "^11.1.1",
|
||||
"vue": "^3.4.24"
|
||||
"swiper": "^9.4.1",
|
||||
"vue": "^3.4.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@icon-park/vue-next": "^1.4.2",
|
||||
@ -31,13 +30,13 @@
|
||||
"@vicons/utils": "^0.1.4",
|
||||
"@vitejs/plugin-vue": "^4.6.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-vue": "^9.25.0",
|
||||
"eslint-plugin-vue": "^9.22.0",
|
||||
"prettier": "^3.2.5",
|
||||
"sass": "^1.75.0",
|
||||
"terser": "^5.30.4",
|
||||
"sass": "^1.71.1",
|
||||
"terser": "^5.29.1",
|
||||
"unplugin-auto-import": "^0.11.5",
|
||||
"unplugin-vue-components": "^0.22.12",
|
||||
"vite": "^4.5.3",
|
||||
"vite": "^4.5.2",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-pwa": "^0.14.7"
|
||||
}
|
||||
|
6019
pnpm-lock.yaml
generated
6019
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 593 KiB |
Binary file not shown.
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 106 KiB |
@ -1,37 +1,37 @@
|
||||
[
|
||||
{
|
||||
"icon": "Blog",
|
||||
"name": "博客",
|
||||
"link": "https://blog.imsyy.top/"
|
||||
"icon": "BloggerB",
|
||||
"name": "主站",
|
||||
"link": "https://www.xn--e-0n6am96a.icu:53780"
|
||||
},
|
||||
{
|
||||
"icon": "UserFriends",
|
||||
"name": "随笔系统",
|
||||
"link": "https://memos.xn--e-0n6am96a.icu:53780"
|
||||
},
|
||||
{
|
||||
"icon": "Rocketchat",
|
||||
"name": "聊天系统",
|
||||
"link": "https://chat.xn--e-0n6am96a.icu:53780"
|
||||
},
|
||||
{
|
||||
"icon": "Cloud",
|
||||
"name": "网盘",
|
||||
"link": "https://pan.imsyy.top/"
|
||||
"name": "网盘系统",
|
||||
"link": "https://alist.xn--e-0n6am96a.icu:53780"
|
||||
},
|
||||
{
|
||||
"icon": "CompactDisc",
|
||||
"name": "音乐",
|
||||
"link": "https://music.imsyy.top/"
|
||||
"icon": "Robot",
|
||||
"name": "AI聊天",
|
||||
"link": "https://ai.xn--e-0n6am96a.icu:53780/"
|
||||
},
|
||||
{
|
||||
"icon": "Compass",
|
||||
"name": "起始页",
|
||||
"link": "https://nav.imsyy.top/"
|
||||
"icon": "Check",
|
||||
"name": "系统监控",
|
||||
"link": "https://nezha.xn--e-0n6am96a.icu:53780"
|
||||
},
|
||||
{
|
||||
"icon": "Book",
|
||||
"name": "网址集",
|
||||
"link": "https://web.imsyy.top/"
|
||||
},
|
||||
{
|
||||
"icon": "Fire",
|
||||
"name": "今日热榜",
|
||||
"link": "https://hot.imsyy.top/"
|
||||
},
|
||||
{
|
||||
"icon": "LaptopCode",
|
||||
"name": "站点监测",
|
||||
"link": "https://status.imsyy.top/"
|
||||
"icon": "Heart",
|
||||
"name": "服务监控",
|
||||
"link": "https://status.xn--e-0n6am96a.icu"
|
||||
}
|
||||
]
|
||||
|
@ -1,38 +1 @@
|
||||
[
|
||||
{
|
||||
"name": "Github",
|
||||
"icon": "/images/icon/github.png",
|
||||
"tip": "去 Github 看看",
|
||||
"url": "https://github.com/imsyy"
|
||||
},
|
||||
{
|
||||
"name": "BiliBili",
|
||||
"icon": "/images/icon/bilibili.png",
|
||||
"tip": "(゜-゜)つロ 干杯 ~",
|
||||
"url": "https://space.bilibili.com/98544142"
|
||||
},
|
||||
{
|
||||
"name": "QQ",
|
||||
"icon": "/images/icon/qq.png",
|
||||
"tip": "有什么事吗",
|
||||
"url": "https://res.abeim.cn/api/qq/?qq=1539250352"
|
||||
},
|
||||
{
|
||||
"name": "Email",
|
||||
"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://t.me/bottom_user"
|
||||
}
|
||||
]
|
||||
[]
|
@ -34,7 +34,7 @@ const emit = defineEmits(["loadComplete"]);
|
||||
|
||||
// 壁纸随机数
|
||||
// 请依据文件夹内的图片个数修改 Math.random() 后面的第一个数字
|
||||
const bgRandom = Math.floor(Math.random() * 10 + 1);
|
||||
const bgRandom = Math.floor(Math.random() * 1 + 1);
|
||||
|
||||
// 更换壁纸链接
|
||||
const changeBg = (type) => {
|
||||
|
@ -43,10 +43,10 @@
|
||||
<script setup>
|
||||
import { Icon } from "@vicons/utils";
|
||||
// 可前往 https://www.xicons.org 自行挑选并在此处引入
|
||||
import { Link, Blog, CompactDisc, Cloud, Compass, Book, Fire, LaptopCode } from "@vicons/fa"; // 注意使用正确的类别
|
||||
import { Link, BloggerB, UserFriends, Rocketchat, Cloud, Robot, Check, Heart } from "@vicons/fa"; // 注意使用正确的类别
|
||||
import { mainStore } from "@/store";
|
||||
import { Swiper, SwiperSlide } from "swiper/vue";
|
||||
import { Pagination, Mousewheel } from "swiper/modules";
|
||||
import { Pagination, Mousewheel } from "swiper";
|
||||
import siteLinks from "@/assets/siteLinks.json";
|
||||
|
||||
const store = mainStore();
|
||||
@ -109,22 +109,14 @@ onMounted(() => {
|
||||
height: 100%;
|
||||
}
|
||||
.swiper-pagination {
|
||||
margin-top: 12px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: static;
|
||||
margin-top: 4px;
|
||||
:deep(.swiper-pagination-bullet) {
|
||||
background-color: #fff;
|
||||
width: 20px;
|
||||
width: 18px;
|
||||
height: 4px;
|
||||
margin: 0 4px;
|
||||
border-radius: 4px;
|
||||
opacity: 0.2;
|
||||
transition: opacity 0.3s;
|
||||
&.swiper-pagination-bullet-active {
|
||||
opacity: 1;
|
||||
}
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
@ -15,12 +15,10 @@
|
||||
<Icon size="16">
|
||||
<QuoteLeft />
|
||||
</Icon>
|
||||
<Transition name="fade" mode="out-in">
|
||||
<div :key="descriptionText.hello + descriptionText.text" class="text">
|
||||
<div class="text">
|
||||
<p>{{ descriptionText.hello }}</p>
|
||||
<p>{{ descriptionText.text }}</p>
|
||||
</div>
|
||||
</Transition>
|
||||
<Icon size="16">
|
||||
<QuoteRight />
|
||||
</Icon>
|
||||
@ -148,7 +146,6 @@ watch(
|
||||
margin: 0.75rem 1rem;
|
||||
line-height: 2rem;
|
||||
margin-right: auto;
|
||||
transition: opacity 0.2s;
|
||||
|
||||
p {
|
||||
&:nth-of-type(1) {
|
||||
|
@ -12,12 +12,10 @@
|
||||
</div>
|
||||
<div class="control">
|
||||
<go-start theme="filled" size="30" fill="#efefef" @click="changeMusicIndex(0)" />
|
||||
<Transition name="fade" mode="out-in">
|
||||
<div :key="store.playerState" class="state" @click="changePlayState">
|
||||
<div class="state" @click="changePlayState">
|
||||
<play-one theme="filled" size="50" fill="#efefef" v-show="!store.playerState" />
|
||||
<pause theme="filled" size="50" fill="#efefef" v-show="store.playerState" />
|
||||
</div>
|
||||
</Transition>
|
||||
<go-end theme="filled" size="30" fill="#efefef" @click="changeMusicIndex(1)" />
|
||||
</div>
|
||||
<div class="menu">
|
||||
@ -179,7 +177,6 @@ watch(
|
||||
justify-content: space-evenly;
|
||||
width: 100%;
|
||||
.state {
|
||||
transition: opacity 0.1s;
|
||||
.i-icon {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
|
@ -4,24 +4,23 @@
|
||||
<hourglass-full theme="two-tone" size="24" :fill="['#efefef', '#00000020']" />
|
||||
<span>时光胶囊</span>
|
||||
</div>
|
||||
<div v-if="timeData" class="all-capsule">
|
||||
<div v-for="(item, tag, index) in timeData" :key="index" class="capsule-item">
|
||||
<div class="item-title">
|
||||
<span class="percentage">
|
||||
{{ item.name }}已度过
|
||||
<strong>{{ item.passed }}</strong>
|
||||
{{ tag === "day" ? "小时" : "天" }}
|
||||
</span>
|
||||
<span class="remaining">
|
||||
剩余 {{ item.remaining }} {{ tag === "day" ? "小时" : "天" }}
|
||||
</span>
|
||||
</div>
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="item.percentage" />
|
||||
</div>
|
||||
<!-- 建站日期 -->
|
||||
<div v-if="store.siteStartShow" class="capsule-item start">
|
||||
<div class="item-title">{{ startDateText }}</div>
|
||||
</div>
|
||||
<span class="text">今日已经度过了 {{ timeData.day.elapsed }} 小时</span>
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="timeData.day.pass" />
|
||||
<span class="text">本周已经度过了 {{ timeData.week.elapsed }} 天</span>
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="timeData.week.pass" />
|
||||
<span class="text">本月已经度过了 {{ timeData.month.elapsed }} 天</span>
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="timeData.month.pass" />
|
||||
<span class="text">今年已经度过了 {{ timeData.year.elapsed }} 个月</span>
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="timeData.year.pass" />
|
||||
<div v-if="startDate?.length >= 4 && store.siteStartShow">
|
||||
<span class="text" v-html="startDateText" />
|
||||
<!-- <el-progress
|
||||
:show-text="false"
|
||||
:indeterminate="true"
|
||||
:stroke-width="6"
|
||||
:percentage="80"
|
||||
:duration="2"
|
||||
/> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -66,33 +65,10 @@ onBeforeUnmount(() => {
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
.all-capsule {
|
||||
.capsule-item {
|
||||
margin-bottom: 1rem;
|
||||
.item-title {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.text {
|
||||
display: block;
|
||||
margin: 1rem 0rem 0.5rem 0rem;
|
||||
font-size: 0.95rem;
|
||||
.remaining {
|
||||
opacity: 0.6;
|
||||
font-size: 0.85rem;
|
||||
font-style: oblique;
|
||||
}
|
||||
}
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
&.start {
|
||||
.item-title {
|
||||
justify-content: center;
|
||||
opacity: 0.8;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -5,7 +5,8 @@ import App from "@/App.vue";
|
||||
import { createPinia } from "pinia";
|
||||
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
|
||||
// swiper
|
||||
import "swiper/css";
|
||||
import "swiper/scss";
|
||||
import "swiper/scss/pagination";
|
||||
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
|
@ -13,8 +13,6 @@ html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// width: 100dvh;
|
||||
// height: 100dvh;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #333;
|
||||
@ -55,8 +53,8 @@ p {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { h } from "vue";
|
||||
import { SpaCandle } from "@icon-park/vue-next";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
// 时钟
|
||||
export const getCurrentTime = () => {
|
||||
@ -26,48 +25,47 @@ export const getCurrentTime = () => {
|
||||
|
||||
// 时光胶囊
|
||||
export const getTimeCapsule = () => {
|
||||
const now = dayjs();
|
||||
const dayText = {
|
||||
day: "今日",
|
||||
week: "本周",
|
||||
month: "本月",
|
||||
year: "本年",
|
||||
};
|
||||
/**
|
||||
* 计算时间差的函数
|
||||
* @param {String} unit 时间单位,可以是 'day', 'week', 'month', 'year'
|
||||
*/
|
||||
const getDifference = (unit) => {
|
||||
// 获取当前时间单位的开始时间
|
||||
const start = now.startOf(unit);
|
||||
// 获取当前时间单位的结束时间
|
||||
const end = now.endOf(unit);
|
||||
// 计算总的天数或小时数
|
||||
const total = end.diff(start, unit === "day" ? "hour" : "day") + 1;
|
||||
// 计算已经过去的天数或小时数
|
||||
let passed;
|
||||
if (unit === "week" && now.day() === 0) {
|
||||
// 如果是星期日
|
||||
passed = total - 1;
|
||||
} else {
|
||||
passed = now.diff(start, unit === "day" ? "hour" : "day");
|
||||
}
|
||||
const remaining = total - passed;
|
||||
const percentage = (passed / total) * 100;
|
||||
// 返回数据
|
||||
// 日进度
|
||||
const todayStartDate = new Date(new Date().toLocaleDateString()).getTime();
|
||||
const todayPassHours = (new Date() - todayStartDate) / 1000 / 60 / 60;
|
||||
const todayPassHoursPercent = (todayPassHours / 24) * 100;
|
||||
|
||||
// 周进度
|
||||
const weeks = [7, 1, 2, 3, 4, 5, 6];
|
||||
const weekDay = weeks[new Date().getDay()];
|
||||
const weekDayPassPercent = (weekDay / 7) * 100;
|
||||
|
||||
// 月进度
|
||||
const year = new Date().getFullYear();
|
||||
const date = new Date().getDate();
|
||||
const month = new Date().getMonth() + 1;
|
||||
const monthAll = new Date(year, month, 0).getDate();
|
||||
const monthPassPercent = (date / monthAll) * 100;
|
||||
|
||||
// 年进度
|
||||
const yearStartDate = new Date(year, 0, 1).getTime();
|
||||
const yearEndDate = new Date(year + 1, 0, 1).getTime();
|
||||
const yearPassHours = (new Date() - yearStartDate) / 1000 / 60 / 60;
|
||||
const yearTotalHours = (yearEndDate - yearStartDate) / 1000 / 60 / 60;
|
||||
const yearPassPercent = (yearPassHours / yearTotalHours) * 100;
|
||||
|
||||
return {
|
||||
name: dayText[unit],
|
||||
total: total,
|
||||
passed: passed,
|
||||
remaining: remaining,
|
||||
percentage: percentage.toFixed(2),
|
||||
};
|
||||
};
|
||||
return {
|
||||
day: getDifference("day"),
|
||||
week: getDifference("week"),
|
||||
month: getDifference("month"),
|
||||
year: getDifference("year"),
|
||||
day: {
|
||||
elapsed: Math.floor(todayPassHours),
|
||||
pass: Math.floor(todayPassHoursPercent),
|
||||
},
|
||||
week: {
|
||||
elapsed: weekDay,
|
||||
pass: Math.floor(weekDayPassPercent),
|
||||
},
|
||||
month: {
|
||||
elapsed: date,
|
||||
pass: Math.floor(monthPassPercent),
|
||||
},
|
||||
year: {
|
||||
elapsed: month - 1,
|
||||
pass: Math.floor(yearPassPercent),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -16,12 +16,6 @@
|
||||
<span class="bg">{{ siteUrl[0] }}</span>
|
||||
<span class="sm">.{{ siteUrl[1] }}</span>
|
||||
</div>
|
||||
<div class="version">
|
||||
<div class="num">v {{ config.version }}</div>
|
||||
<el-tooltip content="Github 源代码仓库" placement="right" :show-arrow="false">
|
||||
<github-one class="github" theme="outline" size="24" @click="jumpTo(config.github)" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-card class="update">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
|
Loading…
Reference in New Issue
Block a user