Commit 64ab5a81 by zhanghaozhe

Merge branch '00' into dev

parents 0f9cdcfa 6b78adcf
...@@ -118,7 +118,7 @@ class Landing extends Component { ...@@ -118,7 +118,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'}>
...@@ -132,7 +132,7 @@ class Landing extends Component { ...@@ -132,7 +132,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>
...@@ -147,18 +147,22 @@ class Landing extends Component { ...@@ -147,18 +147,22 @@ 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({
...@@ -171,53 +175,59 @@ class Landing extends Component { ...@@ -171,53 +175,59 @@ class Landing extends Component {
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
})
} }
getFollowStatus = () => http.get(`${API.home}/sys/user/isFollowWeChat`)
.then(res => {
const {code, data} = res.data
return code === 200 && data['is_follow']
})
createTeamSuccess = (member, team_num, lack_member, treasure_code) => { createTeamSuccess = (member, team_num, lack_member, treasure_code) => {
let isFollow = false
this.joinSuccessPopup && this.joinSuccessPopup.remove() && (this.joinSuccessPopup = null) this.joinSuccessPopup && this.joinSuccessPopup.remove() && (this.joinSuccessPopup = null)
http.get(`${API.home}/sys/user/isFollowWeChat`) this.getFollowStatus()
.then(res => { .then(isFollow => {
const {errno, status} = res.data this.createTeamSuccessPopup = Popup({
if (errno === 0 && status === 1) { title: '创建成功',
isFollow = true className: 'landing-create-success',
} content: <div>
}) <div className="tip">{<span>{team_num}</span>}号队伍 还差{<span>{lack_member}</span>}名队员即可获得宝箱哦~</div>
this.createTeamSuccessPopup = Popup({ <img className={'treasure-box'}
title: '创建成功', src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/treasure-box-icon.png" alt=""/>
className: 'landing-create-success', <ul className='members'>
content: <div> {
<div className="tip">{<span>{team_num}</span>}号队伍 还差{<span>{lack_member}</span>}名队员即可获得宝箱哦~</div> new Array(5).fill('a').map((item, index) => {
<img className={'treasure-box'} const _member = member[index]
src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/treasure-box-icon.png" alt=""/> return <li key={index}>
<ul className='members'> {_member && _member['is_captain'] && <sup>队长</sup>}
{ <img
new Array(5).fill('a').map((item, index) => { className={'avatar'}
const _member = member[index] src={
return <li key={index}> _member
{_member && _member['is_captain'] && <sup>队长</sup>} ? _member['head_img']
<img : "https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/not-joined-placeholder.png"
className={'avatar'} }
src={ alt=""/>
_member </li>
? _member['head_img'] })
: "https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/H5/not-joined-placeholder.png" }
} </ul>
alt=""/> <button type={'button'} onClick={this.inviteMembers.bind(this, treasure_code)}>邀请好友加入队伍</button>
</li> </div>,
}) closeIcon: this.closeIcon,
afterClose: () => {
if (!isFollow) {
this.remind('create', treasure_code)
}
} }
</ul> })
<button type={'button'} onClick={this.inviteMembers.bind(this, treasure_code)}>邀请好友加入队伍</button>
</div>, })
closeIcon: this.closeIcon,
afterClose: () => {
if (!isFollow) {
this.remind('create', treasure_code)
}
}
})
} }
remind = (type = 'create', treasure_code) => { remind = (type = 'create', treasure_code) => {
...@@ -239,7 +249,7 @@ class Landing extends Component { ...@@ -239,7 +249,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'
...@@ -290,7 +300,10 @@ class Landing extends Component { ...@@ -290,7 +300,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'))
})
} }
}) })
} }
...@@ -473,7 +486,7 @@ class Landing extends Component { ...@@ -473,7 +486,7 @@ class Landing extends Component {
</button> </button>
} }
{ {
prize_info && !activityEnd && !isCaptain && <div className="certainly-prompt"> prize_info && prize_info.length !== 0 && !activityEnd && !isCaptain && <div className="certainly-prompt">
{prize_info[0].stage_no}次必中 {prize_info[0].name} {prize_info[0].stage_no}次必中 {prize_info[0].name}
</div> </div>
} }
......
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