Skip to content

Commit

Permalink
feat: 适配天气 API #162 #151
Browse files Browse the repository at this point in the history
  • Loading branch information
imsyy committed Jul 3, 2023
1 parent 7048a13 commit 9d2290d
Show file tree
Hide file tree
Showing 10 changed files with 3,678 additions and 127 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ VITE_DESC_TEXT_OTHER = "哎呀,这都被你发现了( 再点击一次可关
## 请前往 高德开放平台注册 Web服务 Key
## 请注意不是 Web端 (JS API),免费申请,每日上限 5000 次
## 此处提供的服务可能会超量从而无法访问,请自行申请!请自行申请!请自行申请!
## 若此处设为空则调用 教书先生 API https://api.oioweb.cn/doc/weather/GetWeather
VITE_WEATHER_KEY = "6c13af6fc30868bee488faf2cc652ab4"

# 建站日期
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"github": "https://github.com/imsyy/home",
"home": "https://imsyy.top",
"private": true,
"version": "4.0.4",
"version": "4.0.5",
"type": "module",
"scripts": {
"dev": "vite --host",
Expand Down Expand Up @@ -33,7 +33,7 @@
"unplugin-auto-import": "^0.11.2",
"unplugin-vue-components": "^0.22.8",
"vite": "^3.1.0",
"vite-plugin-html": "^3.0.6",
"vite-plugin-html": "^3.2.0",
"vite-plugin-pwa": "^0.14.1"
}
}
13 changes: 6 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

163 changes: 86 additions & 77 deletions public/loading/loading.css
Original file line number Diff line number Diff line change
@@ -1,132 +1,141 @@
* {
margin: 0;
padding: 0;
margin: 0;
padding: 0;
}

#loading-box .loading-left-bg,
#loading-box .loading-right-bg {
position: fixed;
z-index: 999998;
width: 50%;
height: 100%;
background-color: #515151e0;
transition: all 0.75s cubic-bezier(0.42, 0, 0, 1.01);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
position: fixed;
z-index: 999;
width: 50%;
height: 100%;
background-color: #515151e0;
transition: all 0.75s cubic-bezier(0.42, 0, 0, 1.01);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
}

#loading-box .loading-right-bg {
right: 0;
right: 0;
}

#loading-box>.spinner-box {
position: fixed;
z-index: 999999;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
#loading-box > .spinner-box {
position: fixed;
z-index: 999999;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
}

#loading-box .spinner-box .loading-word {
position: absolute;
color: #ffffff;
font-size: 0.95rem;
transform: translateY(64px);
text-align: center;
position: absolute;
color: #ffffff;
font-size: 0.95rem;
transform: translateY(64px);
text-align: center;
}

.loading-title {
font-size: 1.25rem;
margin: 20px 10px 4px 10px;
font-size: 1.25rem;
margin: 20px 10px 4px 10px;
}

#loading-box .spinner-box .configure-core {
width: 100%;
height: 100%;
background-color: #37474f;
width: 100%;
height: 100%;
background-color: #37474f;
}

/* 加载完成 */
.loaded .loading-left-bg {
transform: translate(-100%, 0);
transform: translate(-100%, 0);
}

.loaded .loading-right-bg {
transform: translate(100%, 0);
transform: translate(100%, 0);
}

.loaded .spinner-box {
display: none !important;
display: none !important;
}

.loader {
position: absolute;
top: calc(50% - 32px);
left: calc(50% - 32px);
width: 64px;
height: 64px;
border-radius: 50%;
perspective: 800px;
transition: all 0.7s cubic-bezier(0.42, 0, 0, 1.01);
position: absolute;
top: calc(50% - 32px);
left: calc(50% - 32px);
width: 64px;
height: 64px;
border-radius: 50%;
perspective: 800px;
transition: all 0.7s cubic-bezier(0.42, 0, 0, 1.01);
}

.inner {
position: absolute;
box-sizing: border-box;
width: 100%;
height: 100%;
border-radius: 50%;
position: absolute;
box-sizing: border-box;
width: 100%;
height: 100%;
border-radius: 50%;
}

