Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
5fcc8bf1
Commit
5fcc8bf1
authored
Jul 09, 2020
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
717-邀请好友组队答题
parent
307f4f0f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
18 deletions
+114
-18
src/components/activity/2020-717/invitation/index.js
+7
-1
src/components/activity/2020-717/question/index.js
+73
-17
src/components/activity/2020-717/question/index.scss
+34
-0
No files found.
src/components/activity/2020-717/invitation/index.js
View file @
5fcc8bf1
...
...
@@ -117,6 +117,12 @@ class Invitation extends Component {
})
}
// 答题抽奖
drawQuestions
=
()
=>
{
const
{
history
,
user
}
=
this
.
props
history
.
push
(
`/anniversary_2020/question/
${
user
.
data
.
uid
}
`
)
}
render
()
{
const
{
prizes
,
invitationInfo
,
isShowGuide
,
teamInfo
,
isMaster
,
isActivityEnd
}
=
this
.
state
const
{
location
}
=
this
.
props
...
...
@@ -186,7 +192,7 @@ class Invitation extends Component {
?
<
button
className
=
{
'activity-end'
}
>
活动结束
<
/button
>
:
teamInfo
.
status
===
1
?
<
button
className
=
{
'btn'
}
onClick
=
{
this
.
joinTeam
}
>
加入队伍
<
/button
>
:
<
button
className
=
{
'btn'
}
>
答题抽奖
<
/button
>
:
<
button
className
=
{
'btn'
}
onClick
=
{
this
.
drawQuestions
}
>
答题抽奖
<
/button
>
}
<
/
>
}
...
...
src/components/activity/2020-717/question/index.js
View file @
5fcc8bf1
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
import
'./index.scss'
import
{
Toast
}
from
"antd-mobile"
;
import
{
Toast
}
from
"antd-mobile"
import
classnames
from
'classnames'
import
{
browser
,
http
}
from
"@/utils"
import
{
WithFullSize
}
from
"@/HOCs"
import
{
Link
}
from
"react-router-dom"
;
import
{
compose
}
from
'redux'
import
{
connect
}
from
'react-redux'
import
{
addData
,
ADD_RECOMMENDS
,
ADD_QUESTION
,
ADD_RESULT
,
REDO
}
from
'./store/reducer'
import
{
browser
,
http
}
from
"@/utils"
import
{
WithFullSize
}
from
"@/HOCs"
import
{
Link
}
from
"react-router-dom"
import
{
compose
}
from
'redux'
import
{
connect
}
from
'react-redux'
import
{
addData
,
ADD_RECOMMENDS
,
ADD_QUESTION
,
ADD_RESULT
,
REDO
}
from
'./store/reducer'
class
Question
extends
Component
{
...
...
@@ -17,8 +17,11 @@ class Question extends Component {
recommends
:
[],
selectedOptionId
:
0
,
isShowConfirm
:
false
,
isResultConfirm
:
false
,
isTeamHead
:
this
.
props
.
match
.
params
.
assistId
===
undefined
,
isActivityEnd
:
false
,
is_correct
:
''
,
is_sign
:
''
,
}
componentDidMount
()
{
...
...
@@ -56,7 +59,7 @@ class Question extends Component {
select
=
(
id
)
=>
{
this
.
setState
({
selectedOptionId
:
id
,
});
})
}
submit
=
()
=>
{
...
...
@@ -73,8 +76,11 @@ class Question extends Component {
this
.
afterSubmitted
(
data
)
this
.
setState
({
isShowConfirm
:
false
,
isResultConfirm
:
true
,
selectedOptionId
:
undefined
,
});
is_correct
:
data
.
is_correct
,
is_sign
:
data
.
is_sign
})
this
.
props
.
addData
({
payload
:
data
,
type
:
ADD_RESULT
,
...
...
@@ -85,6 +91,24 @@ class Question extends Component {
})
}
resultFun
=
()
=>
{
const
{
history
}
=
this
.
props
if
(
this
.
state
.
is_sign
)
{
history
.
push
(
'/anniversary_2020'
)
}
else
{
http
.
get
(
`
${
API
.
home
}
/activity/anniversary/sign`
)
.
then
(
res
=>
{
const
{
code
,
msg
}
=
res
.
data
if
(
code
===
200
)
{
Toast
.
info
(
'签到成功 抽奖次数+1'
)
history
.
push
(
'/anniversary_2020'
)
}
else
{
Toast
.
info
(
msg
)
}
})
}
}
afterSubmitted
=
(
result
)
=>
{
const
{
isTeamHead
}
=
this
.
state
...
...
@@ -131,6 +155,7 @@ class Question extends Component {
selectedOptionId
,
isShowConfirm
,
isActivityEnd
,
isResultConfirm
,
isTeamHead
,
}
=
this
.
state
...
...
@@ -184,12 +209,13 @@ class Question extends Component {
}
<
div
className
=
"submit-bar"
>
<
BottomButton
result
=
{
result
}
resultFun
=
{
this
.
resultFun
}
isTeamHead
=
{
isTeamHead
}
submit
=
{()
=>
{
if
(
this
.
state
.
selectedOptionId
)
{
this
.
setState
({
isShowConfirm
:
true
,
});
})
}
}}
redo
=
{
this
.
redo
}
...
...
@@ -200,14 +226,38 @@ class Question extends Component {
<
Confirm
submit
=
{
this
.
submit
}
cancel
=
{()
=>
{
this
.
setState
({
isShowConfirm
:
false
,
});
})
}}
><
/Confirm
>
}
{
isResultConfirm
&&
<
ResultConfirm
resultFun
=
{
this
.
resultFun
}
is_correct
=
{
this
.
state
.
is_correct
}
is_sign
=
{
this
.
state
.
is_sign
}
><
/ResultConfirm
>
}
<
/div
>
);
)
}
}
function
ResultConfirm
({
resultFun
,
is_correct
,
is_sign
})
{
return
<
div
className
=
"modal-cover"
>
<
div
className
=
"modal"
>
{
is_correct
===
1
&&
<
div
className
=
"title"
>
回答正确,抽奖次数
+
1
<
/div
>
}
{
is_correct
===
0
&&
<
div
className
=
"rusult-title"
>
很遗憾,回答错误
<
p
>
快去抽奖提提神吧
<
/p></
div
>
}
<
div
className
=
{
'btm-button'
}
>
<
button
onClick
=
{
resultFun
}
>
{
is_sign
?
'去抽奖'
:
'签到领取抽奖机会'
}
<
/button
>
<
/div
>
<
/div
>
<
/div
>
}
function
Confirm
({
submit
,
cancel
})
{
return
<
div
className
=
"modal-cover"
>
<
div
className
=
"modal"
>
...
...
@@ -228,7 +278,7 @@ function Result() {
<
/div
>
}
function
BottomButton
({
result
,
submit
,
isTeamHead
,
redo
})
{
function
BottomButton
({
result
Fun
,
result
,
submit
,
isTeamHead
,
redo
})
{
if
(
result
.
stage
===
4
)
{
return
<
button
className
=
{
'activity-end'
}
>
活动已结束
<
/button
>
}
...
...
@@ -238,9 +288,15 @@ function BottomButton({result, submit, isTeamHead, redo}) {
?
<
button
className
=
{
'lottery-related'
}
><
Link
to
=
{
`/anniversary_2020/invitation`
}
>
组队答题抽奖
<
/Link></
button
>
:
<
button
className
=
{
'submit'
}
onClick
=
{
redo
}
>
继续答题
<
/button
>
}
}
else
{
if
(
result
.
analysis
)
{
return
!
result
.
is_sign
?
<
button
className
=
{
'lottery-related'
}
onClick
=
{
resultFun
}
>
签到领取抽奖机会
<
/button
>
:
<
button
className
=
{
'submit'
}
onClick
=
{
resultFun
}
>
去抽奖
<
/button
>
}
return
<
button
className
=
{
'submit'
}
onClick
=
{
submit
}
>
提交
<
/button
>
}
return
<
button
className
=
{
'submit'
}
onClick
=
{
submit
}
>
提交
<
/button
>
}
function
Recommends
({
recommends
})
{
...
...
@@ -268,4 +324,4 @@ export default compose(
addData
:
data
=>
dispatch
(
addData
(
data
)),
}),
),
)(
Question
);
\ No newline at end of file
)(
Question
)
\ No newline at end of file
src/components/activity/2020-717/question/index.scss
View file @
5fcc8bf1
...
...
@@ -204,6 +204,40 @@
color
:
#525C65
;
}
.rusult-title
{
text-align
:
center
;
padding-top
:
20px
;
color
:
#525C65
;
font-size
:
18px
;
font-weight
:
500
;
margin-bottom
:
20px
;
p
{
margin-top
:
10px
;
color
:
#525C65
;
font-size
:
15px
;
font-weight
:
400
;
}
}
.btm-button
{
width
:
100%
;
margin
:
0
0
20px
0
;
text-align
:
center
;
button
{
min-width
:
128px
;
height
:
33px
;
background
:
rgba
(
250
,
228
,
77
,
1
);
border-radius
:
4px
;
border
:
none
;
color
:
#2034F5
;
font-size
:
16px
;
font-weight
:
500
;
padding
:
0
17px
;
}
}
.btns
{
border-top
:
1px
solid
#DDD
;
height
:
44px
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment