Commit 71b4f546 by FE

Merge branch '00' of gitlab.julyedu.com:baiguangyao/mr-julyedu into 00

parents 7d3cecb5 69a89854
...@@ -115,6 +115,9 @@ class Prizes extends Component { ...@@ -115,6 +115,9 @@ class Prizes extends Component {
) )
}) })
} }
<li>
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/prize-placeholder.png" alt=""/>
</li>
</ul> </ul>
</div> </div>
<div className="show-more" onClick={this.showMore}> <div className="show-more" onClick={this.showMore}>
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
span { span {
font-size: 12px; font-size: 12px;
color: #fff; color: #fff;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
} }
#user-bullet-screen { #user-bullet-screen {
......
...@@ -51,8 +51,7 @@ class UserBulletScreen extends Component { ...@@ -51,8 +51,7 @@ class UserBulletScreen extends Component {
return ` return `
<li class="swiper-slide"> <li class="swiper-slide">
<img class="avatar" src="${item.avatar_file}" alt=""> <img class="avatar" src="${item.avatar_file}" alt="">
<span>${item.user_name}</span> <span>${item.user_name} ${item.msg}</span>
<span>${item.msg}</span>
</li> </li>
` `
}) })
...@@ -87,8 +86,7 @@ class UserBulletScreen extends Component { ...@@ -87,8 +86,7 @@ class UserBulletScreen extends Component {
<li className='swiper-slide' key={index}> <li className='swiper-slide' key={index}>
<img src={item['avatar_file']} <img src={item['avatar_file']}
alt="" className="avatar"/> alt="" className="avatar"/>
<span>{item.user_name}</span> <span>{item.user_name} {item.msg}</span>
<span>{item.msg}</span>
</li> </li>
) )
}) })
......
...@@ -24,17 +24,24 @@ class Landing extends Component { ...@@ -24,17 +24,24 @@ class Landing extends Component {
teamData: { teamData: {
member: [] member: []
}, },
origin: getParam('origin'), origin: sessionStorage.getItem('isCaptain') ? 1 : getParam('origin'),
treasure_code: getParam('treasure_code'), treasure_code: getParam('treasure_code'),
activityEnd: false, activityEnd: false,
notices: [], notices: [],
rule: '' rule: '',
isCaptain: getParam('origin') == 1
} }
componentDidMount() { componentDidMount() {
this.fetchPageData() this.fetchPageData()
} }
componentDidUpdate(prevProps) {
if (prevProps.user.hasError !== this.props.user.hasError && !this.props.user.hasError) {
this.fetchPageData()
}
}
fetchPageData = ({origin = this.state.origin, treasure_code = this.state.treasure_code} = {}) => { fetchPageData = ({origin = this.state.origin, treasure_code = this.state.treasure_code} = {}) => {
http.post(`${API.home}/sys/treasure/team`, { http.post(`${API.home}/sys/treasure/team`, {
...@@ -46,12 +53,14 @@ class Landing extends Component { ...@@ -46,12 +53,14 @@ class Landing extends Component {
if (code == 200) { if (code == 200) {
this.setState({ this.setState({
teamData: data teamData: data,
isCaptain: sessionStorage.getItem('isCaptain') ? sessionStorage.getItem('isCaptain') : getParam('origin') == 1
}) })
let searchParams = new URLSearchParams(window.location.search) let searchParams = new URLSearchParams(window.location.search)
if (searchParams.get('origin') === '1' && !browser.isWeixin) { if (searchParams.get('origin') === '1' && !browser.isWeixin) {
searchParams.set('origin', '2') searchParams.set('origin', '2')
sessionStorage.setItem('isCaptain', '1')
window.history.replaceState(null, '', `landing?${searchParams.toString()}`) window.history.replaceState(null, '', `landing?${searchParams.toString()}`)
} }
...@@ -111,7 +120,7 @@ class Landing extends Component { ...@@ -111,7 +120,7 @@ class Landing extends Component {
}) })
} }
joinSuccess = ({id, status, my_team: {team_num, lack_member, is_team}}) => { joinSuccess = ({id, status, my_team: {team_num, lack_member, is_team, treasure_code}}) => {
const {history} = this.props const {history} = this.props
this.joinSuccessPopup = Popup({ this.joinSuccessPopup = Popup({
title: <div className={'join-success'}> title: <div className={'join-success'}>
...@@ -125,7 +134,7 @@ class Landing extends Component { ...@@ -125,7 +134,7 @@ class Landing extends Component {
status === 2 status === 2
? '组队成功,恭喜你获得一个宝箱!' ? '组队成功,恭喜你获得一个宝箱!'
: is_team : is_team
? `您的${<span>{team_num}</span>}号队伍还差${<span>{lack_member}</span>}人即可获得宝箱` ? <>您的{<span>{team_num}</span>}号队伍还差{<span>{lack_member}</span>}人即可获得宝箱</>
: '自己当队长,宝箱内有专属奖品哦~' : '自己当队长,宝箱内有专属奖品哦~'
} }
</div> </div>
...@@ -140,43 +149,51 @@ class Landing extends Component { ...@@ -140,43 +149,51 @@ class Landing extends Component {
/> />
: is_team : is_team
? <button type='button' ? <button type='button'
onClick={this.inviteMembers.bind(this, this.state.teamData['my_team']['treasure_code'])}>继续组队</button> onClick={this.inviteMembers.bind(this, treasure_code)}>继续组队</button>
: <button type="button" onClick={this.createMyTeam}>创建我的队伍</button> : <button type="button" onClick={this.createMyTeam}>创建我的队伍</button>
} }
</div>, </div>,
closeIcon: this.closeIcon, closeIcon: this.closeIcon,
close: () => { close: () => {
this.fetchPageData() this.fetchPageData()
this.getFollowStatus()
.then(isFollow => {
!isFollow && this.remind('join', getParam('treasure_code'))
})
} }
}) })
} }
inviteMembers = (treasure_code) => { inviteMembers = treasure_code => {
const {history, match, user, location} = this.props const {history, match, user, location} = this.props
if (browser.isWeixin) { if (browser.isWeixin) {
wxShare({ wxShare({
title: `@${user.data.username} 邀您一起组队拿豪礼!`, title: `@${user.data.username} 邀您一起组队拿豪礼!`,
desc: `加我我的队伍,机械键盘,纸质书籍等超多奖品等你拿!`, desc: `加我我的队伍,机械键盘,纸质书籍等超多奖品等你拿!`,
link: encodeURIComponent(`${window.location.origin}/${location.pathname}?treasure_code=${treasure_code}&origin=2`), link: `${window.location.origin}/${location.pathname}?treasure_code=${treasure_code}&origin=2`,
imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newIndex/community/tou5_bj.png' imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newIndex/community/tou5_bj.png'
}) })
} }
sessionStorage.setItem('showShareTip', '1') sessionStorage.setItem('showShareTip', '1')
history.replace(`${match.path}?treasure_code=${treasure_code}&origin=${1}`) history.replace(`${match.path}?treasure_code=${treasure_code}&origin=${1}`)
this.createTeamSuccessPopup && this.createTeamSuccessPopup.remove() && (this.createTeamSuccessPopup = null) this.createTeamSuccessPopup && this.createTeamSuccessPopup.remove() && (this.createTeamSuccessPopup = null)
this.joinSuccessPopup && this.joinSuccessPopup.remove() && (this.joinSuccessPopup = null)
this.fetchPageData({treasure_code, origin: 1}) this.fetchPageData({treasure_code, origin: 1})
this.setState({
isCaptain: true
})
} }
createTeamSuccess = (member, team_num, lack_member, treasure_code) => { getFollowStatus = () => http.get(`${API.home}/sys/user/isFollowWeChat`)
let isFollow = false
this.joinSuccessPopup && this.joinSuccessPopup.remove() && (this.joinSuccessPopup = null)
http.get(`${API.home}/sys/user/isFollowWeChat`)
.then(res => { .then(res => {
const {errno, status} = res.data const {code, data} = res.data
if (errno === 0 && status === 1) { return code === 200 && data['is_follow']
isFollow = true
}
}) })
createTeamSuccess = (member, team_num, lack_member, treasure_code) => {
this.joinSuccessPopup && this.joinSuccessPopup.remove() && (this.joinSuccessPopup = null)
this.getFollowStatus()
.then(isFollow => {
this.createTeamSuccessPopup = Popup({ this.createTeamSuccessPopup = Popup({
title: '创建成功', title: '创建成功',
className: 'landing-create-success', className: 'landing-create-success',
...@@ -211,6 +228,8 @@ class Landing extends Component { ...@@ -211,6 +228,8 @@ class Landing extends Component {
} }
} }
}) })
})
} }
remind = (type = 'create', treasure_code) => { remind = (type = 'create', treasure_code) => {
...@@ -232,7 +251,7 @@ class Landing extends Component { ...@@ -232,7 +251,7 @@ class Landing extends Component {
<div className="des">长按识别/扫码 关注【七月在线】服务号即可预约</div> <div className="des">长按识别/扫码 关注【七月在线】服务号即可预约</div>
</div>, </div>,
close: () => { close: () => {
history.replace(`${match.path}?treasure_code=${treasure_code}&origin=1`) // history.replace(`${match.path}?treasure_code=${treasure_code}&origin=1`)
this.fetchPageData({ this.fetchPageData({
treasure_code, treasure_code,
origin: '1' origin: '1'
...@@ -283,7 +302,10 @@ class Landing extends Component { ...@@ -283,7 +302,10 @@ class Landing extends Component {
closable: false, closable: false,
close: () => { close: () => {
sessionStorage.removeItem('showShareTip') sessionStorage.removeItem('showShareTip')
this.remind() this.getFollowStatus()
.then(isFollow => {
!isFollow && this.remind('create', getParam('treasure_code'))
})
} }
}) })
} }
...@@ -334,9 +356,9 @@ class Landing extends Component { ...@@ -334,9 +356,9 @@ class Landing extends Component {
prize_info, prize_info,
my_team my_team
}, },
activityEnd activityEnd,
isCaptain
} = this.state } = this.state
/* /*
* status * status
* 1-自己的队伍 * 1-自己的队伍
...@@ -355,9 +377,10 @@ class Landing extends Component { ...@@ -355,9 +377,10 @@ class Landing extends Component {
<img className='main-avatar' <img className='main-avatar'
src={head_img} alt=""/> src={head_img} alt=""/>
{ {
status === 1 && <div className="des">邀请好友加入队伍,开宝箱领取丰厚奖品~</div> status === 1
? <div className="des">邀请好友加入队伍,开宝箱领取丰厚奖品~</div>
: <div className="des">加入我的<span>{team_num}</span>号队伍,一起开宝箱领取丰厚奖品~</div>
} }
<div className="des">加入我的<span>{team_num}</span>号队伍,一起开宝箱领取丰厚奖品~</div>
<Prizes showSystemNotices={false}/> <Prizes showSystemNotices={false}/>
<BulletScreen/> <BulletScreen/>
<div className="group"> <div className="group">
...@@ -465,8 +488,8 @@ class Landing extends Component { ...@@ -465,8 +488,8 @@ class Landing extends Component {
</button> </button>
} }
{ {
prize_info && !activityEnd && <div className="certainly-prompt"> prize_info && prize_info.length !== 0 && !activityEnd && !isCaptain && <div className="certainly-prompt">
{prize_info.stage_no}次必中 {prize_info.name} {prize_info[0].stage_no}次必中 {prize_info[0].name}
</div> </div>
} }
{ {
...@@ -480,8 +503,14 @@ class Landing extends Component { ...@@ -480,8 +503,14 @@ class Landing extends Component {
} }
</div> </div>
</BoxContainer> </BoxContainer>
{
!isCaptain &&
<>
<WhiteSpace size={'xl'}/> <WhiteSpace size={'xl'}/>
<YearCourse></YearCourse> <YearCourse getSum={() => {
}}/>
</>
}
</div> </div>
) )
} }
......
...@@ -404,7 +404,7 @@ class YearCourse extends Component { ...@@ -404,7 +404,7 @@ class YearCourse extends Component {
<div className="coupon-course__footer"> <div className="coupon-course__footer">
{ {
item.is_buy == 1 && item.is_buy == 1 &&
<a onClick={this.toCourse} className="btn to-study">开始学习</a> <a onClick={() => this.toCourse(item.course_id)} className="btn to-study">开始学习</a>
} }
{ {
item.is_buy == 0 && item.is_buy == 0 &&
...@@ -440,7 +440,7 @@ class YearCourse extends Component { ...@@ -440,7 +440,7 @@ class YearCourse extends Component {
<div className="coupon-course__footer"> <div className="coupon-course__footer">
{ {
item.is_buy == 1 && item.is_buy == 1 &&
<a toCourse={this.toCourse} className="btn to-study">开始学习</a> <a onClick={() => this.toCourse(item.course_id)} className="btn to-study">开始学习</a>
} }
{ {
item.is_buy == 0 && item.is_buy == 0 &&
......
...@@ -7,9 +7,10 @@ import TreasureNav from './nav' ...@@ -7,9 +7,10 @@ import TreasureNav from './nav'
import CommonPopup from './../common/commonPopup/index' import CommonPopup from './../common/commonPopup/index'
import cookie from "js-cookie" import cookie from "js-cookie"
import {setCurrentUser, startFetchUser} from "@/store/userAction" import {setCurrentUser, startFetchUser} from "@/store/userAction"
import {SendMessageToApp, getParam} from '@/utils' import {SendMessageToApp, getParam, http} from '@/utils'
import {addDays} from "date-fns" import {addDays} from "date-fns"
import {connect} from "react-redux" import {connect} from "react-redux"
import { Toast } from 'antd-mobile';
@connect(state => ({ @connect(state => ({
user: state.user user: state.user
...@@ -19,6 +20,8 @@ export default class index extends Component { ...@@ -19,6 +20,8 @@ export default class index extends Component {
state = { state = {
removable: 0, // 未拆宝箱的数量 removable: 0, // 未拆宝箱的数量
currentOpenId: 0, // 当前要拆的宝箱的队伍的ID currentOpenId: 0, // 当前要拆的宝箱的队伍的ID
treasure_stage: 0, // 宝箱的活动阶段
active_stage: 0, // 整个活动的阶段
userInfoList: [], userInfoList: [],
userInfo: {}, userInfo: {},
isAppUpdate: false, isAppUpdate: false,
...@@ -32,6 +35,8 @@ export default class index extends Component { ...@@ -32,6 +35,8 @@ export default class index extends Component {
window['loginInfo'] = result => { window['loginInfo'] = result => {
_this.loginInfo(result) _this.loginInfo(result)
} }
_this.getStage();
} }
// 获取app登录数据 // 获取app登录数据
...@@ -118,6 +123,21 @@ export default class index extends Component { ...@@ -118,6 +123,21 @@ export default class index extends Component {
} }
} }
// 获取活动以及宝箱的阶段
getStage = () => {
http.get(`${API.home}/activity/stage`).then(res => {
const { code, data, msg } = res.data;
if(code === 200) {
// treasure_stage,宝箱阶段,0-不在活动时间,1-活动时间内
this.setState({
treasure_stage: data.treasure_stage
})
}else{
Toast.info(msg, 2);
}
});
}
toYearWish = () => { toYearWish = () => {
const isLogin = !this.props.user.hasError const isLogin = !this.props.user.hasError
if (isLogin) { if (isLogin) {
...@@ -139,14 +159,14 @@ export default class index extends Component { ...@@ -139,14 +159,14 @@ export default class index extends Component {
} }
render() { render() {
const {banner, removable} = this.state const {banner, removable, treasure_stage} = this.state
return ( return (
<div className={'year-index'}> <div className={'year-index'}>
<div className="banner-treasure"> <div className="banner-treasure">
<div id="banner" className="banner-treasure__header" <div id="banner" className="banner-treasure__header"
style={{backgroundImage: `url(${banner})`}}></div> style={{backgroundImage: `url(${banner})`}}></div>
<div className="banner-treasure__nav"> <div className="banner-treasure__nav">
<TreasureNav id="banner"/> <TreasureNav id="banner" treasure_stage={treasure_stage}/>
</div> </div>
<div className="banner-treasure__decorate"></div> <div className="banner-treasure__decorate"></div>
</div> </div>
...@@ -171,7 +191,9 @@ export default class index extends Component { ...@@ -171,7 +191,9 @@ export default class index extends Component {
<LiveRoom/> <LiveRoom/>
{/* 组队开宝箱 */} {/* 组队开宝箱 */}
<TreasureBox getRemovable={this.getRemovable} /> {
treasure_stage === 1 && <TreasureBox getRemovable={this.getRemovable} />
}
{/*课程*/} {/*课程*/}
<YearCourse isAppUpdate={this.state.isAppUpdate} getSum={this.sonToPar.bind(this)}/> <YearCourse isAppUpdate={this.state.isAppUpdate} getSum={this.sonToPar.bind(this)}/>
......
...@@ -40,7 +40,6 @@ class TreasureNav extends Component { ...@@ -40,7 +40,6 @@ class TreasureNav extends Component {
} }
componentDidMount() { componentDidMount() {
this.initNav();
window.addEventListener('scroll', this.calcNavActive) window.addEventListener('scroll', this.calcNavActive)
} }
...@@ -48,14 +47,14 @@ class TreasureNav extends Component { ...@@ -48,14 +47,14 @@ class TreasureNav extends Component {
window.removeEventListener('scroll', this.calcNavActive); window.removeEventListener('scroll', this.calcNavActive);
} }
initNav = () => { componentWillReceiveProps(nextProps) {
const { navs } = this.state; this.initNav(nextProps.treasure_stage);
http.get(`${API.home}/activity/stage`).then(res => { }
const { code, data } = res.data;
if(code === 200) {
initNav = (treasure_stage) => {
let {navs} = this.state;
// treasure_stage,宝箱阶段,0-不在活动时间,1-活动时间内 // treasure_stage,宝箱阶段,0-不在活动时间,1-活动时间内
if(data.treasure_stage === 0) { if(treasure_stage === 0) {
this.setState({ this.setState({
formatNavs: navs.filter(item => item.id !== 'year-treasure') formatNavs: navs.filter(item => item.id !== 'year-treasure')
}); });
...@@ -65,8 +64,6 @@ class TreasureNav extends Component { ...@@ -65,8 +64,6 @@ class TreasureNav extends Component {
}) })
} }
} }
});
}
calcNavActive = () => { calcNavActive = () => {
const { formatNavs } = this.state; const { formatNavs } = this.state;
......
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