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
b6418da3
Commit
b6418da3
authored
Nov 13, 2019
by
wangshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返场
parent
fa58a508
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
src/components/blessingPreheat/index.js
+22
-2
No files found.
src/components/blessingPreheat/index.js
View file @
b6418da3
...
...
@@ -148,7 +148,7 @@ class BlessingPreheat extends Component {
// // 这里有获取ID的步骤,由于运营过多的调整,导致顺序不定,所以包含ID的title必须要放到判断中(防止出现多个title),设置定时器是因为如果返回较慢 获取不到ID导致报错
// _this.setInitialNavActiveStatus()
// }, 50);
window
.
addEventListener
(
'scroll'
,
throttle
(
this
.
calcNavActive
,
100
))
//
window.addEventListener('scroll', throttle(this.calcNavActive, 100))
if
(
is_weixin
())
{
wxShare
({
title
:
'AI充电节,积福气享1折秒课,超10万元奖品来就送!!'
,
...
...
@@ -264,6 +264,9 @@ class BlessingPreheat extends Component {
return
findIndex
(
navs
,
item
=>
item
.
id
===
str
)
}
componentWillUnmount
()
{
window
.
removeEventListener
(
'scroll'
,
this
.
calcNavActive
);
}
setInitialNavActiveStatus
=
()
=>
{
const
observer
=
new
MutationObserver
(
debounce
((
list
,
observer
)
=>
{
...
...
@@ -286,12 +289,21 @@ class BlessingPreheat extends Component {
if
(
onlyShow
)
{
this
.
setState
({
navs
:
encoreNavs
},
()
=>
{
this
.
setInitialNavActiveStatus
()
window
.
addEventListener
(
'scroll'
,
throttle
(
this
.
calcNavActive
,
100
))
})
}
else
{
this
.
setState
({
navs
:
formalNavs
},
()
=>
{
this
.
setInitialNavActiveStatus
()
window
.
addEventListener
(
'scroll'
,
throttle
(
this
.
calcNavActive
,
100
))
})
}
}
}
...
...
@@ -325,7 +337,6 @@ class BlessingPreheat extends Component {
inviteBlessing
:
(
data
.
types_total_blessing_value
&&
data
.
types_total_blessing_value
.
invite
)
?
data
.
types_total_blessing_value
.
invite
:
0
,
})
}));
this
.
setInitialNavActiveStatus
()
if
(
data
.
is_login
===
1
)
{
this
.
handleToSign
()
}
...
...
@@ -454,14 +465,23 @@ class BlessingPreheat extends Component {
calcNavActive
=
()
=>
{
const
{
navs
,
index
}
=
this
.
state
const
y
=
window
.
scrollY
let
swipeDirection
=
y
>
this
.
prevY
?
'up'
:
'down'
let
_index
if
(
swipeDirection
===
'up'
)
{
if
(
Number
.
isInteger
(
index
)){
_index
=
(
index
+
1
)
>=
navs
.
length
?
index
:
index
+
1
}
else
{
_index
=
0
}
}
else
{
if
(
Number
.
isInteger
(
index
)){
_index
=
(
index
-
1
)
<=
0
?
0
:
index
-
1
}
else
{
_index
=
0
}
}
let
el
=
document
.
querySelector
(
`#
${
navs
[
_index
].
id
}
`
)
let
nav
=
document
.
querySelector
(
'#main-nav'
)
...
...
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