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
bf513c26
Commit
bf513c26
authored
Jul 09, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
周年庆
parent
5fcc8bf1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
228 additions
and
76 deletions
+228
-76
src/components/activity/2020-717/activity/index.js
+142
-24
src/components/activity/2020-717/activity/index.scss
+19
-1
src/components/activity/2020-717/index.js
+1
-1
src/components/activity/2020-717/invitation/index.js
+41
-20
src/components/activity/2020-717/question/index.js
+24
-29
src/utils/index.js
+1
-1
No files found.
src/components/activity/2020-717/activity/index.js
View file @
bf513c26
This diff is collapsed.
Click to expand it.
src/components/activity/2020-717/activity/index.scss
View file @
bf513c26
...
...
@@ -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
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
...
...
@@ -1117,3 +1118,19 @@
}
}
}
.follow
{
.tip
{
margin-bottom
:
15px
;
}
.qrcode
{
text-align
:
center
;
}
img
{
width
:
120px
;
height
:
120px
;
margin-bottom
:
10px
;
}
}
\ No newline at end of file
src/components/activity/2020-717/index.js
View file @
bf513c26
...
...
@@ -10,7 +10,7 @@ class Anniversary2020Entry extends Component {
const
match
=
this
.
props
.
match
return
(
<
Switch
>
<
Route
path
=
{
`
${
match
.
path
}
/question/:
assistId
?`
}
<
Route
path
=
{
`
${
match
.
path
}
/question/:
isPractice
?`
}
render
=
{
routeProps
=>
(
<
Question
{...
routeProps
}
><
/Question>
)
}></
Route
>
<
Route
path
=
{
`
${
match
.
path
}
/invitation`
}
render
=
{
routeProps
=>
(
<
Invitation
{...
routeProps
}
/>
)
}></
Route
>
<
Route
path
=
{
'/anniversary_2020'
}
...
...
src/components/activity/2020-717/invitation/index.js
View file @
bf513c26
...
...
@@ -4,9 +4,10 @@ import { WithFullSize } from "@/HOCs"
import
{
connect
}
from
"react-redux"
;
import
{
compose
}
from
"redux"
;
import
{
HeaderBar
}
from
"@common/index"
import
{
getParam
,
http
,
browser
}
from
"@/utils"
import
{
getParam
,
http
,
browser
,
wxShare
}
from
"@/utils"
import
{
Toast
}
from
"antd-mobile"
;
import
{
CopyToClipboard
}
from
"react-copy-to-clipboard"
;
import
{
Link
}
from
'react-router-dom'
class
Invitation
extends
Component
{
...
...
@@ -75,6 +76,7 @@ class Invitation extends Component {
if
(
code
===
200
)
{
this
.
setState
({
teamInfo
:
data
,
isMaster
:
data
.
is_captain
||
!
getParam
(
'team_code'
),
});
}
else
{
Toast
.
info
(
msg
)
...
...
@@ -100,7 +102,7 @@ class Invitation extends Component {
.
then
(
res
=>
{
const
{
code
,
msg
}
=
res
.
data
if
(
code
===
200
)
{
Toast
.
info
(
'加入成功'
)
Toast
.
info
(
'加入成功'
,
2
,
null
,
false
)
this
.
setState
((
state
,
props
)
=>
{
return
{
teamInfo
:
{...
state
.
teamInfo
,
...{
status
:
2
}},
...
...
@@ -117,10 +119,22 @@ 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
=
()
=>
{
const
{
history
,
user
}
=
this
.
props
history
.
push
(
`/anniversary_2020/question/
${
user
.
data
.
uid
}
`
)
drawQuestions
=
()
=>
{
const
{
history
}
=
this
.
props
history
.
push
(
`/anniversary_2020/question/
${
0
}
`
)
}
render
()
{
...
...
@@ -129,7 +143,9 @@ class Invitation extends Component {
return
(
<
div
id
=
{
'invitation'
}
>
<
HeaderBar
title
=
{
'答题抽奖'
}
arrow
=
{
true
}
/
>
<
HeaderBar
title
=
{
'答题抽奖'
}
arrow
=
{
true
}
goBack
=
{()
=>
{
this
.
props
.
history
.
push
(
'/anniversary_2020'
)
}}
/
>
{
isMaster
?
<
div
className
=
"banner"
><
/div
>
...
...
@@ -166,12 +182,9 @@ class Invitation extends Component {
<
div
className
=
"tip"
>
再有
{
invitationInfo
.
invite_num
}
位队员答对即可获得
{
invitationInfo
.
draw_chance
}
次抽奖机会
<
/div
>
{
browser
.
isWeixin
?
<
button
className
=
{
'btn'
}
onClick
=
{()
=>
{
this
.
setState
({
isShowGuide
:
true
,
});
}}
>
立即邀请
<
/button
>
:
<
CopyToClipboard
text
=
{
`
${
API
.
m
}${
location
.
pathname
}
?team_code=
${
invitationInfo
.
team_code
}
`
}
?
<
button
className
=
{
'btn'
}
onClick
=
{
this
.
setupWechatShare
}
>
立即邀请
<
/button
>
:
<
CopyToClipboard
text
=
{
`
${
API
.
m
}${
location
.
pathname
}
?team_code=
${
invitationInfo
.
team_code
||
getParam
(
'team_code'
)}
`
}
onCopy
=
{()
=>
{
Toast
.
info
(
'链接已复制,快去粘贴发给好友吧'
)
}}
>
...
...
@@ -183,17 +196,12 @@ class Invitation extends Component {
{
teamInfo
.
status
!==
1
&&
<
div
className
=
{
'tip'
}
>
{
teamInfo
.
status
===
2
?
'已加入当前队伍'
:
teamInfo
===
3
?
'已加入其他队伍'
:
null
teamInfo
.
status
===
2
?
'已加入当前队伍'
:
teamInfo
.
status
===
3
?
'已加入其他队伍'
:
null
}
<
/div
>
}
{
isActivityEnd
?
<
button
className
=
{
'activity-end'
}
>
活动结束
<
/button
>
:
teamInfo
.
status
===
1
?
<
button
className
=
{
'btn'
}
onClick
=
{
this
.
joinTeam
}
>
加入队伍
<
/button
>
:
<
button
className
=
{
'btn'
}
onClick
=
{
this
.
drawQuestions
}
>
答题抽奖
<
/button
>
}
<
BottomButton
isActivityEnd
=
{
isActivityEnd
}
joinTeam
=
{
this
.
joinTeam
}
status
=
{
teamInfo
.
status
}
drawQuestions
=
{
this
.
drawQuestions
}
isAnswered
=
{
teamInfo
.
is_answer
}
/
>
<
/
>
}
...
...
@@ -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
(
WithFullSize
,
connect
(
...
...
src/components/activity/2020-717/question/index.js
View file @
bf513c26
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
{
...
...
@@ -18,7 +18,7 @@ class Question extends Component {
selectedOptionId
:
0
,
isShowConfirm
:
false
,
isResultConfirm
:
false
,
isTeamHead
:
this
.
props
.
match
.
params
.
assistId
===
undefined
,
isTeamHead
:
this
.
props
.
match
.
params
.
isPractice
==
1
,
isActivityEnd
:
false
,
is_correct
:
''
,
is_sign
:
''
,
...
...
@@ -41,8 +41,8 @@ class Question extends Component {
}
getQuestion
=
()
=>
{
const
assistId
=
this
.
props
.
match
.
params
.
assistId
http
.
get
(
`
${
API
.
home
}
/activity/anniversary/get_question/
${
assistId
?
2
:
1
}
/
${
assistId
?
assistId
:
0
}
`
)
const
isPractice
=
this
.
props
.
match
.
params
.
isPractice
http
.
get
(
`
${
API
.
home
}
/activity/anniversary/get_question/
${
isPractice
==
1
?
1
:
2
}
`
)
.
then
(
res
=>
{
const
{
code
,
msg
,
data
}
=
res
.
data
if
(
code
===
200
)
{
...
...
@@ -63,10 +63,10 @@ class Question extends Component {
}
submit
=
()
=>
{
const
assistId
=
this
.
props
.
match
.
params
.
assistId
const
isPractice
=
this
.
props
.
match
.
params
.
isPractice
const
{
selectedOptionId
}
=
this
.
state
http
.
post
(
`
${
API
.
home
}
/activity/anniversary/submit`
,
{
type
:
assistId
?
2
:
1
,
type
:
isPractice
==
1
?
1
:
2
,
option_id
:
selectedOptionId
,
id
:
this
.
props
.
cache
.
question
.
id
,
}).
then
(
res
=>
{
...
...
@@ -76,10 +76,10 @@ class Question extends Component {
this
.
afterSubmitted
(
data
)
this
.
setState
({
isShowConfirm
:
false
,
isResultConfirm
:
true
,
isResultConfirm
:
isPractice
!=
1
,
selectedOptionId
:
undefined
,
is_correct
:
data
.
is_correct
,
is_sign
:
data
.
is_sign
is_sign
:
data
.
is_sign
,
})
this
.
props
.
addData
({
payload
:
data
,
...
...
@@ -94,7 +94,7 @@ class Question extends Component {
resultFun
=
()
=>
{
const
{
history
}
=
this
.
props
if
(
this
.
state
.
is_sign
)
{
history
.
push
(
'/anniversary_2020
'
)
history
.
push
(
'/anniversary_2020#lottery
'
)
}
else
{
http
.
get
(
`
${
API
.
home
}
/activity/anniversary/sign`
)
.
then
(
res
=>
{
...
...
@@ -114,12 +114,12 @@ class Question extends Component {
if
(
isTeamHead
)
{
if
(
result
.
stage
===
4
)
{
this
.
setState
({
isActivityEnd
:
true
,
});
}
else
{
result
.
is_correct
?
Toast
.
info
(
'回答正确 抽奖次数+1'
)
:
Toast
.
info
(
'很遗憾 回答错误'
)
}
}
else
{
}
}
...
...
@@ -211,6 +211,7 @@ class Question extends Component {
<
BottomButton
result
=
{
result
}
resultFun
=
{
this
.
resultFun
}
isTeamHead
=
{
isTeamHead
}
isActivityEnd
=
{
isActivityEnd
}
submit
=
{()
=>
{
if
(
this
.
state
.
selectedOptionId
)
{
this
.
setState
({
...
...
@@ -270,16 +271,8 @@ function Confirm({submit, cancel}) {
<
/div
>
}
function
Result
()
{
return
<
div
className
=
{
'modal-cover'
}
>
<
div
className
=
"modal"
>
<
div
className
=
"title"
><
/div
>
<
/div
>
<
/div
>
}
function
BottomButton
({
resultFun
,
result
,
submit
,
isTeamHead
,
redo
})
{
if
(
result
.
stage
===
4
)
{
function
BottomButton
({
resultFun
,
result
,
submit
,
isTeamHead
,
redo
,
isActivityEnd
})
{
if
(
result
.
stage
===
4
||
isActivityEnd
)
{
return
<
button
className
=
{
'activity-end'
}
>
活动已结束
<
/button
>
}
if
(
isTeamHead
)
{
...
...
@@ -287,6 +280,8 @@ function BottomButton({resultFun, result, submit, isTeamHead, redo}) {
return
result
.
practiceNum
===
0
?
<
button
className
=
{
'lottery-related'
}
><
Link
to
=
{
`/anniversary_2020/invitation`
}
>
组队答题抽奖
<
/Link></
button
>
:
<
button
className
=
{
'submit'
}
onClick
=
{
redo
}
>
继续答题
<
/button
>
}
else
{
return
<
button
className
=
{
'submit'
}
onClick
=
{
submit
}
>
提交
<
/button
>
}
}
else
{
if
(
result
.
analysis
)
{
...
...
src/utils/index.js
View file @
bf513c26
...
...
@@ -145,7 +145,7 @@ export {
browser
,
isLogin
,
dateCountDown
,
isValidUrl
isValidUrl
,
}
export
{
default
as
SendMessageToApp
,
...
...
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