Commit ce85402c authored by haiyoucuv's avatar haiyoucuv

init

parent f9fc3e7b
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
bottom: 0; bottom: 0;
right: 0; right: 0;
left: 0; left: 0;
background-color: rgba(0, 0, 0, 0.9); background-color: rgba(0, 0, 0, 0.8);
z-index: 2000; z-index: 2000;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
\ No newline at end of file
...@@ -5,6 +5,8 @@ import NewcomerPanel from "@/panels/NewcomerPanel/NewcomerPanel.tsx"; ...@@ -5,6 +5,8 @@ import NewcomerPanel from "@/panels/NewcomerPanel/NewcomerPanel.tsx";
import WedExpPanel from "@/panels/WedExpPanel/WedExpPanel.tsx"; import WedExpPanel from "@/panels/WedExpPanel/WedExpPanel.tsx";
import SignSucPanel from "@/panels/SignSucPanel/SignSucPanel.tsx"; import SignSucPanel from "@/panels/SignSucPanel/SignSucPanel.tsx";
import VideoPanel from "@/panels/VideoPanel/VideoPanel.tsx"; import VideoPanel from "@/panels/VideoPanel/VideoPanel.tsx";
import GuidePanel from "@/panels/GuidePanel/GuidePanel.tsx";
import top from "@/pages/HomePage/Top/Top.tsx";
// 弹窗优先级配置Map,key为弹窗组件名(建议用组件.displayName或组件名字符串),value为优先级数值 // 弹窗优先级配置Map,key为弹窗组件名(建议用组件.displayName或组件名字符串),value为优先级数值
// 数值越大优先级越高,未配置的默认0 // 数值越大优先级越高,未配置的默认0
...@@ -13,6 +15,7 @@ const modalPriorityMap = new Map<ComponentType<any>, number>([ ...@@ -13,6 +15,7 @@ const modalPriorityMap = new Map<ComponentType<any>, number>([
[WedExpPanel, 15], [WedExpPanel, 15],
[SignSucPanel, 15], [SignSucPanel, 15],
[VideoPanel, 10], [VideoPanel, 10],
[GuidePanel, 100],
]); ]);
interface ModalItem { interface ModalItem {
...@@ -29,9 +32,10 @@ interface ModalCtrlState { ...@@ -29,9 +32,10 @@ interface ModalCtrlState {
export class ModalCtrl extends Component<{}, ModalCtrlState> { export class ModalCtrl extends Component<{}, ModalCtrlState> {
state = { state = {
modals: [], modals: [],
showMask: true,
}; };
static showModal: (Component: ComponentType<any>, props?: any) => void = null; static showModal: (Component: ComponentType<any>, props?: any, showMask?: boolean) => void = null;
static closeModal: (Component?: ComponentType<any>) => void = null; static closeModal: (Component?: ComponentType<any>) => void = null;
static closeAllModal: () => void = null; static closeAllModal: () => void = null;
...@@ -47,12 +51,12 @@ export class ModalCtrl extends Component<{}, ModalCtrlState> { ...@@ -47,12 +51,12 @@ export class ModalCtrl extends Component<{}, ModalCtrlState> {
ModalCtrl.closeAllModal = null; ModalCtrl.closeAllModal = null;
} }
showModal = (Component: ComponentType<any>, props: any = {}) => { showModal = (Component: ComponentType<any>, props: any = {}, showMask = true) => {
const key = `modal_${Date.now()}_${Math.random()}`; const key = `modal_${Date.now()}_${Math.random()}`;
const priority = modalPriorityMap.get(Component) || 0; const priority = modalPriorityMap.get(Component) || 0;
const modals = this.state.modals; const modals = this.state.modals;
modals.push({ key, Component, props, priority }) modals.push({ key, Component, props, priority, showMask });
modals.sort((a, b) => { modals.sort((a, b) => {
return (a.priority || 0) - (b.priority || 0); return (a.priority || 0) - (b.priority || 0);
}); });
...@@ -85,7 +89,11 @@ export class ModalCtrl extends Component<{}, ModalCtrlState> { ...@@ -85,7 +89,11 @@ export class ModalCtrl extends Component<{}, ModalCtrlState> {
const topModal = modals[modals.length - 1]; const topModal = modals[modals.length - 1];
return ( return (
<> <>
<div className={styles.modalManagerBg} key={topModal.key} style={{ zIndex: 2000 }}> <div
className={styles.modalManagerBg}
key={topModal.key}
style={{ zIndex: 2000, backgroundColor: `rgba(0,0,0, ${topModal.showMask ? 0.7 : 0})` }}
>
<topModal.Component {...topModal.props}/> <topModal.Component {...topModal.props}/>
</div> </div>
</> </>
......
...@@ -77,7 +77,7 @@ class HomePage extends React.Component<any, any> { ...@@ -77,7 +77,7 @@ class HomePage extends React.Component<any, any> {
</div> </div>
</div> </div>
{!guideFlag && <GuidePanel />} {/*{!guideFlag && <GuidePanel />}*/}
</>; </>;
} }
} }
......
...@@ -21,6 +21,7 @@ import { showShareGuide } from '@spark/share'; ...@@ -21,6 +21,7 @@ import { showShareGuide } from '@spark/share';
import Assist_succeed from "../../src/components/assist_succeed/assist_succeed" import Assist_succeed from "../../src/components/assist_succeed/assist_succeed"
import Assist_fail from "../../src/components/assist_fail/assist_fail" import Assist_fail from "../../src/components/assist_fail/assist_fail"
import Fail_challenge from "../../src/components/fail_challenge/fail_challenge" import Fail_challenge from "../../src/components/fail_challenge/fail_challenge"
import GuidePanel from "@/panels/GuidePanel/GuidePanel.tsx";
class Store { class Store {
...@@ -113,6 +114,11 @@ class Store { ...@@ -113,6 +114,11 @@ class Store {
}); });
} }
if (!data.guideFlag) {
ModalCtrl.closeModal(GuidePanel);
ModalCtrl.showModal(GuidePanel, {}, false);
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment