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
39a7c8fa
Commit
39a7c8fa
authored
Jun 21, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跨域
parent
d493c440
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
50 deletions
+59
-50
src/components/detail/group/index.js
+48
-48
src/components/detail/group/togroup.js
+8
-1
src/utils/http.js
+3
-1
No files found.
src/components/detail/group/index.js
View file @
39a7c8fa
import
React
,
{
Component
}
from
'react'
import
React
,
{
Component
}
from
'react'
import
'./index.scss'
import
'./index.scss'
import
{
getParam
}
from
"@/utils"
import
{
getParam
}
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
{
Flex
}
from
'antd-mobile'
import
{
Flex
}
from
'antd-mobile'
class
Group
extends
Component
{
class
Group
extends
Component
{
...
@@ -36,9 +36,9 @@ class Group extends Component {
...
@@ -36,9 +36,9 @@ class Group extends Component {
toPay
=
(
pdd_order_id
)
=>
{
toPay
=
(
pdd_order_id
)
=>
{
const
courseInfo
=
this
.
props
.
courseInfo
.
courseInfo
.
course_info
;
const
courseInfo
=
this
.
props
.
courseInfo
.
courseInfo
.
course_info
;
if
(
courseInfo
.
group_status
===
3
)
{
if
(
courseInfo
.
group_status
===
3
)
{
this
.
props
.
history
.
push
(
`/order?id=
${
getParam
(
'id'
)}
&&groupon_code=
${
pdd_order_id
}
`
);
this
.
props
.
history
.
push
(
`/order?id=
${
getParam
(
'id'
)}
&&groupon_code=
${
pdd_order_id
}
`
);
}
else
{
}
else
{
this
.
setState
({
this
.
setState
({
isShowMore
:
false
,
isShowMore
:
false
,
alreadyIn
:
true
alreadyIn
:
true
...
@@ -51,8 +51,8 @@ class Group extends Component {
...
@@ -51,8 +51,8 @@ class Group extends Component {
isShowMore
:
false
,
isShowMore
:
false
,
alreadyIn
:
false
,
alreadyIn
:
false
,
});
});
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
,
...
@@ -64,7 +64,7 @@ class Group extends Component {
...
@@ -64,7 +64,7 @@ class Group extends Component {
imgUrl
:
data
.
image_name
,
// 分享图标
imgUrl
:
data
.
image_name
,
// 分享图标
};
};
http
.
post
(
`
${
api
[
'pay-api'
]}
/m/sale/signature`
).
then
(
res
=>
{
http
.
post
(
`
${
api
[
'pay-api'
]}
/m/sale/signature`
).
then
(
res
=>
{
const
{
nonce_str
,
signature
,
timestamp
}
=
res
.
data
;
const
{
nonce_str
,
signature
,
timestamp
}
=
res
.
data
;
wx
.
config
({
wx
.
config
({
"debug"
:
false
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
"debug"
:
false
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
"appId"
:
'wx23dac6775ac82877'
,
// 必填,公众号的唯一标识
"appId"
:
'wx23dac6775ac82877'
,
// 必填,公众号的唯一标识
...
@@ -84,22 +84,22 @@ class Group extends Component {
...
@@ -84,22 +84,22 @@ class Group extends Component {
wx
.
ready
(
function
()
{
//需在用户可能点击分享按钮前就先调用
wx
.
ready
(
function
()
{
//需在用户可能点击分享按钮前就先调用
wx
.
hideAllNonBaseMenuItem
();
wx
.
hideAllNonBaseMenuItem
();
wx
.
showMenuItems
({
wx
.
showMenuItems
({
menuList
:
[
'menuItem:share:appMessage'
,
'menuItem:share:timeline'
]
// 要显示的菜单项,所有menu项见附录3
menuList
:
[
'menuItem:share:appMessage'
,
'menuItem:share:timeline'
]
// 要显示的菜单项,所有menu项见附录3
});
});
wx
.
updateAppMessageShareData
({
wx
.
updateAppMessageShareData
({
...
shareData
,
...
shareData
,
success
:
function
()
{
success
:
function
()
{
// 设置成功
// 设置成功
}
}
})
})
wx
.
updateTimelineShareData
({
wx
.
updateTimelineShareData
({
...
shareData
,
...
shareData
,
success
:
function
()
{
success
:
function
()
{
// 设置成功
// 设置成功
}
}
})
})
});
});
}
else
{
}
else
{
Toast
.
info
(
'请在微信中使用分享功能!'
,
2
);
Toast
.
info
(
'请在微信中使用分享功能!'
,
2
);
}
}
}
}
...
@@ -113,9 +113,9 @@ class Group extends Component {
...
@@ -113,9 +113,9 @@ class Group extends Component {
componentDidMount
()
{
componentDidMount
()
{
if
(
this
.
props
.
courseInfo
&&
this
.
props
.
courseInfo
.
courseInfo
&&
this
.
props
.
courseInfo
.
courseInfo
.
course_info
&&
this
.
props
.
courseInfo
.
courseInfo
.
course_info
.
pdd_group_info
)
{
if
(
this
.
props
.
courseInfo
&&
this
.
props
.
courseInfo
.
courseInfo
&&
this
.
props
.
courseInfo
.
courseInfo
.
course_info
&&
this
.
props
.
courseInfo
.
courseInfo
.
course_info
.
pdd_group_info
)
{
let
now_groupon_list
=
this
.
props
.
courseInfo
.
courseInfo
.
course_info
.
pdd_group_info
.
now_groupon_list
;
let
now_groupon_list
=
this
.
props
.
courseInfo
.
courseInfo
.
course_info
.
pdd_group_info
.
now_groupon_list
;
if
(
now_groupon_list
&&
now_groupon_list
.
length
>
0
)
{
if
(
now_groupon_list
&&
now_groupon_list
.
length
>
0
)
{
setInterval
(()
=>
{
setInterval
(()
=>
{
now_groupon_list
.
map
(
item
=>
{
now_groupon_list
.
map
(
item
=>
{
item
.
end_time
-=
1
;
item
.
end_time
-=
1
;
return
item
;
return
item
;
});
});
...
@@ -135,29 +135,29 @@ class Group extends Component {
...
@@ -135,29 +135,29 @@ class Group extends Component {
formatTimeByMillisecond
=
(
millisecond
)
=>
{
formatTimeByMillisecond
=
(
millisecond
)
=>
{
let
date
=
millisecond
*
1000
,
let
date
=
millisecond
*
1000
,
hours
=
0
,
hours
=
0
,
minutes
=
0
,
minutes
=
0
,
seconds
=
0
;
seconds
=
0
;
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
);
return
`
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
;
return
`
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
;
}
}
render
()
{
render
()
{
const
{
alreadyIn
,
countdown
,
now_groupon_list
}
=
this
.
state
;
const
{
alreadyIn
,
countdown
,
now_groupon_list
}
=
this
.
state
;
let
groupInfo
=
''
,
groupon_member
=
''
,
group_status
=
-
1
,
groupSuccessMbc
=
null
;
let
groupInfo
=
''
,
groupon_member
=
''
,
group_status
=
-
1
,
groupSuccessMbc
=
null
;
if
(
this
.
props
.
courseInfo
&&
this
.
props
.
courseInfo
.
courseInfo
&&
this
.
props
.
courseInfo
.
courseInfo
.
course_info
)
{
if
(
this
.
props
.
courseInfo
&&
this
.
props
.
courseInfo
.
courseInfo
&&
this
.
props
.
courseInfo
.
courseInfo
.
course_info
)
{
groupInfo
=
this
.
props
.
courseInfo
.
courseInfo
.
course_info
.
pdd_group_info
;
groupInfo
=
this
.
props
.
courseInfo
.
courseInfo
.
course_info
.
pdd_group_info
;
groupon_member
=
groupInfo
.
groupon_member
;
groupon_member
=
groupInfo
.
groupon_member
;
group_status
=
this
.
props
.
courseInfo
.
courseInfo
.
course_info
.
group_status
;
group_status
=
this
.
props
.
courseInfo
.
courseInfo
.
course_info
.
group_status
;
}
}
if
(
group_status
===
4
)
{
if
(
group_status
===
4
)
{
if
(
groupon_member
.
member
)
{
if
(
groupon_member
.
member
)
{
const
{
number
}
=
groupon_member
;
const
{
number
}
=
groupon_member
;
let
ary
=
[],
num
=
number
;
let
ary
=
[],
num
=
number
;
while
(
num
!=
0
)
{
while
(
num
!=
0
)
{
ary
.
push
(
num
);
ary
.
push
(
num
);
num
--
;
num
--
;
}
}
...
@@ -190,17 +190,17 @@ class Group extends Component {
...
@@ -190,17 +190,17 @@ class Group extends Component {
<
/Flex
>
<
/Flex
>
<
/div>
)
;
<
/div>
)
;
groupSuccessMbc
=
<
div
className
=
'groupSuccessMbc'
onClick
=
{
this
.
hideMbc
}
>
groupSuccessMbc
=
<
div
className
=
'groupSuccessMbc'
onClick
=
{
this
.
hideMbc
}
>
<
div
className
=
'content'
>
<
div
className
=
'content'
>
<
p
>
你已参团
<
/p
>
<
p
>
你已参团
<
/p
>
{
groupTip
}
{
groupTip
}
<
div
className
=
'group-btn'
onClick
=
{
this
.
invitedFriends
}
>
邀请好友参团
{
countdown
}
后结束
<
/div
>
<
div
className
=
'group-btn'
onClick
=
{
this
.
invitedFriends
}
>
邀请好友参团
{
countdown
}
后结束
<
/div
>
<
p
className
=
'dec'
>
分享到
3
个群后,成团率高达
98
%<
/p
>
<
p
className
=
'dec'
>
分享到
3
个群后,成团率高达
98
%<
/p
>
<
/div
>
<
/div
>
<
/div>
;
<
/div>
;
}
}
}
}
return
(
return
(
<
div
className
=
'group-box'
>
<
div
className
=
'group-box'
>
<
div
className
=
"group-title"
>
<
div
className
=
"group-title"
>
...
@@ -216,7 +216,7 @@ class Group extends Component {
...
@@ -216,7 +216,7 @@ class Group extends Component {
groupInfo
.
now_groupon_list
&&
groupInfo
.
now_groupon_list
.
length
>
0
&&
groupInfo
.
now_groupon_list
.
map
((
item
,
index
)
=>
{
groupInfo
.
now_groupon_list
&&
groupInfo
.
now_groupon_list
.
length
>
0
&&
groupInfo
.
now_groupon_list
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
li
key
=
{
index
}
className
=
'group-item'
>
<
li
key
=
{
index
}
className
=
'group-item'
>
<
img
className
=
'avatar'
src
=
{
item
.
avatar
}
alt
=
""
/>
<
img
className
=
'avatar'
src
=
{
item
.
avatar
}
alt
=
""
/>
<
div
className
=
'user-name text-overflow-one'
>
<
div
className
=
'user-name text-overflow-one'
>
{
item
.
user_name
}
{
item
.
user_name
}
<
/div
>
<
/div
>
...
@@ -224,7 +224,7 @@ class Group extends Component {
...
@@ -224,7 +224,7 @@ class Group extends Component {
<
p
>
还差
<
span
className
=
'red'
>
{
item
.
number
}
人
<
/span>拼成</
p
>
<
p
>
还差
<
span
className
=
'red'
>
{
item
.
number
}
人
<
/span>拼成</
p
>
<
p
>
剩余
{
this
.
formatTimeByMillisecond
(
item
.
end_time
)}
<
/p
>
<
p
>
剩余
{
this
.
formatTimeByMillisecond
(
item
.
end_time
)}
<
/p
>
<
/div
>
<
/div
>
<
span
onClick
=
{()
=>
{
this
.
toPay
(
item
.
pdd_order_id
)
}}
className
=
'topay'
>
去参团
<
/span
>
<
span
onClick
=
{()
=>
{
this
.
toPay
(
item
.
pdd_order_id
)
}}
className
=
'topay'
>
去参团
<
/span
>
<
/li
>
<
/li
>
)
)
})
})
...
@@ -243,7 +243,7 @@ class Group extends Component {
...
@@ -243,7 +243,7 @@ class Group extends Component {
{
groupSuccessMbc
}
{
groupSuccessMbc
}
<
/
>
<
/
>
)
)
}
}
{
/*更多*/
}
{
/*更多*/
}
{
{
...
@@ -258,13 +258,13 @@ class Group extends Component {
...
@@ -258,13 +258,13 @@ class Group extends Component {
groupInfo
.
now_groupon_list
&&
groupInfo
.
now_groupon_list
.
length
>
0
&&
groupInfo
.
now_groupon_list
.
map
((
item
,
index
)
=>
{
groupInfo
.
now_groupon_list
&&
groupInfo
.
now_groupon_list
.
length
>
0
&&
groupInfo
.
now_groupon_list
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
li
key
=
{
index
}
className
=
'group-item'
>
<
li
key
=
{
index
}
className
=
'group-item'
>
<
img
className
=
'avatar'
src
=
{
item
.
avatar
}
alt
=
""
/>
<
img
className
=
'avatar'
src
=
{
item
.
avatar
}
alt
=
""
/>
<
div
className
=
'user-name'
>
<
div
className
=
'user-name'
>
<
p
className
=
'name text-overflow-one'
>
{
item
.
user_name
}
<
/p
>
<
p
className
=
'name text-overflow-one'
>
{
item
.
user_name
}
<
/p
>
<
p
className
=
'time'
>
剩余
{
this
.
formatTimeByMillisecond
(
item
.
end_time
)}
<
/p
>
<
p
className
=
'time'
>
剩余
{
this
.
formatTimeByMillisecond
(
item
.
end_time
)}
<
/p
>
<
/div
>
<
/div
>
<
p
className
=
'group-status'
>
还差
{
item
.
number
}
人
<
/p
>
<
p
className
=
'group-status'
>
还差
{
item
.
number
}
人
<
/p
>
<
span
onClick
=
{()
=>
{
this
.
toPay
(
item
.
pdd_order_id
)
}}
className
=
'topay'
>
去参团
<
/span
>
<
span
onClick
=
{()
=>
{
this
.
toPay
(
item
.
pdd_order_id
)
}}
className
=
'topay'
>
去参团
<
/span
>
<
/li
>
<
/li
>
)
)
})
})
...
@@ -275,7 +275,7 @@ class Group extends Component {
...
@@ -275,7 +275,7 @@ class Group extends Component {
<
/div
>
<
/div
>
<
i
onClick
=
{
this
.
closeMore
}
className
=
{
'iconfont iconiconfront-2 close'
}
><
/i
>
<
i
onClick
=
{
this
.
closeMore
}
className
=
{
'iconfont iconiconfront-2 close'
}
><
/i
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
}
}
...
@@ -285,6 +285,6 @@ class Group extends Component {
...
@@ -285,6 +285,6 @@ class Group extends Component {
}
}
export
default
connect
(
export
default
connect
(
state
=>
({
courseInfo
:
state
}),
state
=>
({
courseInfo
:
state
}),
null
null
)(
Group
)
)(
Group
)
src/components/detail/group/togroup.js
View file @
39a7c8fa
...
@@ -82,7 +82,14 @@ class ToGroup extends Component {
...
@@ -82,7 +82,14 @@ class ToGroup extends Component {
console
.
log
(
resultList
);
console
.
log
(
resultList
);
let
res
=
resultList
[
0
],
let
res
=
resultList
[
0
],
userInfo
=
resultList
[
1
];
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
);
return
;
}
this
.
setState
({
this
.
setState
({
data
:
res
.
data
.
data
.
course_info
,
data
:
res
.
data
.
data
.
course_info
,
pdd_price
:
res
.
data
.
data
.
pdd_price
,
pdd_price
:
res
.
data
.
data
.
pdd_price
,
...
...
src/utils/http.js
View file @
39a7c8fa
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
qs
from
'qs'
import
qs
from
'qs'
axios
.
defaults
.
headers
.
post
[
'Content-Type'
]
=
'application/x-www-form-urlencoded'
;
const
instance
=
axios
.
create
({
const
instance
=
axios
.
create
({
transformRequest
:
[
transformRequest
:
[
(
data
)
=>
qs
.
stringify
(
data
)
(
data
)
=>
qs
.
stringify
(
data
)
],
],
headers
:
{
headers
:
{
HTTP_PLAT_FORM
:
5
,
HTTP_PLAT_FORM
:
5
,
HTTP_PLAT
:
5
HTTP_PLAT
:
5
,
}
}
})
})
...
...
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