.inner.one {
left: 0%;
top: 0%;
animation: rotate-one 1s linear infinite;
border-bottom: 3px solid #EFEFFA;
left: 0%;
top: 0%;
animation: rotate-one 1s linear infinite;
border-bottom: 3px solid #efeffa;
}

.inner.two {
right: 0%;
top: 0%;
animation: rotate-two 1s linear infinite;
border-right: 3px solid #EFEFFA;
right: 0%;
top: 0%;
animation: rotate-two 1s linear infinite;
border-right: 3px solid #efeffa;
}

.inner.three {
right: 0%;
bottom: 0%;
animation: rotate-three 1s linear infinite;
border-top: 3px solid #EFEFFA;
right: 0%;
bottom: 0%;
animation: rotate-three 1s linear infinite;
border-top: 3px solid #efeffa;
}

noscript {
z-index: 1000;
position: absolute;
display: flex;
justify-content: center;
width: 100%;
margin-top: 26px;
}

@keyframes rotate-one {
0% {
transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
}
0% {
transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg);
}

100% {
transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
}
100% {
transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg);
}
}

@keyframes rotate-two {
0% {
transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
}
0% {
transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg);
}

100% {
transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
}
100% {
transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg);
}
}

@keyframes rotate-three {
0% {
transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
}

100% {
transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
}
}
0% {
transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg);
}

100% {
transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg);
}
}
2 changes: 1 addition & 1 deletion public/loading/loading.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ onMounted(() => {
window.addEventListener("mousedown", (event) => {
if (event.button == 1) {
store.backgroundShow = !store.backgroundShow;
if (store.backgroundShow) {
ElMessage("已开启壁纸展示状态");
} else {
ElMessage("已退出壁纸展示状态");
}
ElMessage({
message: `${store.backgroundShow ? "开启" : "退出"}壁纸展示状态`,
grouping: true,
});
}
});
Expand All @@ -96,18 +95,19 @@ onMounted(() => {
window.addEventListener("resize", getWidth);
// 控制台输出
let styleTitle1 = "font-size: 20px;font-weight: 600;color: rgb(244,167,89);";
let styleTitle2 = "font-size:12px;color: rgb(244,167,89);";
let styleContent = "color: rgb(30,152,255);";
let title1 = "無名の主页";
let title2 = `
const styleTitle1 =
"font-size: 20px;font-weight: 600;color: rgb(244,167,89);";
const styleTitle2 = "font-size:12px;color: rgb(244,167,89);";
const styleContent = "color: rgb(30,152,255);";
const title1 = "無名の主页";
const title2 = `
_____ __ __ _______ ____ __
|_ _| \\/ |/ ____\\ \\ / /\\ \\ / /
| | | \\ / | (___ \\ \\_/ / \\ \\_/ /
| | | |\\/| |\\___ \\ \\ / \\ /
_| |_| | | |____) | | | | |
| | | \\ / | (___ \\ \\_/ / \\ \\_/ /
| | | |\\/| |\\___ \\ \\ / \\ /
_| |_| | | |____) | | | | |
|_____|_| |_|_____/ |_| |_|`;
let content = `\n\n版本: ${config.version}\n主页: ${config.home}\nGithub: ${config.github}`;
const content = `\n\n版本: ${config.version}\n主页: ${config.home}\nGithub: ${config.github}`;
console.info(
`%c${title1} %c${title2} %c${content}`,
styleTitle1,
Expand Down
7 changes: 7 additions & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ export const getWeather = async (key, city) => {
);
return await res.json();
};

// 获取教书先生天气 API
// https://api.oioweb.cn/doc/weather/GetWeather
export const getOtherWeather = async () => {
const res = await fetch("https://api.oioweb.cn/api/weather/GetWeather");
return await res.json();
};
Loading

0 comments on commit 9d2290d

Please sign in to comment.