Commit 62d5e62d by xuzhenghua

pull

parent fdf98450
......@@ -3,9 +3,16 @@ import ReactDOM from 'react-dom'
import './index.scss'
import classnames from 'classnames'
const re = /(https?|ftp):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/
function ClosablePopup({
title, content, className, closable = true, close = function () {
}
title,
content,
className,
closable = true,
close = function () {
},
closeIcon = 'iconiconfront-2'
} = {}) {
function unmountComponent() {
......@@ -35,7 +42,10 @@ function ClosablePopup({
{content}
</div>
{
closable && <i className={'close iconfont iconiconfront-2'} onClick={_close}/>
closable &&
re.test(closeIcon)
? <img src={closeIcon} alt="" className={'close-icon'} onClick={_close}/>
: <i className={`close iconfont ${closeIcon}`} onClick={_close}/>
}
</div>
</div>
......
......@@ -31,5 +31,16 @@
font-size: 36px;
color: #fff;
}
.close-icon {
position: absolute;
bottom: -66px;
left: 50%;
width: 33px;
height: 33px;
transform: translateX(-50%);
font-size: 36px;
color: #fff;
}
}
}
.box-container {
position: relative;
background: #327443;
padding: 14px 0;
.image-box {
height: 100%;
background: url("https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/PC/sd_nr_bj2.png") repeat-y;
background-size: 100% auto;
}
@mixin common-deco($bg) {
content: '';
position: absolute;
left: 0;
width: 100%;
height: 14px;
display: block;
background: url($bg) no-repeat;
background-size: 375px auto;
}
&::before {
@include common-deco("https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/PC/sd_nr_bj1.png");
top: 0;
}
&::after {
@include common-deco("https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/PC/sd_nr_bj3.png");
bottom: 0;
}
}
import React, { Component } from 'react'
import './box-container.scss'
class Container extends Component {
render() {
return (
<div className={'box-container'}>
<div className="image-box">
{this.props.children}
</div>
</div>
)
}
}
export default Container
import React, { Component } from 'react'
import BoxContainer from '../box-container/container'
import { Toast } from "antd-mobile"
import { Popup } from "@common/index"
import './landing.scss'
import { http } from "@/utils"
class Landing extends Component {
prizeBox
prizeList
bg
innerBox
closeIcon = 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/close-btn.png'
state = {
prizes: [
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
{
grant_max: 3,
id: 3,
img_name: "http://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/home/56b3777563.jpg",
is_captain: 1,
mode: 1,
name: "测试1",
stage_no: 0,
surplus: 62,
},
],
unfoldList: false,
teamData: {
member: [
{
head_img: 'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/default/robot.png',
is_captain: 1
},
{
head_img: 'http://img2.imgtn.bdimg.com/it/u=2138045196,3587715336&fm=26&gp=0.jpg',
is_captain: 0
},
]
},
}
componentDidMount() {
http.get(`${API.home}/sys/prize_data`)
.then(res => {
const {data, code, msg} = res.data
if (code == 200) {
} else {
Toast.info(msg, 2, null, false)
}
})
/*http.post(`${API.home}/sys/treasure/team`, {
})
.then(res => {
const {data, code, msg} = res.data
if (code == 200) {
this.setState({
teamData: data
})
// console.log(data)
} else {
Toast.info(msg, 2, null, false)
}
})*/
this.joinSuccess()
}
showRules = () => {
Popup({
title: '组队开宝箱活动规则',
className: 'landing-treasure-rules',
content: <ul>
<li>1. 活动期间(1218-1231日)可随时参与开宝箱;</li>
<li>2. 当前队伍满员后可继续创建新队伍;</li>
<li>3. 每人有一次机会加入好友的队伍;</li>
<li>4. 队伍满员后所有成员均可随机获得宝箱内奖品,队长奖励更丰厚哦~</li>
<li>5. 代金券、课程等虚拟奖品将直接发放至账户,实物奖品活动结束后统一邮寄;</li>
<li>6. 现金可提现:我的 赚奖学金 提现。</li>
</ul>,
closeIcon: this.closeIcon
})
}
showMore = () => {
this.setState(prev => {
if (this.state.unfoldList) {
this.bg.style = this.innerBox.style = this.prizeBox.style = ''
} else {
let headHeight = parseFloat(getComputedStyle(this.prizeBox, ':before').getPropertyValue('height')),
footerHeight = parseFloat(getComputedStyle(this.prizeBox, ':after').getPropertyValue('height')),
innerOffsetTop = 0.12458,
footerOffsetTop = 0.595,
h = this.prizeList.scrollHeight,
scrollListHeight = headHeight + h - (innerOffsetTop * headHeight) - (footerOffsetTop * footerHeight) + footerHeight
this.prizeBox.style.height = `${scrollListHeight}px`
this.innerBox.style.height = `${h}px`
this.bg.style.height = `${h - footerHeight + innerOffsetTop * headHeight}px`
}
return {unfoldList: !prev.unfoldList}
})
}
joinSuccess = (isFull = false) => {
Popup({
title: <div className={'join-success'}>
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/check-icon.png" alt=""/>
<div>成功加入队伍</div>
</div>,
className: 'landing-join-success-wrapper',
content: <div>
<div className={'tip'}>
{
isFull
? '组队成功,恭喜你获得一个宝箱!'
: '自己当队长,宝箱内有专属奖品哦~'
}
</div>
{
isFull
? <img style={{width: '150px', marginTop: '23px'}}
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/treasure-box-icon.png" alt=""/>
: <button type="button">创建我的队伍</button>
}
</div>,
closeIcon: this.closeIcon
})
}
createTeamSuccess = () => {
Popup({
title: '创建成功',
className: 'landing-create-success',
content: <div>
<div className="tip">*号队伍 还差*名队员即可获得宝箱哦~</div>
<img className={'treasure-box'}
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/treasure-box-icon.png" alt=""/>
<ul className='members'>
{
new Array(5).fill('a').map((item, index) => {
return <li key={index}>
{index === 0 && <sup>队长</sup>}
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/not-joined-placeholder.png"
alt=""/>
</li>
})
}
</ul>
<button type={'button'}>邀请好友加入队伍</button>
</div>,
closeIcon: this.closeIcon
})
}
remind = (type = 'create') => {
Popup({
title: '提醒服务',
className: 'landing-remind',
closeIcon: this.closeIcon,
content: <div>
<div className="des">{type === 'create' ? '有好友加入队伍后第一时间通知我~' : '获得宝箱时第一时间通知我~'}</div>
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/tinypng-common/right_weixin.png" alt=""/>
<div className="des">长按识别/扫码 关注【七月在线】服务号即可预约</div>
</div>
})
}
unpackTreasureBox = () => {
Popup({
title: '恭喜你获得',
className: 'landing-unpack-treasure-box',
closeIcon: this.closeIcon,
content: <div className='unpack-box-wrapper'>
<div className="prize-wrapper">
<img className='prize'
src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575544072904&di=474bca496055f1141a40ae2df45d1bbb&imgtype=0&src=http%3A%2F%2Fphotocdn.sohu.com%2F20110926%2FImg320518331.jpg"
alt=""/>
</div>
<div className="prize-name">AI100题纸质书</div>
<a className="delivery-info" href='javascript:;'>查看/修改收货信息</a>
<ul className="members">
{
new Array(4).fill('a').map((item, index) => {
return <li key={index}>
<div className="avatar-wrapper">
{
index === 0 && <sup>队长</sup>
}
<img src="https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/default/robot.png"
alt=""/>
</div>
<span className='prize-name'>AI100题纸质书</span>
</li>
})
}
</ul>
<button>继续组队开宝箱</button>
</div>
})
}
render() {
const {teamData} = this.state
return (
<div id={'landing'}>
<div id="to-square">
前往活动会场,享更多福利! >>
</div>
<BoxContainer>
<i className="snow-deco"/>
<img className='main-avatar'
src="https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/default/robot.png" alt=""/>
<div className="des">邀请好友加入队伍,开宝箱领取丰厚奖品~</div>
<div className={'prizes-box'} ref={el => this.prizeBox = el}>
<a href="javascript:;" className='rule-btn' onClick={this.showRules}>活动规则 > </a>
<div className={`bg`} ref={el => this.bg = el}/>
<div className={`inner-box`} ref={el => this.innerBox = el}>
<ul className='prize-list' ref={el => this.prizeList = el}>
{
this.state.prizes.map((item, index) => {
return (
<li key={index}>
<img src={item.img_name} alt=""/>
</li>
)
})
}
</ul>
</div>
<div className="show-more" onClick={this.showMore}>
{
this.state.unfoldList
? <div>
收起
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/fold-icon.png" alt=""/>
</div>
: <div>
查看全部奖品
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/unfold-icon.png" alt=""/>
</div>
}
</div>
<div className="fake"></div>
</div>
<div className="group">
<ul className={'member'}>
{
new Array(5).fill('a').map((item, index) => {
const member = teamData.member[index]
return (
member
? <li key={index}>
<div className='avatar-wrapper'>
{
member.is_captain ? <sup>队长</sup> : null
}
<img
src={member.head_img}
alt=""
className="avatar"/>
</div>
</li>
:
<li key={index}>
<div className="avatar-wrapper">
<img
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/default-member-avatar.png"
alt=""
className="avatar"/>
</div>
</li>
)
})
}
</ul>
<ul className={'bars'}>
{
new Array(5).fill('a').map((item, index) => {
return (
<li key={index} className={`${index + 1 < teamData.member.length ? 'active' : ''}`}/>
)
})
}
</ul>
<div className="group-des">
还差 {'*'} 名队员即可获得当前宝箱哦~
</div>
<button type='button' className={'invite-btn'}>
邀请好友加入队伍
</button>
</div>
</BoxContainer>
</div>
)
}
}
export default Landing
.sup {
position: absolute;
right: -10px;
top: -13px;
width: 30px;
height: 16px;
background: rgba(255, 227, 0, 1);
border: 1px solid rgba(255, 255, 255, 1);
border-radius: 8px 8px 8px 0;
color: #0E7442;
font-size: 10px;
text-align: center;
line-height: 16px;
}
#landing {
background: #BC2A18;
text-align: center;
#to-square {
position: relative;
width: 100%;
height: 30px;
background: #FF2121;
color: #fff;
font-size: 14px;
line-height: 30px;
text-align: center;
z-index: 10;
}
.box-container {
width: 100%;
}
.snow-deco {
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 68px;
background: url("https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/snow-deco.png") no-repeat;
background-size: contain;
}
.main-avatar {
width: 49px;
border-radius: 50%;
margin-bottom: 5px;
margin-top: 37.5px;
}
.des {
font-size: 14px;
color: #FFDC1E;
}
.trans-height {
transition: height .25s ease-in-out;
}
.prizes-box {
@extend .trans-height;
position: relative;
height: 348px;
background-size: 100% auto;
.show-more {
position: absolute;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
width: 125px;
height: 27px;
background: #FF2121;
border: 2px solid rgba(255, 33, 33, 1);
border-radius: 5px 5px 0 0;
font-size: 13px;
color: #fff;
line-height: 27px;
text-align: center;
z-index: 20;
img {
margin-left: 4.5px;
width: 10.05px;
}
}
.rule-btn {
position: absolute;
top: 32.5px;
left: 50%;
transform: translateX(-50%);
color: #FFDD1D;
font-size: 12px;
text-decoration: underline;
}
@mixin common-deco($bg) {
content: '';
display: block;
width: 100%;
background: url($bg) no-repeat;
background-size: contain;
}
&::before {
@include common-deco('https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/landing-box-head.png');
height: 148.5px;
}
&::after {
@include common-deco('https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/landing-box-footer.png');
height: 85px;
}
.bg {
@extend .trans-height;
width: 100%;
height: 115px;
overflow: hidden;
z-index: 10;
background: url("https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/landing-box-bg.png") repeat-y;
background-size: 100% auto;
}
.inner-box {
@extend .trans-height;
position: absolute;
top: 130px;
left: 0;
width: 100%;
z-index: 20;
height: 187px;
overflow: hidden;
}
.prize-list {
display: flex;
flex-flow: wrap;
padding: 0 57px;
& li:nth-of-type(2n) {
margin-right: 0;
}
li {
width: 125px;
height: 99px;
background: rgba(255, 255, 255, 1);
border: 2px solid rgba(255, 227, 0, 1);
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
border-radius: 1px;
margin-right: 10.5px;
margin-bottom: 6.5px;
img {
width: 90px;
object-fit: contain;
}
}
}
/*.fake{
position: absolute;
bottom: 8px;
left: 10%;
width: 20px;
height: 54px;
background: red;
z-index: 200;
}*/
}
.group {
ul.member {
display: flex;
padding: 0 49px;
}
& li:nth-last-child(1) {
margin-right: 0;
}
li {
margin-right: 24.5px;
}
.avatar-wrapper {
position: relative;
&::after {
content: '';
display: block;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 22px;
height: 3px;
background: #243529;
opacity: 0.8;
border-radius: 50%;
}
sup {
@extend .sup;
}
img {
width: 36px;
height: 36px;
border-radius: 50%;
}
}
.bars {
display: flex;
padding-left: 37.5px;
margin-top: 15px;
& li:nth-child(1) {
border-radius: 2px 0 0 2px;
}
& li:nth-last-child(1) {
border-radius: 0 2px 2px 0;
margin-right: 0;
}
li {
width: 59px;
height: 5px;
margin-right: 1.5px;
background: #035B34;
&.active {
background: #FFDD1D;
}
}
}
&-des {
margin-top: 27px;
font-size: 14px;
color: #FFE300;
}
.invite-btn {
width: 320px;
height: 44px;
line-height: 44px;
margin: 14.5px auto 57px;
color: #0B7B45;
font-size: 15px;
background: #FFE300;
border: 0;
outline: 0;
-webkit-appearance: none;
border-radius: 3px;
font-family: "HiraginoSansGB-W6", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}
}
}
.popup-container {
.tip {
font-size: 15px;
line-height: 37px;
color: #666;
text-align: center;
}
}
.popup-button {
width: 270px;
height: 44px;
padding: 0;
margin-top: 20px;
background: #FFE319;
border: 1px solid #090909;
border-radius: 5px;
line-height: 44px;
font-size: 16px;
color: #090909;
}
.landing-treasure-rules {
width: 320px;
&.popup-container {
.title {
font-size: 18px;
color: #111111;
}
}
.content {
padding: 0 29px 15px;
margin-top: 22px;
color: #666666;
font-size: 14px;
li {
margin-bottom: 5px;
}
}
}
.landing-join-success-wrapper {
&.popup-container {
width: 320px;
text-align: center;
.title {
img {
width: 54px;
height: 54px;
margin-bottom: 10px;
}
font-size: 18px;
color: #111111;
}
}
/*.tip {
font-size: 15px;
line-height: 37px;
color: #666;
text-align: center;
}*/
button {
@extend .popup-button;
}
}
.landing-create-success {
text-align: center;
&.popup-container {
width: 320px;
padding: 20px;
.title {
font-size: 18px;
color: #111111;
}
}
img.treasure-box {
margin: 20px 0;
width: 120px;
height: 72px;
}
.members {
display: flex;
& li:nth-last-child(1) {
margin-right: 0;
}
li {
position: relative;
margin-right: 15px;
}
sup {
@extend .sup;
}
}
button {
@extend .popup-button;
}
}
.landing-remind {
&.popup-container {
width: 320px;
text-align: center;
padding: 20px 30px;
.title {
font-size: 18px;
color: #111;
margin-bottom: 8px;
}
}
img {
margin: 18px 0 16px;
width: 137px;
height: 137px;
}
.des {
font-size: 14px;
color: #666;
}
}
.landing-unpack-treasure-box {
text-align: center;
&.popup-container {
width: 320px;
padding: 20px 18px;
top: 62px;
.title {
font-size: 18px;
color: #111;
margin-bottom: 10px;
}
}
.prize-wrapper {
width: 130px;
height: 103px;
margin: 0 auto 5px;
border: 1px solid #CDCDCD;
img {
width: 100%;
height: 100%;
}
}
.prize-name{
font-size: 15px;
color: #FF232D;
margin-bottom: 5px;
}
.members {
background: #EFEFEF;
text-align: left;
padding: 12px;
margin-top: 12px;
li:nth-last-child(1){
margin-bottom: 0;
}
li {
display: flex;
align-items: center;
height: 25px;
margin-bottom: 8px;
font-size: 12px;
line-height: 25px;
.avatar-wrapper {
position: relative;
width: 25px;
height: 25px;
margin-right: 8px;
sup {
@extend .sup;
top: -50%;
right: -80%;
}
}
img {
width: 100%;
height: 100%;
border-radius: 50%;
}
.prize-name {
color: #090909;
margin-bottom: 0;
}
.unopened {
color: #9A9A9A;
}
}
}
button {
@extend .popup-button;
}
}
......@@ -14,18 +14,18 @@ import PrivateRoute from './privateRoute'
// };
export default function () {
return (
<Switch>
{RouterConfig.map((item, index) => {
let {isPrivate, ...rest} = item
if (isPrivate) {
return <PrivateRoute {...rest} key={index}/>
} else {
return (
<Route {...rest} key={index}/>
)
}
})}
</Switch>
)
}
\ No newline at end of file
return (
<Switch>
{RouterConfig.map((item, index) => {
let {isPrivate, ...rest} = item
if (isPrivate) {
return <PrivateRoute {...rest} key={index}/>
} else {
return (
<Route {...rest} key={index}/>
)
}
})}
</Switch>
)
}
......@@ -220,10 +220,17 @@ export default [
},
{
path: '/activity',
exact: true,
component: Activity,
},
{
path: '/invite',
component: Invite,
}
},
//双旦活动
{
path: '/activity/newyear-2019/landing',
component: loadable(() => import(/* webpackChunkName: 'newyear-2019-landing'*/ '@components/activity/newyear-2019/landing/index'))
},
]
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