Commit bf513c26 by zhanghaozhe

周年庆

parent 5fcc8bf1
...@@ -872,7 +872,8 @@ ...@@ -872,7 +872,8 @@
} }
} }
td:nth-of-type(2) { td:nth-of-type(2), td:nth-of-type(4) {
text-align: left;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -1116,4 +1117,20 @@ ...@@ -1116,4 +1117,20 @@
} }
} }
} }
}
.follow {
.tip {
margin-bottom: 15px;
}
.qrcode {
text-align: center;
}
img {
width: 120px;
height: 120px;
margin-bottom: 10px;
}
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ class Anniversary2020Entry extends Component { ...@@ -10,7 +10,7 @@ class Anniversary2020Entry extends Component {
const match = this.props.match const match = this.props.match
return ( return (
<Switch> <Switch>
<Route path={`${match.path}/question/:assistId?`} <Route path={`${match.path}/question/:isPractice?`}
render={routeProps => (<Question {...routeProps}></Question>)}></Route> render={routeProps => (<Question {...routeProps}></Question>)}></Route>
<Route path={`${match.path}/invitation`} render={routeProps => (<Invitation {...routeProps}/>)}></Route> <Route path={`${match.path}/invitation`} render={routeProps => (<Invitation {...routeProps}/>)}></Route>
<Route path={'/anniversary_2020'} <Route path={'/anniversary_2020'}
......
...@@ -4,9 +4,10 @@ import { WithFullSize } from "@/HOCs" ...@@ -4,9 +4,10 @@ import { WithFullSize } from "@/HOCs"
import { connect } from "react-redux"; import { connect } from "react-redux";
import { compose } from "redux"; import { compose } from "redux";
import { HeaderBar } from "@common/index" import { HeaderBar } from "@common/index"
import { getParam, http, browser } from "@/utils" import { getParam, http, browser, wxShare } from "@/utils"
import { Toast } from "antd-mobile"; import { Toast } from "antd-mobile";
import { CopyToClipboard } from "react-copy-to-clipboard"; import { CopyToClipboard } from "react-copy-to-clipboard";
import { Link } from 'react-router-dom'
class Invitation extends Component { class Invitation extends Component {
...@@ -75,6 +76,7 @@ class Invitation extends Component { ...@@ -75,6 +76,7 @@ class Invitation extends Component {
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
teamInfo: data, teamInfo: data,
isMaster: data.is_captain || !getParam('team_code'),
}); });
} else { } else {
Toast.info(msg) Toast.info(msg)
...@@ -100,7 +102,7 @@ class Invitation extends Component { ...@@ -100,7 +102,7 @@ class Invitation extends Component {
.then(res => { .then(res => {
const {code, msg} = res.data const {code, msg} = res.data
if (code === 200) { if (code === 200) {
Toast.info('加入成功') Toast.info('加入成功', 2, null, false)
this.setState((state, props) => { this.setState((state, props) => {
return { return {
teamInfo: {...state.teamInfo, ...{status: 2}}, teamInfo: {...state.teamInfo, ...{status: 2}},
...@@ -117,11 +119,23 @@ class Invitation extends Component { ...@@ -117,11 +119,23 @@ class Invitation extends Component {
}) })
} }
setupWechatShare = () => {
wxShare({
title: '答题抽华为P40 Pro+',
desc: '这道题你会吗?答题抽奖,100%有奖的,能不能拿华为P40 Pro+,看你自己了--七月在线',
link: `${API.m}${location.pathname}?team_code=${this.state.invitationInfo.team_code || getParam('team_code')}`,
imgUrl: '',
})
this.setState({
isShowGuide: true,
});
}
// 答题抽奖 // 答题抽奖
drawQuestions=()=>{ drawQuestions = () => {
const {history,user} = this.props const {history} = this.props
history.push(`/anniversary_2020/question/${user.data.uid}`) history.push(`/anniversary_2020/question/${0}`)
} }
render() { render() {
const {prizes, invitationInfo, isShowGuide, teamInfo, isMaster, isActivityEnd} = this.state const {prizes, invitationInfo, isShowGuide, teamInfo, isMaster, isActivityEnd} = this.state
...@@ -129,7 +143,9 @@ class Invitation extends Component { ...@@ -129,7 +143,9 @@ class Invitation extends Component {
return ( return (
<div id={'invitation'}> <div id={'invitation'}>
<HeaderBar title={'答题抽奖'} arrow={true}/> <HeaderBar title={'答题抽奖'} arrow={true} goBack={() => {
this.props.history.push('/anniversary_2020')
}}/>
{ {
isMaster isMaster
? <div className="banner"></div> ? <div className="banner"></div>
...@@ -166,15 +182,12 @@ class Invitation extends Component { ...@@ -166,15 +182,12 @@ class Invitation extends Component {
<div className="tip">再有{invitationInfo.invite_num}位队员答对即可获得{invitationInfo.draw_chance}次抽奖机会</div> <div className="tip">再有{invitationInfo.invite_num}位队员答对即可获得{invitationInfo.draw_chance}次抽奖机会</div>
{ {
browser.isWeixin browser.isWeixin
? <button className={'btn'} onClick={() => { ? <button className={'btn'} onClick={this.setupWechatShare}>立即邀请</button>
this.setState({ : <CopyToClipboard
isShowGuide: true, text={`${API.m}${location.pathname}?team_code=${invitationInfo.team_code || getParam('team_code')}`}
}); onCopy={() => {
}}>立即邀请</button> Toast.info('链接已复制,快去粘贴发给好友吧')
: <CopyToClipboard text={`${API.m}${location.pathname}?team_code=${invitationInfo.team_code}`} }}>
onCopy={() => {
Toast.info('链接已复制,快去粘贴发给好友吧')
}}>
<button className={'btn'}>立即邀请</button> <button className={'btn'}>立即邀请</button>
</CopyToClipboard> </CopyToClipboard>
} }
...@@ -183,17 +196,12 @@ class Invitation extends Component { ...@@ -183,17 +196,12 @@ class Invitation extends Component {
{ {
teamInfo.status !== 1 && <div className={'tip'}> teamInfo.status !== 1 && <div className={'tip'}>
{ {
teamInfo.status === 2 ? '已加入当前队伍' : teamInfo === 3 ? '已加入其他队伍' : null teamInfo.status === 2 ? '已加入当前队伍' : teamInfo.status === 3 ? '已加入其他队伍' : null
} }
</div> </div>
} }
{ <BottomButton isActivityEnd={isActivityEnd} joinTeam={this.joinTeam} status={teamInfo.status}
isActivityEnd drawQuestions={this.drawQuestions} isAnswered={teamInfo.is_answer}/>
? <button className={'activity-end'}>活动结束</button>
: teamInfo.status === 1
? <button className={'btn'} onClick={this.joinTeam}>加入队伍</button>
: <button className={'btn'} onClick={this.drawQuestions}>答题抽奖</button>
}
</> </>
} }
...@@ -214,6 +222,19 @@ class Invitation extends Component { ...@@ -214,6 +222,19 @@ class Invitation extends Component {
} }
} }
function BottomButton({status, isActivityEnd, isAnswered, joinTeam, drawQuestions}) {
if (isActivityEnd) {
return <button className={'activity-end'}>活动结束</button>
}
if (isAnswered) {
return <Link to={`/anniversary_2020#lottery`}>
<button className={'btn'}>去抽奖</button>
</Link>
}
return status === 1 ? <button className={'btn'} onClick={joinTeam}>加入队伍</button> :
<button className={'btn'} onClick={drawQuestions}>答题抽奖</button>
}
export default compose( export default compose(
WithFullSize, WithFullSize,
connect( connect(
......
...@@ -145,7 +145,7 @@ export { ...@@ -145,7 +145,7 @@ export {
browser, browser,
isLogin, isLogin,
dateCountDown, dateCountDown,
isValidUrl isValidUrl,
} }
export { export {
default as SendMessageToApp, default as SendMessageToApp,
......
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