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
b4b7bee6
Commit
b4b7bee6
authored
Sep 11, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拼团中间页允许不登录查看
parent
21d6d60a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
41 deletions
+34
-41
src/components/detail/group/togroup.js
+34
-41
src/components/passport/store/actions.js
+0
-0
src/components/passport/store/reducers.js
+0
-0
No files found.
src/components/detail/group/togroup.js
View file @
b4b7bee6
import
React
,
{
Component
}
from
'react'
import
React
,
{
Component
}
from
'react'
import
'./togroup.scss'
import
'./togroup.scss'
import
{
HeaderBar
,
VList
}
from
'../../../common'
import
{
HeaderBar
,
VList
}
from
'../../../common'
import
{
getParam
,
http
,
browser
,
wxShare
}
from
"@/utils"
;
import
{
getParam
,
http
,
browser
,
wxShare
}
from
"@/utils"
;
import
{
connect
}
from
"react-redux"
import
{
connect
}
from
"react-redux"
import
{
Link
}
from
"react-router-dom"
import
{
Link
}
from
"react-router-dom"
import
{
WingBlank
,
WhiteSpace
,
Flex
,
Toast
,
Modal
}
from
'antd-mobile'
import
{
WingBlank
,
WhiteSpace
,
Flex
,
Toast
,
Modal
}
from
'antd-mobile'
import
{
getCourses
}
from
'./../../detail/actions'
;
@
connect
()
@
connect
(
state
=>
({
user
:
state
.
user
}))
class
ToGroup
extends
Component
{
class
ToGroup
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
...
@@ -19,7 +18,6 @@ class ToGroup extends Component {
...
@@ -19,7 +18,6 @@ class ToGroup extends Component {
groupon_member
:
[],
groupon_member
:
[],
person_num
:
0
,
// 共多少人成团
person_num
:
0
,
// 共多少人成团
is_success
:
false
,
// 是否拼团成功
is_success
:
false
,
// 是否拼团成功
userInfo
:
{},
number
:
0
,
// 差几人成团
number
:
0
,
// 差几人成团
isBuy
:
false
,
isBuy
:
false
,
modal
:
false
,
modal
:
false
,
...
@@ -28,7 +26,7 @@ class ToGroup extends Component {
...
@@ -28,7 +26,7 @@ class ToGroup extends Component {
invitedFriends
=
()
=>
{
invitedFriends
=
()
=>
{
const
{
pdd_price
,
number
,
data
}
=
this
.
state
;
const
{
pdd_price
,
number
,
data
}
=
this
.
state
;
if
(
browser
.
isWeixin
)
{
if
(
browser
.
isWeixin
)
{
let
share
=
this
.
state
.
share
;
let
share
=
this
.
state
.
share
;
this
.
setState
({
this
.
setState
({
share
:
!
share
,
share
:
!
share
,
...
@@ -40,21 +38,14 @@ class ToGroup extends Component {
...
@@ -40,21 +38,14 @@ class ToGroup extends Component {
imgUrl
:
data
.
image_name
,
imgUrl
:
data
.
image_name
,
});
});
}
else
{
}
else
{
Toast
.
info
(
'请在微信中使用分享功能!'
,
2
);
Toast
.
info
(
'请在微信中使用分享功能!'
,
2
);
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
Promise
.
all
([
http
.
get
(
`
${
API
[
'base-api'
]}
/pdd/goupon_pay_page/
${
getParam
(
'id'
)}
`
),
http
.
get
(
`
${
API
.
home
}
/m/user_info`
)]).
then
(
resultList
=>
{
http
.
get
(
`
${
API
[
'base-api'
]}
/pdd/info/
${
getParam
(
'id'
)}
`
).
then
(
res
=>
{
console
.
log
(
resultList
);
if
(
res
.
data
.
errno
!==
0
)
{
let
res
=
resultList
[
0
],
userInfo
=
resultList
[
1
];
if
(
res
.
data
.
errno
!==
0
)
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
return
;
}
if
(
userInfo
.
data
.
code
!==
200
)
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
Toast
.
info
(
res
.
data
.
msg
,
2
);
return
;
return
;
}
}
...
@@ -65,13 +56,12 @@ class ToGroup extends Component {
...
@@ -65,13 +56,12 @@ class ToGroup extends Component {
is_success
:
res
.
data
.
data
.
is_success
,
is_success
:
res
.
data
.
data
.
is_success
,
person_num
:
res
.
data
.
data
.
person_num
,
person_num
:
res
.
data
.
data
.
person_num
,
course_list
:
res
.
data
.
data
.
course_list
,
course_list
:
res
.
data
.
data
.
course_list
,
userInfo
,
number
:
res
.
data
.
data
.
number
,
number
:
res
.
data
.
data
.
number
,
countdown
:
''
,
countdown
:
''
,
isBuy
:
res
.
data
.
data
.
is_buy
isBuy
:
res
.
data
.
data
.
is_buy
});
});
if
(
res
.
data
.
data
.
is_success
===
0
)
{
if
(
res
.
data
.
data
.
is_success
===
0
)
{
let
date
=
res
.
data
.
data
.
end_time
*
1000
,
let
date
=
res
.
data
.
data
.
end_time
*
1000
,
hours
=
0
,
hours
=
0
,
minutes
=
0
,
minutes
=
0
,
...
@@ -80,7 +70,7 @@ class ToGroup extends Component {
...
@@ -80,7 +70,7 @@ class ToGroup extends Component {
date
-=
1000
date
-=
1000
hours
=
`
${
parseInt
(
date
/
(
60
*
60
*
1000
))}
`
.
padStart
(
2
,
0
);
hours
=
`
${
parseInt
(
date
/
(
60
*
60
*
1000
))}
`
.
padStart
(
2
,
0
);
minutes
=
`
${
parseInt
((
date
-
hours
*
3600000
)
/
60000
)}
`
.
padStart
(
2
,
0
);
minutes
=
`
${
parseInt
((
date
-
hours
*
3600000
)
/
60000
)}
`
.
padStart
(
2
,
0
);
seconds
=
`
${
parseInt
((
date
-
hours
*
3600000
-
minutes
*
60000
)
/
1000
)}
`
.
padStart
(
2
,
0
);
seconds
=
`
${
parseInt
((
date
-
hours
*
3600000
-
minutes
*
60000
)
/
1000
)}
`
.
padStart
(
2
,
0
);
this
.
setState
({
this
.
setState
({
countdown
:
`
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
countdown
:
`
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
});
});
...
@@ -90,33 +80,36 @@ class ToGroup extends Component {
...
@@ -90,33 +80,36 @@ class ToGroup extends Component {
}
}
toCourseDetail
=
(
id
)
=>
{
toCourseDetail
=
(
id
)
=>
{
const
{
dispatch
,
history
}
=
this
.
props
;
const
{
history
}
=
this
.
props
;
// dispatch(getCourses(id, () => {
history
.
push
(
`/detail?id=
${
id
}
`
,
{
href
:
'/classify'
});
history
.
push
(
`/detail?id=
${
id
}
`
,
{
href
:
'/classify'
});
return
false
;
return
false
;
// }));
}
}
handleToGroup
=
()
=>
{
handleToGroup
=
()
=>
{
const
{
isBuy
=
false
,
data
=
{}
}
=
this
.
state
;
const
{
isBuy
=
false
,
data
=
{}}
=
this
.
state
;
const
{
history
}
=
this
.
props
;
const
{
user
,
history
,
location
}
=
this
.
props
;
if
(
!
isBuy
){
if
(
user
.
hasError
)
{
history
.
push
(
'/passport'
,
{
from
:
location
})
return
}
if
(
!
isBuy
)
{
history
.
push
(
history
.
push
(
`/order?id=
${
data
.
course_id
}
`
,
`/order?id=
${
data
.
course_id
}
`
,
{
{
group
:
1
group
:
1
}
}
)
)
}
else
{
}
else
{
this
.
setState
({
this
.
setState
({
modal
:
true
modal
:
true
})
})
}
}
console
.
log
(
this
.
state
);
}
}
render
()
{
render
()
{
const
{
data
:
{
course_id
,
course_title
,
simpledescription
,
price0
,
price1
},
pdd_price
,
is_success
,
person_num
,
groupon_member
,
course_list
}
=
this
.
state
;
const
{
data
:
{
course_id
,
course_title
,
simpledescription
,
price0
,
price1
},
pdd_price
,
is_success
,
person_num
,
groupon_member
,
course_list
}
=
this
.
state
;
const
Info
=
(
const
Info
=
(
<
div
className
=
"info"
>
<
div
className
=
"info"
>
<
p
className
=
'title'
onClick
=
{()
=>
this
.
toCourseDetail
(
course_id
)}
>
<
p
className
=
'title'
onClick
=
{()
=>
this
.
toCourseDetail
(
course_id
)}
>
...
@@ -168,13 +161,15 @@ class ToGroup extends Component {
...
@@ -168,13 +161,15 @@ class ToGroup extends Component {
data
=
{
this
.
state
}
data
=
{
this
.
state
}
invitedFriends
=
{
this
.
invitedFriends
}
invitedFriends
=
{
this
.
invitedFriends
}
handleToGroup
=
{
this
.
handleToGroup
}
handleToGroup
=
{
this
.
handleToGroup
}
userInfo
=
{
this
.
props
.
user
}
/
>
/
>
<
WhiteSpace
><
/WhiteSpace
>
<
WhiteSpace
><
/WhiteSpace
>
<
div
className
=
"group-course"
>
<
div
className
=
"group-course"
>
<
div
className
=
"top-title"
>
<
div
className
=
"top-title"
>
<
span
>
本周特惠
<
/span
>
<
span
>
本周特惠
<
/span
>
<
Link
to
=
{
`/preferential`
}
className
=
'more'
>
更多
<
i
className
=
'iconfont iconiconfront-70'
><
/i></
Link
>
<
Link
to
=
{
`/preferential`
}
className
=
'more'
>
更多
<
i
className
=
'iconfont iconiconfront-70'
><
/i></
Link
>
<
/div
>
<
/div
>
{
{
(
course_list
&&
course_list
.
length
>
0
)
&&
(
course_list
[
0
].
course
&&
course_list
[
0
].
course
.
length
>
0
)
&&
course_list
[
0
].
course
.
slice
(
0
,
4
).
map
(
item
=>
{
(
course_list
&&
course_list
.
length
>
0
)
&&
(
course_list
[
0
].
course
&&
course_list
[
0
].
course
.
length
>
0
)
&&
course_list
[
0
].
course
.
slice
(
0
,
4
).
map
(
item
=>
{
...
@@ -213,10 +208,10 @@ class ToGroup extends Component {
...
@@ -213,10 +208,10 @@ class ToGroup extends Component {
function
GorupContent
(
props
)
{
function
GorupContent
(
props
)
{
let
tip
,
btn
,
dec
,
groupTip
,
shareTip
,
groupSuccessMbc
;
let
tip
,
btn
,
dec
,
groupTip
,
shareTip
,
groupSuccessMbc
;
const
{
pdd_price
,
data
,
groupon_member
,
is_success
,
person_num
,
userInfo
,
share
,
number
,
countdown
}
=
props
.
data
;
const
{
pdd_price
,
data
,
groupon_member
,
is_success
,
person_num
,
share
,
number
,
countdown
}
=
props
.
data
;
const
{
userInfo
}
=
props
let
ary
=
[],
num
=
number
;
let
ary
=
[],
num
=
number
;
while
(
num
!=
0
)
{
while
(
num
!=
0
)
{
ary
.
push
(
num
);
ary
.
push
(
num
);
num
--
;
num
--
;
}
}
...
@@ -226,7 +221,7 @@ function GorupContent(props) {
...
@@ -226,7 +221,7 @@ function GorupContent(props) {
groupon_member
.
map
(
item
=>
{
groupon_member
.
map
(
item
=>
{
return
(
return
(
<
div
className
=
'imgContainer'
key
=
{
Math
.
random
()}
>
<
div
className
=
'imgContainer'
key
=
{
Math
.
random
()}
>
<
img
className
=
'imgname'
src
=
{
item
.
avatar
}
alt
=
''
/>
<
img
className
=
'imgname'
src
=
{
item
.
avatar
}
alt
=
''
/>
{
{
item
.
user_type
===
1
?
(
item
.
user_type
===
1
?
(
<
div
className
=
'leaderFlag'
>
<
div
className
=
'leaderFlag'
>
...
@@ -250,21 +245,19 @@ function GorupContent(props) {
...
@@ -250,21 +245,19 @@ function GorupContent(props) {
<
/div>
)
;
<
/div>
)
;
if
(
groupon_member
&&
groupon_member
.
length
>
0
)
{
if
(
groupon_member
&&
groupon_member
.
length
>
0
)
{
let
uid
=
''
;
let
flag
=
false
;
let
flag
=
false
;
groupon_member
.
map
(
item
=>
{
!
userInfo
.
hasError
&&
groupon_member
.
map
(
item
=>
{
if
(
item
.
uid
==
userInfo
.
data
.
data
.
uid
)
{
if
(
item
.
uid
==
userInfo
.
data
.
uid
)
{
// uid = `${item.uid}`;
flag
=
true
flag
=
true
}
}
})
})
if
(
flag
)
{
if
(
flag
)
{
tip
=
<
p
className
=
'tip'
>
{
`拼团省¥
${
data
.
price1
-
pdd_price
}
元`
}
<
/p
>
tip
=
<
p
className
=
'tip'
>
{
`拼团省¥
${
data
.
price1
-
pdd_price
}
元`
}
<
/p
>
btn
=
<
span
className
=
'group-btn'
onClick
=
{
props
.
invitedFriends
}
>
邀请好友参团
{
countdown
}
后结束
<
/span
>
btn
=
<
span
className
=
'group-btn'
onClick
=
{
props
.
invitedFriends
}
>
邀请好友参团
{
countdown
}
后结束
<
/span
>
dec
=
<
p
className
=
'dec'
>
分享到
3
个群后,成团率高达
98
%<
/p
>
dec
=
<
p
className
=
'dec'
>
分享到
3
个群后,成团率高达
98
%<
/p
>
}
else
{
}
else
{
tip
=
<
p
className
=
'tip'
>
{
`拼团省¥
${
data
.
price1
-
pdd_price
}
元`
}
<
/p
>
tip
=
<
p
className
=
'tip'
>
{
`拼团省¥
${
data
.
price1
-
pdd_price
}
元`
}
<
/p
>
// btn = <Link to={{
// btn = <Link to={{
// pathname: '/order',
// pathname: '/order',
// search: `?id=${data.course_id}`,
// search: `?id=${data.course_id}`,
...
...
src/components/passport/store/actions.js
deleted
100644 → 0
View file @
21d6d60a
src/components/passport/store/reducers.js
deleted
100644 → 0
View file @
21d6d60a
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