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
082a4f29
Commit
082a4f29
authored
Aug 21, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG解决
parent
d1f490a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
55 deletions
+34
-55
src/components/detail/group/index.js
+15
-55
src/components/detail/index.js
+19
-0
No files found.
src/components/detail/group/index.js
View file @
082a4f29
...
...
@@ -19,6 +19,7 @@ class Group extends Component {
countdown
:
props
.
countdown
,
now_groupon_list
:
[],
}
console
.
log
(
props
);
}
// 查看更多
...
...
@@ -54,64 +55,23 @@ class Group extends Component {
alreadyIn
:
false
,
});
this
.
props
.
invitedFriends
();
return
;
const
{
pdd_price
,
number
,
data
}
=
this
.
state
;
if
(
browser
.
isWeixin
)
{
let
share
=
this
.
state
.
share
;
this
.
setState
({
share
:
!
share
,
});
let
shareData
=
{
title
:
`【仅剩
${
number
}
个名额】我
${
pdd_price
}
元拼了《
${
data
.
course_title
}
》`
,
desc
:
data
.
course_title
,
// 分享描述
link
:
location
.
origin
+
`/detail??id=
${
data
.
course_id
}
`
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl
:
data
.
image_name
,
// 分享图标
};
}
http
.
post
(
`
${
API
[
'base-api'
]}
/m/sale/signature`
).
then
(
res
=>
{
const
{
nonce_str
,
signature
,
timestamp
}
=
res
.
data
;
wx
.
config
({
"debug"
:
false
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
"appId"
:
'wx23dac6775ac82877'
,
// 必填,公众号的唯一标识
"timestamp"
:
timestamp
,
// 必填,生成签名的时间戳
"nonceStr"
:
nonce_str
,
// 必填,生成签名的随机串
"signature"
:
signature
,
// 必填,签名
jsApiList
:
[
'hideMenuItems'
,
'showMenuItems'
,
'updateAppMessageShareData'
,
'updateTimelineShareData'
,
'onMenuShareWeibo'
,
'onMenuShareAppMessage'
,
],
// 必填,需要使用的JS接口列表
});
});
wx
.
ready
(
function
()
{
//需在用户可能点击分享按钮前就先调用
wx
.
hideAllNonBaseMenuItem
();
wx
.
showMenuItems
({
menuList
:
[
'menuItem:share:appMessage'
,
'menuItem:share:timeline'
]
// 要显示的菜单项,所有menu项见附录3
componentWillReceiveProps
(
nextProps
)
{
if
(
nextProps
.
courseInfo
&&
nextProps
.
courseInfo
.
courseInfo
&&
nextProps
.
courseInfo
.
courseInfo
.
course_info
&&
nextProps
.
courseInfo
.
courseInfo
.
course_info
.
pdd_group_info
)
{
let
now_groupon_list
=
nextProps
.
courseInfo
.
courseInfo
.
course_info
.
pdd_group_info
.
now_groupon_list
;
if
(
now_groupon_list
&&
now_groupon_list
.
length
>
0
)
{
now_groupon_list
.
map
(
item
=>
{
item
.
end_time
-=
1
;
return
item
;
});
wx
.
updateAppMessageShareData
({
...
shareData
,
success
:
function
()
{
// 设置成功
}
this
.
setState
({
now_groupon_list
,
})
wx
.
updateTimelineShareData
({
...
shareData
,
success
:
function
()
{
// 设置成功
}
})
});
}
else
{
Toast
.
info
(
'请在微信中使用分享功能!'
,
2
);
}
}
}
componentWillReceiveProps
(
nextProps
)
{
this
.
setState
({
countdown
:
nextProps
.
countdown
,
countdown
:
nextProps
.
countdown
})
}
...
...
@@ -119,7 +79,7 @@ class Group extends Component {
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
;
if
(
now_groupon_list
&&
now_groupon_list
.
length
>
0
)
{
setInterval
(()
=>
{
//
setInterval(() => {
now_groupon_list
.
map
(
item
=>
{
item
.
end_time
-=
1
;
return
item
;
...
...
@@ -127,7 +87,7 @@ class Group extends Component {
this
.
setState
({
now_groupon_list
,
})
},
1000
);
//
}, 1000);
}
}
}
...
...
src/components/detail/index.js
View file @
082a4f29
...
...
@@ -41,6 +41,25 @@ class Detail extends Component {
if
(
courseInfo
.
course_info
.
is_bargain
)
{
this
.
getBargainInfo
();
}
if
(
courseInfo
.
course_info
)
{
let
course_info
=
courseInfo
.
course_info
;
if
(
course_info
.
group_status
===
3
||
course_info
.
group_status
===
4
)
{
let
endTime
=
course_info
.
pdd_group_info
.
groupon_member
.
end_time
;
let
date
=
endTime
*
1000
,
hours
=
0
,
minutes
=
0
,
seconds
=
0
;
setInterval
(()
=>
{
date
-=
1000
hours
=
`
${
parseInt
(
date
/
(
60
*
60
*
1000
))}
`
.
padStart
(
2
,
0
);
minutes
=
`
${
parseInt
((
date
-
hours
*
3600000
)
/
60000
)}
`
.
padStart
(
2
,
0
);
seconds
=
`
${
parseInt
((
date
-
hours
*
3600000
-
minutes
*
60000
)
/
1000
)}
`
.
padStart
(
2
,
0
);
this
.
setState
({
countdown
:
`
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
});
},
1000
)
}
}
}
// 点击子组件试听按钮
...
...
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