After Width: | Height: | Size: 366 KiB |
After Width: | Height: | Size: 216 KiB |
After Width: | Height: | Size: 468 KiB |
After Width: | Height: | Size: 192 KiB |
After Width: | Height: | Size: 196 KiB |
After Width: | Height: | Size: 258 KiB |
After Width: | Height: | Size: 241 KiB |
After Width: | Height: | Size: 196 KiB |
After Width: | Height: | Size: 193 KiB |
After Width: | Height: | Size: 202 KiB |
After Width: | Height: | Size: 199 KiB |
After Width: | Height: | Size: 181 KiB |
@ -0,0 +1,104 @@
|
|||||||
|
import React, { FC, useEffect, useState } from 'react';
|
||||||
|
import styles from './index.less';
|
||||||
|
import { Input, Progress, message } from 'antd';
|
||||||
|
interface PageProps {
|
||||||
|
open: boolean;
|
||||||
|
onCancel: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const GBase: FC<PageProps> = ({
|
||||||
|
open = false,
|
||||||
|
onCancel
|
||||||
|
}) => {
|
||||||
|
const [active, setActive] = useState(1);
|
||||||
|
const [password, setPassword] = useState('');
|
||||||
|
const [confirmPassword, setConfirmPassword] = useState('');
|
||||||
|
const [percentVal, setPercentVal] = useState(0);
|
||||||
|
|
||||||
|
// 监听是否到安装进度条步骤
|
||||||
|
useEffect(() => {
|
||||||
|
if (active == 11) {
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
setPercentVal((val) => {
|
||||||
|
const randomStep = Math.round(Math.random() * (100 / 10));
|
||||||
|
const newPercent = val + randomStep;
|
||||||
|
|
||||||
|
if (newPercent >= 100) {
|
||||||
|
clearInterval(interval);
|
||||||
|
setValue()
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newPercent;
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}
|
||||||
|
}, [active])
|
||||||
|
|
||||||
|
// 设置安装步骤进度
|
||||||
|
const setValue = () => {
|
||||||
|
setActive((e) => { return e + 1 })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 安装完成后 记录安装的信息
|
||||||
|
const installSuccess = () => {
|
||||||
|
let installExe: any = localStorage.getItem('installExe')
|
||||||
|
let data = JSON.parse(installExe);
|
||||||
|
data[0].select = true;
|
||||||
|
localStorage.setItem('installExe', JSON.stringify(data));
|
||||||
|
onCancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
const verifyPassword = () => {
|
||||||
|
if (password.trim().length == 0 || confirmPassword.trim().length == 0) {
|
||||||
|
message.info('请输入密码!')
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (password != confirmPassword) {
|
||||||
|
message.error('两次输入的密码不相同!');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return <>
|
||||||
|
{
|
||||||
|
open &&
|
||||||
|
<div className={styles.modalOverlay}>
|
||||||
|
<div className={styles.modal}>
|
||||||
|
<img src={require(`../../../assets/images/gbase/${active}.png`)} width={689} height={508} />
|
||||||
|
|
||||||
|
{active == 1 && <div className={styles.a1} onClick={() => setValue()}></div>}
|
||||||
|
{(active > 1 && active != 11) && <div className={styles.a2} onClick={() => {
|
||||||
|
|
||||||
|
if (active == 8 && verifyPassword()) return
|
||||||
|
|
||||||
|
if (active == 12) { installSuccess(); return }
|
||||||
|
|
||||||
|
setValue()
|
||||||
|
}}></div>}
|
||||||
|
|
||||||
|
{/* 定位元素 */}
|
||||||
|
{active == 3 && <div>
|
||||||
|
<div className={styles.dian}></div>
|
||||||
|
<div className={`${styles.dian} ${styles.dian1}`}></div>
|
||||||
|
<div className={styles.last}>下一步(N)</div>
|
||||||
|
</div>}
|
||||||
|
|
||||||
|
{active == 8 && <div>
|
||||||
|
<Input value={password} onChange={(e) => { setPassword(e.target.value) }} className={styles.input1} />
|
||||||
|
<Input value={confirmPassword} onChange={(e) => { setConfirmPassword(e.target.value) }} className={styles.input2} />
|
||||||
|
</div>}
|
||||||
|
|
||||||
|
{active == 11 && <div className={styles.progress}>
|
||||||
|
<Progress percent={percentVal} steps={41} size={[9, 19]} strokeColor={'rgb(56, 158, 13)'} trailColor={'rgba(0,0,0,0)'} showInfo={false} />
|
||||||
|
</div>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
};
|
||||||
|
|
||||||
|
export default GBase;
|
@ -0,0 +1,96 @@
|
|||||||
|
.modalOverlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
-webkit-user-select: none; /* Safari */
|
||||||
|
-moz-user-select: none; /* Firefox */
|
||||||
|
-ms-user-select: none; /* IE10+/Edge */
|
||||||
|
user-select: none; /* 标准语法 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
position: relative;
|
||||||
|
width: 689px;
|
||||||
|
height: 508px;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
.a1 {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 8px;
|
||||||
|
left: 385px;
|
||||||
|
width: 40px;
|
||||||
|
height: 35px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a2 {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 8px;
|
||||||
|
right: 15px;
|
||||||
|
width: 115px;
|
||||||
|
height: 35px;
|
||||||
|
cursor: pointer;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dian {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 101px;
|
||||||
|
right: 324px;
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dian1 {
|
||||||
|
bottom: 133px;
|
||||||
|
background-color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.last {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 25px;
|
||||||
|
right: 40px;
|
||||||
|
color: #444;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input1, .input2 {
|
||||||
|
width: 344px;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input1 {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 251px;
|
||||||
|
right: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input2 {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 208px;
|
||||||
|
right: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress {
|
||||||
|
height: 20px;
|
||||||
|
width: 450px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 15px;
|
||||||
|
background-color: #DCDFE6;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|