+ {/* 应该是模拟开机的意思 用了z-index对其他元素进行覆盖,被覆盖元素的鼠标事件也被阻挡*/}
+ {/* 取消鼠标事件阻挡的方法
+ 1. pointer-events: none; 这个属性告诉浏览器不要让元素及其子元素接收鼠标事件
+ 2. 事件委托 在一个共同的父元素上监听事件 然后根据用事件对象的 target 属性来确定实际触发事件的元素*/}
{!wall.booted ? : null}
+ {/* 锁屏 */}
{wall.locked ? : null}
diff --git a/src/containers/background/back.scss b/src/containers/background/back.scss
index 9ace564de..420b8cb49 100644
--- a/src/containers/background/back.scss
+++ b/src/containers/background/back.scss
@@ -23,6 +23,7 @@
z-index: 2;
display: grid;
place-items: center;
+ // 设置鼠标指针在悬停于该元素上时显示为一个进度指示器,通常是一个旋转的等待图标,表明正在执行一个后台操作或等待某个过程完成。 挺好玩的 手机端没这个属性
cursor: progress;
}
@@ -153,6 +154,7 @@
align-items: center;
justify-content: center;
}
+
// https://docs.microsoft.com/en-us/fluent-ui/web-components/components/progress-ring
.progressRing circle {
@@ -170,12 +172,14 @@
stroke-dasharray: 0.01px, 43.97px;
transform: rotate(0deg);
}
+
50% {
stroke-dasharray: 21.99px, 21.99px;
transform: rotate(450deg);
}
+
100% {
stroke-dasharray: 0.01px, 43.97px;
transform: rotate(1080deg);
}
-}
+}
\ No newline at end of file
diff --git a/src/containers/background/index.jsx b/src/containers/background/index.jsx
index d35843e3b..577719cf0 100644
--- a/src/containers/background/index.jsx
+++ b/src/containers/background/index.jsx
@@ -18,11 +18,14 @@ export const Background = () => {
);
};
+// 只有WALLRESTART和WALLSHUTDN会将booted设置成false 触发这个组件
+// 这两个动作也会将dir设置成 -1
+// dir为-1,就会触发下面的如果dir小于0,就给一个几秒后图片和圈圈都消失,然后触发WALLBOOTED这个动作 又将 booted: true, dir: 0,
export const BootScreen = (props) => {
const dispatch = useDispatch();
const wall = useSelector((state) => state.wallpaper);
const [blackout, setBlackOut] = useState(false);
-
+ // 如果dir小于0,就给一个几秒后图片和圈圈都消失,然后触发WALLBOOTED这个动作
useEffect(() => {
if (props.dir < 0) {
setTimeout(() => {
@@ -40,6 +43,7 @@ export const BootScreen = (props) => {
setBlackOut(false);
setTimeout(() => {
dispatch({ type: "WALLBOOTED" });
+ //WALLBOOTED booted: true, dir: 0,
}, 4000);
}, 2000);
}
diff --git a/src/index.css b/src/index.css
index f7e5936b8..5c04d50b8 100644
--- a/src/index.css
+++ b/src/index.css
@@ -150,9 +150,11 @@ i[data-flip="true"] {
.dpShad {
box-shadow: 0 0 6px rgba(0, 0, 0, 0.25);
}
+
.mdShad {
box-shadow: 0 0 8px rgba(41, 41, 41, 0.1);
}
+
.ltShad {
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}
@@ -264,9 +266,10 @@ a {
width: 100%;
position: relative;
height: 100%;
+ /* 这部分是用于设置子元素居中 */
display: flex;
justify-content: center;
align-items: center;
background: #010001;
color: white;
-}
+}
\ No newline at end of file
diff --git a/src/index.jsx b/src/index.jsx
index 34d17a883..b07a785ef 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -7,6 +7,7 @@ import { Provider } from "react-redux";
const root = createRoot(document.getElementById("root"));
root.render(
+ // 这个Suspense用于处理异步加载,当其子组件还在加载时,它会显示fallback属性指定的内容。在这个例子中,当应用还在加载时,会显示一个包含“Loading”的
标签。
@@ -14,6 +15,7 @@ root.render(
}
>
+ {/* 组件用于将Redux store传递给所有的子组件 */}
diff --git a/src/reducers/wallpaper.js b/src/reducers/wallpaper.js
index 008a62c4c..838ee4360 100644
--- a/src/reducers/wallpaper.js
+++ b/src/reducers/wallpaper.js
@@ -1,3 +1,4 @@
+// 从localStorage拿到壁纸
var wps = localStorage.getItem("wps") || 0;
var locked = localStorage.getItem("locked");
@@ -29,15 +30,19 @@ const defState = {
wps: wps,
src: walls[wps],
locked: !(locked == "false"),
+ // import.meta.env.MODE == "development" 这段代码是用来检查当前运行环境是否为开发模式 为true
booted: false || import.meta.env.MODE == "development",
act: "",
+ // 这个属性应该是用来控制锁屏的吧
dir: 0,
};
-
+// state 管理的数据初始状态
+// action是个对象,必须有一个type属性,用来表示将要执行的动作
const wallReducer = (state = defState, action) => {
switch (action.type) {
case "WALLUNLOCK":
localStorage.setItem("locked", false);
+ // 修改之后返回新的state
return {
...state,
locked: false,
@@ -100,6 +105,7 @@ const wallReducer = (state = defState, action) => {
wps: wps,
src: src,
};
+ // 如果都不符合 返回原来的state
default:
return state;
}
From d5f455aab38ca2e62f93c2ce5d4769661a830eab Mon Sep 17 00:00:00 2001
From: czc <1040398400@qq.com>
Date: Sun, 11 Aug 2024 19:17:10 +0800
Subject: [PATCH 2/2] =?UTF-8?q?20240811=20=E7=9C=8B=E5=88=B0=E4=BA=86Deskt?=
=?UTF-8?q?opApp=E9=87=8C=E9=9D=A2=E7=9A=84Icon?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/App.jsx | 3 +++
src/containers/background/back.scss | 8 +++++---
src/containers/background/index.jsx | 11 ++++++++++-
src/reducers/wallpaper.js | 2 +-
4 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/App.jsx b/src/App.jsx
index 047ce37aa..e0698835b 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -168,9 +168,12 @@ function App() {
{!wall.booted ? : null}
{/* 锁屏 */}
{wall.locked ? : null}
+ {/* appwrap position: relative; */}
+ {/* desktop position: absolute;*/}
+ {/* DesktopApp居然才是桌面图标 后面map两个不是 */}
{Object.keys(Applications).map((key, idx) => {
var WinApp = Applications[key];
diff --git a/src/containers/background/back.scss b/src/containers/background/back.scss
index 420b8cb49..5922bcb47 100644
--- a/src/containers/background/back.scss
+++ b/src/containers/background/back.scss
@@ -10,6 +10,7 @@
background-repeat: no-repeat;
background-size: cover;
background-position: center;
+ // 这个属性使得.background类的任何CSS属性变化时,都能在0.2秒内平滑过渡。ease表示过渡的速度曲线将从慢到快再到慢,产生更自然的加速和减速效果。
transition: all 0.2s ease;
}
@@ -28,7 +29,7 @@
}
.lockscreen {
- position: absolute;
+ position: absolute; //这里加个绝对定位 脱离文档流 可以实现覆盖全屏的同时不影响正常页面 否则你注释掉看看
top: 0;
left: 0;
min-width: 100vw;
@@ -39,7 +40,7 @@
display: flex;
flex-direction: column;
align-items: center;
- transition: all 1s ease-in-out;
+ transition: all 1s ease-in-out; //这个属性控制慢入慢出的效果 注释掉看看改变屏幕尺寸的效果
&[data-unlock="true"] {
opacity: 0;
@@ -51,6 +52,7 @@
transition: all 200ms ease-in-out;
}
+ // 为了美观 data-blur="true"时给一个半透明的模糊层
&[data-blur="true"]::after {
content: "";
position: absolute;
@@ -98,7 +100,7 @@
&[data-faded="false"] {
opacity: 1;
- pointer-events: auto;
+ pointer-events: auto; // 上面pointer-events: none;把鼠标事件禁止了 这里元素展示了 可以放开了
transform: translateY(0px);
}
diff --git a/src/containers/background/index.jsx b/src/containers/background/index.jsx
index 577719cf0..bf9e2c5ea 100644
--- a/src/containers/background/index.jsx
+++ b/src/containers/background/index.jsx
@@ -72,7 +72,7 @@ export const BootScreen = (props) => {
export const LockScreen = (props) => {
const wall = useSelector((state) => state.wallpaper);
- const [lock, setLock] = useState(false);
+ const [lock, setLock] = useState(false);//这个变量用来做解锁的作用,false展示锁屏 true展示登录那个界面
const [unlocked, setUnLock] = useState(false);
const [password, setPass] = useState("");
const [passType, setType] = useState(1);
@@ -114,15 +114,20 @@ export const LockScreen = (props) => {
return (
+ {/* 时间 data-faded={lock} 这个属性是为了控制解锁时时间隐藏*/}
+ {/* mt-40 Tailwind CSS中 margin-top 40乘以默认Tailwind的单位 一般是 0.25rem*/}
{new Date().toLocaleTimeString("en-US", {
@@ -139,8 +144,12 @@ export const LockScreen = (props) => {
})}
+ {/* 图片 */}
+ {/* 用的是作者写的通用组件 */}