Authored by huangyi

Merge branch 'feature/wheel-surf' of http://git.yoho.cn/fe/yoho-activitys into feature/wheel-surf

import React from 'react';
import {render} from 'react-dom';
import config from '../../config/index';
import {BrowserRouter, Route, Switch, HashRouter, hashHistory, browserHistory} from 'react-router-dom';
const router = require('./router');
const routers = () => {
let arr = [];
Object.keys(router).forEach((key,index)=> {
if(index === 0){
arr.push(<Route key={index} exact path={config.routerPath[config.currentApp] + '/'+key+'.html'} component={router[key]}/>)
}else{
arr.push(<Route key={index} path={config.routerPath[config.currentApp] + '/'+key+'.html'} component={ router[key]}/>)
}
})
return arr;
}
const SliderComponent = () => (
<Switch>
{routers()}
</Switch>
);
render(
<BrowserRouter history={browserHistory}>
<Switch>
<SliderComponent/>
</Switch>
</BrowserRouter>,
document.querySelector("#root")
);
\ No newline at end of file
... ...
import React from 'react';
import {render} from 'react-dom';
import config from '../config';
import config from '../../config/index';
import {BrowserRouter, Route, Switch, HashRouter, hashHistory, browserHistory} from 'react-router-dom';
... ...
import React from 'react';
import {render} from 'react-dom';
import config from '../../config/index';
import {BrowserRouter, Route, Switch, HashRouter, hashHistory, browserHistory} from 'react-router-dom';
const router = require('./router');
const routers = () => {
let arr = [];
Object.keys(router).forEach((key,index)=> {
if(index === 0){
arr.push(<Route key={index} exact path={config.routerPath[config.currentApp] + '/'+key+'.html'} component={router[key]}/>)
}else{
arr.push(<Route key={index} path={config.routerPath[config.currentApp] + '/'+key+'.html'} component={ router[key]}/>)
}
})
return arr;
}
const SliderComponent = () => (
<Switch>
{routers()}
</Switch>
);
render(
<BrowserRouter history={browserHistory}>
<Switch>
<SliderComponent/>
</Switch>
</BrowserRouter>,
document.querySelector("#root")
);
\ No newline at end of file
... ...
... ... @@ -8,6 +8,14 @@ const home = Loadable({
},
});
const rule = Loadable({
loader: () => import(/* webpackChunkName: "rule" */'./view/rule'),
loading(){
return <div></div>
},
});
module.exports = {
home
home,
rule
};
... ...
module.exports = {
home:'大转盘'
home:'大转盘',
rule:'活动规则说明'
};
\ No newline at end of file
... ...
... ... @@ -15,9 +15,12 @@ export default class wheelSurf extends PureComponent {
document.title ='大转盘'
super(props);
this.state = {
env: '',
url: ''
}
conf: {
// 默认数据
}
};
// this.collect = this.collect.bind(this);
this.init();
... ... @@ -39,8 +42,7 @@ export default class wheelSurf extends PureComponent {
if(!uid || !parseInt(uid)){
return;
}
let result = await conf({
actId,
uid: uid,
... ... @@ -48,10 +50,13 @@ export default class wheelSurf extends PureComponent {
sessionType: cookie.load('app_client_type') || '',
appVersion: cookie.load('app_version') || ''
});
this.setState({
storage: result.data
})
}
if (result.code === 200) {
this.setState({
conf: result.data
})
}
};
collect = async (id) => {
//判断是否是clicked
... ... @@ -185,8 +190,8 @@ export default class wheelSurf extends PureComponent {
render() {
return (
<div className="wrap">
<div className="home-wrap">
<img className="main-bg" src={this.state.conf.main_bg + '?imageslim'}/>
</div>
)
}
... ...
.wrap{
width: 100%;
height: 100%;
font-size: 12px;
background: red;
.home-wrap {
width: 100%;
height: 100%;
overflow-x: hidden;
.main-bg {
width: 750px;
height: auto;
}
}
\ No newline at end of file
... ...
import React, {PureComponent} from 'react';
import './index.scss'
export default class wheelSurf extends PureComponent {
render() {
return (
<div className="rule-wrap">
<p className="rule-title">活动规则:</p>
<p className="rule-line">1、活动时间:2018512日—2019331日。</p>
<p className="rule-line">2、活动规则:活动期间,用户每天可获得5次抽奖机会,每次抽奖消耗10积分,按照50%中奖概率随机出奖。</p>
<p className="rule-line">3、活动同一用户:同一支付宝账号、身份证、实名认证、终端设备、手机号等均视为同一用户条件。</p>
<p className="rule-line">4、奖品查询:中奖后若要查看,以每次抽奖领取页展示为准。</p>
<p className="rule-line">5、奖品使用规则:请依各项奖品说明为准。</p>
</div>
)
}
}
\ No newline at end of file
... ...
.rule-wrap {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: #fff;
padding: 60px 30px;
line-height: 1.5;
.rule-title {
font-family: PingFang-SC-Medium;
font-size: 32px;
color: #444444;
letter-spacing: 0;
}
.rule-line {
margin-top: 20px;
font-family: PingFang-SC-Regular;
font-size: 28px;
color: #444444;
letter-spacing: 0;
}
}
\ No newline at end of file
... ...
const currentApp = 'guoChao';
const currentApp = 'wheelSurf';
export default {
production: {
routerPath: {
guoChao: '/html5/2018/09/guochao',
wheelSurf: '/html5/2018/09/wheelSurf',
},
domain: 'https://action.yoho.cn',
currentApp
},
development: {
routerPath: {
guoChao: '',
wheelSurf: '',
},
domain: '//yoho-activity-platform.test3.ingress.dev.yohocorp.com',
// domain: '//yoho-activity-platform.test3.ingress.dev.yohocorp.com',
domain: 'http://localhost:6006',
currentApp
}
}[process.env.NODE_ENV || 'development']
\ No newline at end of file
... ...
... ... @@ -51,6 +51,7 @@
"html-withimg-loader": "^0.1.16",
"json-loader": "^0.5.7",
"jsx-loader": "^0.13.2",
"mini-css-extract-plugin": "^0.4.3",
"node-sass": "^4.9.3",
"optimize-css-assets-webpack-plugin": "^4.0.0",
"postcss": "^7.0.2",
... ...
... ... @@ -47,7 +47,7 @@ let htmls = function () {
module.exports = {
//项目入口js文件
entry: ['./app/index.js'],
entry: [`./app/${config.currentApp}/index.js`],
//项目输出目录
output: {
chunkFilename: 'routes/[name].[chunkhash:8].chunk.js',
... ...
... ... @@ -3892,6 +3892,14 @@ mimic-fn@^1.0.0:
version "1.2.0"
resolved "http://npm.yohops.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
mini-css-extract-plugin@^0.4.3:
version "0.4.3"
resolved "http://npm.yohops.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.3.tgz#98d60fcc5d228c3e36a9bd15a1d6816d6580beb8"
dependencies:
loader-utils "^1.1.0"
schema-utils "^1.0.0"
webpack-sources "^1.1.0"
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
version "1.0.1"
resolved "http://npm.yohops.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
... ...