Commit ac4bca4a authored by haiyoucuv's avatar haiyoucuv

init

parent ffd5d50d
...@@ -74,6 +74,7 @@ module.exports = function (isProd) { ...@@ -74,6 +74,7 @@ module.exports = function (isProd) {
entry: sparkConfig.ENTRY, entry: sparkConfig.ENTRY,
mode: isProd ? 'production' : 'development', mode: isProd ? 'production' : 'development',
devtool: isProd ? "source-map" : "cheap-module-source-map", devtool: isProd ? "source-map" : "cheap-module-source-map",
output: { output: {
path: path.resolve(__dirname, sparkConfig.OUTPUT_DIR), path: path.resolve(__dirname, sparkConfig.OUTPUT_DIR),
filename: "js/[name].js", filename: "js/[name].js",
...@@ -95,10 +96,15 @@ module.exports = function (isProd) { ...@@ -95,10 +96,15 @@ module.exports = function (isProd) {
{ {
test: /\.(js|jsx)$/, test: /\.(js|jsx)$/,
loader: require.resolve("babel-loader"), loader: require.resolve("babel-loader"),
// exclude: [path.resolve("node_modules")], exclude: /node_modules/,
options: { options: {
presets: [ presets: [
require("@babel/preset-env").default, [require("@babel/preset-env").default, {
targets: {
browsers: ["> 1%", "last 2 versions", "not ie <= 8"]
},
modules: false
}],
require("@babel/preset-react").default require("@babel/preset-react").default
], ],
plugins: [ plugins: [
...@@ -109,6 +115,7 @@ module.exports = function (isProd) { ...@@ -109,6 +115,7 @@ module.exports = function (isProd) {
sourceType: 'unambiguous' sourceType: 'unambiguous'
}, },
}, },
{ {
test: [/\.(jpg|jpeg|png|svg|bmp)$/, /\.(eot|woff2?|ttf|svg)$/], test: [/\.(jpg|jpeg|png|svg|bmp)$/, /\.(eot|woff2?|ttf|svg)$/],
loader: require.resolve("url-loader"), loader: require.resolve("url-loader"),
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
"javascript-obfuscator": "^4.1.0", "javascript-obfuscator": "^4.1.0",
"mobx": "^6.2.0", "mobx": "^6.2.0",
"mobx-react": "^7.1.0", "mobx-react": "^7.1.0",
"motion": "^12.23.5",
"qs": "^6.9.4", "qs": "^6.9.4",
"react": "^16.4.1", "react": "^16.4.1",
"react-dom": "^16.4.1", "react-dom": "^16.4.1",
......
import React from "react"; import React from "react";
import {observer} from "mobx-react"; import {observer} from "mobx-react";
import {motion} from "motion";
import "./ReviewPanel.less"; import "./ReviewPanel.less";
import {SvgaPlayer} from "@spark/svgaplayer"; import {SvgaPlayer} from "@spark/svgaplayer";
import {RES_PATH} from "../../../sparkrc"; import {RES_PATH} from "../../../sparkrc";
...@@ -11,10 +10,30 @@ import modalStore from "@src/store/modal"; ...@@ -11,10 +10,30 @@ import modalStore from "@src/store/modal";
@observer @observer
class ReviewPanel extends React.Component { class ReviewPanel extends React.Component {
state = {
itemsVisible: new Array(5).fill(false)
};
componentDidMount() { componentDidMount() {
// 延迟启动动画
setTimeout(() => {
this.startAnimation();
}, 200);
} }
startAnimation = () => {
// 逐个显示 item
this.state.itemsVisible.forEach((_, index) => {
setTimeout(() => {
this.setState(prevState => ({
itemsVisible: prevState.itemsVisible.map((visible, i) =>
i === index ? true : visible
)
}));
}, index * 300); // 每个 item 延迟 300ms
});
};
clickNext = () => { clickNext = () => {
modalStore.closePop(); modalStore.closePop();
store.changePage(PAGE_MAP.QUES_PAGE, {funds: this.props.popData.funds}); store.changePage(PAGE_MAP.QUES_PAGE, {funds: this.props.popData.funds});
...@@ -22,63 +41,29 @@ class ReviewPanel extends React.Component { ...@@ -22,63 +41,29 @@ class ReviewPanel extends React.Component {
render() { render() {
const {funds} = this.props.popData; const {funds} = this.props.popData;
const {itemsVisible} = this.state;
// 动画配置
const containerVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.3, // 每个子元素延迟0.3秒出现
delayChildren: 0.2 // 整体延迟0.2秒开始
}
}
};
const itemVariants = {
hidden: {
opacity: 0,
y: -50,
scale: 0.8
},
visible: {
opacity: 1,
y: 0,
scale: 1,
transition: {
duration: 0.6,
ease: "easeOut"
}
}
};
// 当前题目 // 当前题目
return <div className="ReviewPanel modal_center" onClick={this.clickNext}> return <div className="ReviewPanel modal_center" onClick={this.clickNext}>
<SvgaPlayer className="effect" src={RES_PATH + "svga/2输出弹窗氛围.svga"}/> <SvgaPlayer className="effect" src={RES_PATH + "svga/2输出弹窗氛围.svga"}/>
<div className="bg"/> <div className="bg"/>
<motion.div <div className="items-container">
className="items-container"
variants={containerVariants}
initial="hidden"
animate="visible"
>
{ {
new Array(5).fill(1).map((item, index) => { new Array(5).fill(1).map((item, index) => {
return ( return (
<motion.div <div
key={index} key={index}
className={`item item${index % 2}`} className={`item item${index % 2} ${itemsVisible[index] ? 'item-visible' : ''}`}
style={{ style={{
top: (217 + index * 250) * remScale, top: (217 + index * 250) * remScale,
}} }}
variants={itemVariants}
> >
<div className="txt">11岁:家庭纽带</div> <div className="txt">11岁:家庭纽带</div>
</motion.div> </div>
); );
}) })
} }
</motion.div> </div>
<div className="tip">点击屏幕继续测试</div> <div className="tip">点击屏幕继续测试</div>
</div>; </div>;
} }
......
...@@ -32,6 +32,14 @@ ...@@ -32,6 +32,14 @@
position: absolute; position: absolute;
width: 730px; width: 730px;
height: 170px; height: 170px;
opacity: 0;
transform: translateY(-50px) scale(0.8);
transition: all 0.6s ease-out;
&.item-visible {
opacity: 1;
transform: translateY(0) scale(1);
}
.txt { .txt {
position: absolute; position: absolute;
......
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