Skip to content

Commit

Permalink
feat: 优化一系列问题 #146
Browse files Browse the repository at this point in the history
- 重构进入动画逻辑 #146
- 精简部分代码
- 优化部分动画
- 新增部分设置项
  • Loading branch information
imsyy committed Aug 16, 2023
1 parent fe10751 commit c12ddfb
Show file tree
Hide file tree
Showing 48 changed files with 502 additions and 458 deletions.
23 changes: 3 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
<title>%VITE_SITE_NAME%</title>
<!-- HarmonyOS Sans -->
<!-- 本站 CDN 已开启防盗链,非本站域名不可访问,请更改链接为下方内容,否则自定义字体将失效 -->
<!-- https://s1.hdslb.com/bfs/static/jinkela/long/font/regular.css -->
<link rel="stylesheet" href="https://cdn.imsyy.top/gh/imsyy/file/font/HarmonyOS_Sans/regular.min.css" />
<link rel="stylesheet" href="/loading/loading.min.css">
<link rel="stylesheet" href="https://s1.hdslb.com/bfs/static/jinkela/long/font/regular.css" />
<!-- <link rel="stylesheet" href="https://cdn.imsyy.top/gh/imsyy/file/font/HarmonyOS_Sans/regular.min.css" /> -->
<!-- IE Out -->
<script>
if ( /*@cc_on!@*/ false || (!!window.MSInputMethodContext && !!document.documentMode))
Expand All @@ -28,23 +27,7 @@
</script>
</head>

<body class="loading">
<!--加载动画-->
<div id="loading-box">
<div class="loading-left-bg"></div>
<div class="loading-right-bg"></div>
<div class="spinner-box">
<div class="loader">
<div class="inner one"></div>
<div class="inner two"></div>
<div class="inner three"></div>
</div>
<div class="loading-word">
<p class="loading-title" id="loading-title">%VITE_SITE_NAME%</p>
<span id="loading-text">加载中</span>
</div>
</div>
</div>
<body>
<!-- 主体内容 -->
<div id="app"></div>
<!-- noscript -->
Expand Down
2 changes: 1 addition & 1 deletion 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.5",
"version": "4.1.0",
"type": "module",
"scripts": {
"dev": "vite --host",
Expand Down
Binary file added public/images/background1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background1.webp
Binary file not shown.
Binary file added public/images/background10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background10.webp
Binary file not shown.
Binary file added public/images/background2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background2.webp
Binary file not shown.
Binary file added public/images/background3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background3.webp
Binary file not shown.
Binary file added public/images/background4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background4.webp
Binary file not shown.
Binary file added public/images/background5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background5.webp
Binary file not shown.
Binary file added public/images/background6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background6.webp
Binary file not shown.
Binary file added public/images/background7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background7.webp
Binary file not shown.
Binary file added public/images/background8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background8.webp
Binary file not shown.
Binary file added public/images/background9.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/background9.webp
Binary file not shown.
141 changes: 0 additions & 141 deletions public/loading/loading.css

This file was deleted.

1 change: 0 additions & 1 deletion public/loading/loading.min.css

This file was deleted.

111 changes: 49 additions & 62 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<template>
<div class="animate">
<Background />
<main>
<!-- 加载 -->
<Loading />
<!-- 壁纸 -->
<Background @loadComplete="loadComplete" />
<!-- 主界面 -->
<Transition name="fade" mode="out-in">
<main id="main" v-if="store.imgLoadStatus">
<div class="container" v-show="!store.backgroundShow">
<section class="main" v-show="!store.setOpenState">
<section class="all" v-show="!store.setOpenState">
<MainLeft />
<MainRight v-show="!store.boxOpenState" />
<Box v-show="store.boxOpenState" />
Expand All @@ -24,26 +28,28 @@
>
<component :is="store.mobileOpenState ? CloseSmall : HamburgerButton" />
</Icon>
<!-- 页脚 -->
<Transition name="fade" mode="out-in">
<Footer v-show="!store.backgroundShow && !store.setOpenState" />
</Transition>
</main>
<Footer v-show="!store.backgroundShow && !store.setOpenState" />
</div>
</Transition>
</template>
<script setup>
import { onMounted, onBeforeUnmount, watch } from "vue";
import { onMounted, onBeforeUnmount, watch, nextTick } from "vue";
import { helloInit, checkDays } from "@/utils/getTime.js";
import { HamburgerButton, CloseSmall } from "@icon-park/vue-next";
import { mainStore } from "@/store";
import { Icon } from "@vicons/utils";
import { HamburgerButton, CloseSmall } from "@icon-park/vue-next";
import Loading from "@/components/Loading.vue";
import MainLeft from "@/views/Main/Left.vue";
import MainRight from "@/views/Main/Right.vue";
import Background from "@/components/Background/index.vue";
import Footer from "@/components/Footer/index.vue";
import Background from "@/components/Background.vue";
import Footer from "@/components/Footer.vue";
import Box from "@/views/Box/index.vue";
import MoreSet from "@/views/MoreSet/index.vue";
import cursorInit from "@/utils/cursor.js";
import config from "@/../package.json";
// 新春灯笼
// import "@/utils/lantern.js";
const store = mainStore();
Expand All @@ -52,22 +58,29 @@ const getWidth = () => {
store.setInnerWidth(window.innerWidth);
};
onMounted(() => {
// 自定义鼠标
cursorInit();
// 加载完成事件
window.addEventListener("load", () => {
console.log("加载完成");
// 去除加载标记
document.getElementsByTagName("body")[0].className = "";
// 给加载动画添加结束标记
const loadingBox = document.getElementById("loading-box");
loadingBox.classList.add("loaded");
// 加载完成事件
const loadComplete = () => {
nextTick(() => {
// 欢迎提示
helloInit();
// 默哀模式
checkDays();
});
};
// 监听宽度变化
watch(
() => store.innerWidth,
(value) => {
if (value < 990) {
store.boxOpenState = false;
}
}
);
onMounted(() => {
// 自定义鼠标
cursorInit();
// 屏蔽右键
document.oncontextmenu = () => {
Expand Down Expand Up @@ -116,31 +129,23 @@ onMounted(() => {
);
});
// 监听宽度变化
watch(
() => store.innerWidth,
(value) => {
if (value < 990) {
store.boxOpenState = false;
}
}
);
onBeforeUnmount(() => {
window.removeEventListener("resize", getWidth);
});
</script>

<style lang="scss" scoped>
main {
#main {
transform: scale(1.2);
transition: transform 0.3s;
animation: fade-blur-main-in 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94)
forwards;
animation-delay: 0.5s;
.container {
width: 100%;
height: 100vh;
margin: 0 auto;
@media (max-width: 1200px) {
padding: 0 2vw;
}
.main {
.all {
width: 100%;
height: 100%;
padding: 0 0.75rem;
Expand All @@ -158,8 +163,10 @@ main {
background-color: #00000080;
backdrop-filter: blur(20px);
z-index: 2;
animation: fade;
-webkit-animation: fade 0.5s;
animation: fade 0.5s;
}
@media (max-width: 1200px) {
padding: 0 2vw;
}
}
.menu {
Expand All @@ -174,9 +181,8 @@ main {
background: rgb(0 0 0 / 20%);
backdrop-filter: blur(10px);
border-radius: 6px;
transition: all 0.3s;
animation: fade;
-webkit-animation: fade 0.5s;
transition: transform 0.3s;
animation: fade 0.5s;
&:active {
transform: scale(0.95);
}
Expand All @@ -188,23 +194,4 @@ main {
}
}
}
// 加载动画层
.animate {
transform: scale(1);
transition: all ease 1.25s;
opacity: 1;
filter: blur(0);
width: 100%;
height: 100%;
}
.loading {
.animate {
transform: scale(1.2);
transition: all ease 1.25s;
opacity: 0;
filter: blur(10px);
}
}
</style>
Loading

0 comments on commit c12ddfb

Please sign in to comment.