commit
e5947ebfa9
10
.hintrc
10
.hintrc
@ -4,6 +4,14 @@
|
|||||||
],
|
],
|
||||||
"hints": {
|
"hints": {
|
||||||
"compat-api/html": "off",
|
"compat-api/html": "off",
|
||||||
"no-protocol-relative-urls": "off"
|
"no-protocol-relative-urls": "off",
|
||||||
|
"compat-api/css": [
|
||||||
|
"default",
|
||||||
|
{
|
||||||
|
"ignore": [
|
||||||
|
"backdrop-filter"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1 +0,0 @@
|
|||||||
if('serviceWorker' in navigator) navigator.serviceWorker.register('/dev-sw.js?dev-sw', { scope: '/', type: 'classic' })
|
|
@ -1 +0,0 @@
|
|||||||
if(!self.define){let e,s={};const t=(t,i)=>(t=new URL(t+".js",i).href,s[t]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=t,e.onload=s,document.head.appendChild(e)}else e=t,importScripts(t),s()})).then((()=>{let e=s[t];if(!e)throw new Error(`Module ${t} didn’t register its module`);return e})));self.define=(i,n)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(s[o])return;let r={};const c=e=>t(e,o),l={module:{uri:o},exports:r,require:c};s[o]=Promise.all(i.map((e=>l[e]||c(e)))).then((e=>(n(...e),r)))}}define(["./workbox-082d0e8a"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"3ca0b8505b4bec776b69afdba2768812"},{revision:null,url:"index.html"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"),{allowlist:[/^index.html$/]})),e.registerRoute(/(.*?)\.(js|css|woff2|woff|ttf)/,new e.CacheFirst({cacheName:"js-css-cache",plugins:[]}),"GET"),e.registerRoute(/(.*?)\.(png|jpe?g|svg|gif|bmp|psd|tiff|tga|eps)/,new e.CacheFirst({cacheName:"image-cache",plugins:[]}),"GET")}));
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -30,9 +30,9 @@ const changeBg = (type) => {
|
|||||||
} else if (type == 1) {
|
} else if (type == 1) {
|
||||||
bgUrl.value = "https://api.dujin.org/bing/1920.php";
|
bgUrl.value = "https://api.dujin.org/bing/1920.php";
|
||||||
} else if (type == 2) {
|
} else if (type == 2) {
|
||||||
bgUrl.value = "https://api.ixiaowai.cn/gqapi/gqapi.php";
|
bgUrl.value = "https://api.btstu.cn/sjbz/api.php?lx=fengjing&format=images";
|
||||||
} else if (type == 3) {
|
} else if (type == 3) {
|
||||||
bgUrl.value = "https://api.ixiaowai.cn/api/api.php";
|
bgUrl.value = "https://www.dmoe.cc/random.php";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<span>时光胶囊</span>
|
<span>时光胶囊</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="text"
|
<span class="text"
|
||||||
>今日已经度过了 {{ timeData.day.start }} 小时</span
|
>今日已经度过了 {{ timeData.day.elapsed }} 小时</span
|
||||||
>
|
>
|
||||||
<el-progress
|
<el-progress
|
||||||
:text-inside="true"
|
:text-inside="true"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
:percentage="timeData.day.pass"
|
:percentage="timeData.day.pass"
|
||||||
/>
|
/>
|
||||||
<span class="text"
|
<span class="text"
|
||||||
>本周已经度过了 {{ timeData.week.start }} 天</span
|
>本周已经度过了 {{ timeData.week.elapsed }} 天</span
|
||||||
>
|
>
|
||||||
<el-progress
|
<el-progress
|
||||||
:text-inside="true"
|
:text-inside="true"
|
||||||
@ -25,7 +25,7 @@
|
|||||||
:percentage="timeData.week.pass"
|
:percentage="timeData.week.pass"
|
||||||
/>
|
/>
|
||||||
<span class="text"
|
<span class="text"
|
||||||
>本月已经度过了 {{ timeData.month.start }} 天</span
|
>本月已经度过了 {{ timeData.month.elapsed }} 天</span
|
||||||
>
|
>
|
||||||
<el-progress
|
<el-progress
|
||||||
:text-inside="true"
|
:text-inside="true"
|
||||||
@ -33,7 +33,7 @@
|
|||||||
:percentage="timeData.month.pass"
|
:percentage="timeData.month.pass"
|
||||||
/>
|
/>
|
||||||
<span class="text"
|
<span class="text"
|
||||||
>今年已经度过了 {{ timeData.year.start }} 个月</span
|
>今年已经度过了 {{ timeData.year.elapsed }} 个月</span
|
||||||
>
|
>
|
||||||
<el-progress
|
<el-progress
|
||||||
:text-inside="true"
|
:text-inside="true"
|
||||||
|
@ -1,20 +1,29 @@
|
|||||||
import {
|
import { h } from "vue";
|
||||||
h
|
import { SpaCandle } from "@icon-park/vue-next";
|
||||||
} from "vue";
|
|
||||||
import {
|
|
||||||
SpaCandle
|
|
||||||
} from "@icon-park/vue-next";
|
|
||||||
|
|
||||||
// 时钟
|
// 时钟
|
||||||
export const getCurrentTime = () => {
|
export const getCurrentTime = () => {
|
||||||
let time = new Date();
|
let time = new Date();
|
||||||
let year = time.getFullYear();
|
let year = time.getFullYear();
|
||||||
let month = time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1;
|
let month =
|
||||||
let day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate();
|
time.getMonth() + 1 < 10
|
||||||
let hour = time.getHours() < 10 ? '0' + time.getHours() : time.getHours();
|
? "0" + (time.getMonth() + 1)
|
||||||
let minute = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes();
|
: time.getMonth() + 1;
|
||||||
let second = time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds();
|
let day = time.getDate() < 10 ? "0" + time.getDate() : time.getDate();
|
||||||
let weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
let hour = time.getHours() < 10 ? "0" + time.getHours() : time.getHours();
|
||||||
|
let minute =
|
||||||
|
time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes();
|
||||||
|
let second =
|
||||||
|
time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds();
|
||||||
|
let weekday = [
|
||||||
|
"星期日",
|
||||||
|
"星期一",
|
||||||
|
"星期二",
|
||||||
|
"星期三",
|
||||||
|
"星期四",
|
||||||
|
"星期五",
|
||||||
|
"星期六",
|
||||||
|
];
|
||||||
let currentTime = {
|
let currentTime = {
|
||||||
year,
|
year,
|
||||||
month,
|
month,
|
||||||
@ -23,51 +32,59 @@ export const getCurrentTime = () => {
|
|||||||
minute,
|
minute,
|
||||||
second,
|
second,
|
||||||
weekday: weekday[time.getDay()],
|
weekday: weekday[time.getDay()],
|
||||||
}
|
};
|
||||||
return currentTime;
|
return currentTime;
|
||||||
}
|
};
|
||||||
|
|
||||||
// 时光胶囊
|
// 时光胶囊
|
||||||
export const getTimeCapsule = () => {
|
export const getTimeCapsule = () => {
|
||||||
// 日进度
|
// 日进度
|
||||||
let todayStartDate = new Date(new Date().toLocaleDateString()).getTime();
|
const todayStartDate = new Date(new Date().toLocaleDateString()).getTime();
|
||||||
let todayPassHours = (new Date() - todayStartDate) / 1000 / 60 / 60;
|
const todayPassHours = (new Date() - todayStartDate) / 1000 / 60 / 60;
|
||||||
let todayPassHoursPercent = (todayPassHours / 24) * 100;
|
const todayPassHoursPercent = (todayPassHours / 24) * 100;
|
||||||
|
|
||||||
// 周进度
|
// 周进度
|
||||||
let weeks = [7, 1, 2, 3, 4, 5, 6];
|
const weeks = [7, 1, 2, 3, 4, 5, 6];
|
||||||
let weekDay = weeks[new Date().getDay()];
|
const weekDay = weeks[new Date().getDay()];
|
||||||
let weekDayPassPercent = (weekDay / 7) * 100;
|
const weekDayPassPercent = (weekDay / 7) * 100;
|
||||||
|
|
||||||
// 月进度
|
// 月进度
|
||||||
let year = new Date().getFullYear();
|
const year = new Date().getFullYear();
|
||||||
let date = new Date().getDate();
|
const date = new Date().getDate();
|
||||||
let month = new Date().getMonth() + 1;
|
const month = new Date().getMonth() + 1;
|
||||||
let monthAll = new Date(year, month, 0).getDate();
|
const monthAll = new Date(year, month, 0).getDate();
|
||||||
let monthPassPercent = (date / monthAll) * 100;
|
const monthPassPercent = (date / monthAll) * 100;
|
||||||
|
|
||||||
// 年进度
|
// 年进度
|
||||||
let yearPass = (month / 12) * 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 {
|
return {
|
||||||
day: {
|
day: {
|
||||||
start: parseInt(todayPassHours),
|
elapsed: Math.floor(todayPassHours),
|
||||||
pass: parseInt(todayPassHoursPercent),
|
pass: Math.floor(todayPassHoursPercent),
|
||||||
},
|
},
|
||||||
week: {
|
week: {
|
||||||
start: weekDay,
|
elapsed: weekDay,
|
||||||
pass: parseInt(weekDayPassPercent),
|
pass: Math.floor(weekDayPassPercent),
|
||||||
},
|
},
|
||||||
month: {
|
month: {
|
||||||
start: date,
|
elapsed: date,
|
||||||
pass: parseInt(monthPassPercent),
|
pass: Math.floor(monthPassPercent),
|
||||||
},
|
},
|
||||||
year: {
|
year: {
|
||||||
start: month == 0 ? month : month - 1,
|
elapsed: month - 1,
|
||||||
pass: parseInt(yearPass),
|
pass: Math.floor(yearPassPercent),
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
// 欢迎提示
|
// 欢迎提示
|
||||||
export const helloInit = () => {
|
export const helloInit = () => {
|
||||||
let hour = new Date().getHours();
|
const hour = new Date().getHours();
|
||||||
let hello = null;
|
let hello = null;
|
||||||
if (hour < 6) {
|
if (hour < 6) {
|
||||||
hello = "凌晨好";
|
hello = "凌晨好";
|
||||||
@ -90,32 +107,33 @@ export const helloInit = () => {
|
|||||||
dangerouslyUseHTMLString: true,
|
dangerouslyUseHTMLString: true,
|
||||||
message: `<strong>${hello}</strong> 欢迎来到我的主页`,
|
message: `<strong>${hello}</strong> 欢迎来到我的主页`,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 默哀模式
|
// 默哀模式
|
||||||
|
const anniversaries = {
|
||||||
|
4.4: "清明节",
|
||||||
|
5.12: "汶川大地震纪念日",
|
||||||
|
7.7: "中国人民抗日战争纪念日",
|
||||||
|
9.18: "九·一八事变纪念日",
|
||||||
|
12.13: "南京大屠杀死难者国家公祭日",
|
||||||
|
};
|
||||||
export const checkDays = () => {
|
export const checkDays = () => {
|
||||||
let myDate = new Date;
|
const myDate = new Date();
|
||||||
let mon = myDate.getMonth() + 1;
|
const mon = myDate.getMonth() + 1;
|
||||||
let date = myDate.getDate();
|
const date = myDate.getDate();
|
||||||
let days = ['4.4', '5.12', '7.7', '9.9', '9.18', '12.13'];
|
const key = `${mon}.${date}`;
|
||||||
for (let day of days) {
|
if (anniversaries.hasOwnProperty(key)) {
|
||||||
let d = day.split('.');
|
console.log(`今天是${anniversaries[key]}`);
|
||||||
if (mon == d[0] && date == d[1]) {
|
const gray = document.createElement("style");
|
||||||
console.log("今天是纪念日");
|
gray.innerHTML = "html{filter: grayscale(100%)}";
|
||||||
let gray = document.createElement("style");
|
document.head.appendChild(gray);
|
||||||
document.body.appendChild(gray);
|
|
||||||
gray.innerHTML = "html{-webkit-filter:grayscale(100%);-moz-filter:grayscale(100%);-ms-filter:grayscale(100%);-o-filter:grayscale(100%);filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);_filter:none}";
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "今天是中国国家纪念日",
|
message: `今天是${anniversaries[key]}`,
|
||||||
duration: 14000,
|
duration: 14000,
|
||||||
icon: h(SpaCandle, {
|
icon: h(SpaCandle, { theme: "filled", fill: "#efefef" }),
|
||||||
theme: "filled",
|
|
||||||
fill: "#efefef",
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
// 建站日期统计
|
// 建站日期统计
|
||||||
export const siteDateStatistics = (startDate) => {
|
export const siteDateStatistics = (startDate) => {
|
||||||
@ -125,10 +143,14 @@ export const siteDateStatistics = (startDate) => {
|
|||||||
const differenceInMonths = differenceInDays / 30;
|
const differenceInMonths = differenceInDays / 30;
|
||||||
const differenceInYears = differenceInMonths / 12;
|
const differenceInYears = differenceInMonths / 12;
|
||||||
if (differenceInYears >= 1) {
|
if (differenceInYears >= 1) {
|
||||||
return `本站已经苟活了 ${Math.floor(differenceInYears)} 年 ${Math.floor(differenceInMonths % 12)} 月 ${Math.round(differenceInDays % 30)} 天`;
|
return `本站已经苟活了 ${Math.floor(differenceInYears)} 年 ${Math.floor(
|
||||||
|
differenceInMonths % 12
|
||||||
|
)} 月 ${Math.round(differenceInDays % 30)} 天`;
|
||||||
} else if (differenceInMonths >= 1) {
|
} else if (differenceInMonths >= 1) {
|
||||||
return `本站已经苟活了 ${Math.floor(differenceInMonths)} 月 ${Math.round(differenceInDays % 30)} 天`;
|
return `本站已经苟活了 ${Math.floor(differenceInMonths)} 月 ${Math.round(
|
||||||
|
differenceInDays % 30
|
||||||
|
)} 天`;
|
||||||
} else {
|
} else {
|
||||||
return `本站已经苟活了 ${Math.round(differenceInDays)} 天`;
|
return `本站已经苟活了 ${Math.round(differenceInDays)} 天`;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
@ -45,10 +45,6 @@ export default ({
|
|||||||
}),
|
}),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
registerType: 'autoUpdate',
|
registerType: 'autoUpdate',
|
||||||
devOptions: {
|
|
||||||
enabled: true,
|
|
||||||
navigateFallbackAllowlist: [/^index.html$/]
|
|
||||||
},
|
|
||||||
workbox: {
|
workbox: {
|
||||||
skipWaiting: true,
|
skipWaiting: true,
|
||||||
clientsClaim: true,
|
clientsClaim: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user