Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bfb222d4
authored
Oct 27, 2022
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'zq_dev_3.0' into 'v3.0'
修改tab抖动问题 See merge request
!85
2 parents
34b2ccbb
76171047
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
15 deletions
pages/tab/discovery/components/product/product.js
pages/tab/discovery/components/product/product.json
pages/tab/discovery/components/product/product.scss
pages/tab/discovery/components/product/product.wxml
pages/tab/discovery/components/product/product.js
View file @
bfb222d
...
@@ -21,9 +21,9 @@ Component({
...
@@ -21,9 +21,9 @@ Component({
tab
:[
'适用场景'
,
'营销链路'
,
'项目亮点'
,
'转化漏斗'
,
'合作流程'
,
'合作案例'
],
tab
:[
'适用场景'
,
'营销链路'
,
'项目亮点'
,
'转化漏斗'
,
'合作流程'
,
'合作案例'
],
heightArr
:[],
heightArr
:[],
curTabIdx
:
0
,
//适用产品
curTabIdx
:
0
,
//适用产品
intoViewId
:
'to-0'
,
actNum
:
0
,
//场景
actNum
:
0
,
//场景
showAuth
:
false
showAuth
:
false
,
throttle
:
false
},
},
lifetimes
:{
lifetimes
:{
ready
:
function
(){
ready
:
function
(){
...
@@ -40,7 +40,7 @@ Component({
...
@@ -40,7 +40,7 @@ Component({
return
pre
+
cur
.
height
return
pre
+
cur
.
height
},
heightTop
)
},
heightTop
)
let
idx
=
imgHeightArr
.
findIndex
(
item
=>
item
>
e
.
scrollTop
)
let
idx
=
imgHeightArr
.
findIndex
(
item
=>
item
>
e
.
scrollTop
)
if
(
idx
>-
1
){
if
(
idx
>-
1
&&
!
this
.
data
.
throttle
){
this
.
setData
({
this
.
setData
({
curTabIdx
:
idx
curTabIdx
:
idx
})
})
...
@@ -79,7 +79,7 @@ Component({
...
@@ -79,7 +79,7 @@ Component({
}
}
this
.
setData
({
this
.
setData
({
navList
,
navList
,
intoViewId
:
`to-0`
,
curTabIdx
:
0
,
activeNavIdx
:
this
.
data
.
isShare
?
this
.
data
.
navIdx
:
0
,
activeNavIdx
:
this
.
data
.
isShare
?
this
.
data
.
navIdx
:
0
,
tab
tab
})
})
...
@@ -89,10 +89,11 @@ Component({
...
@@ -89,10 +89,11 @@ Component({
methods
:
{
methods
:
{
async
changeTab
(
e
){
async
changeTab
(
e
){
let
idx
=
e
.
detail
let
{
idx
}
=
e
.
currentTarget
.
dataset
this
.
setData
({
this
.
setData
({
intoViewId
:
`to-
${
idx
}
`
curTabIdx
:
idx
})
})
this
.
data
.
throttle
=
true
let
heightTop
=
this
.
data
.
headerHeight
+
90
-
16
-
46
// 90 场景高度,16 可能是误差 , 46 tab高度
let
heightTop
=
this
.
data
.
headerHeight
+
90
-
16
-
46
// 90 场景高度,16 可能是误差 , 46 tab高度
let
prodArr
=
await
this
.
getHeight
(
'.prod-wrap'
)
let
prodArr
=
await
this
.
getHeight
(
'.prod-wrap'
)
heightTop
+=
prodArr
[
0
].
height
heightTop
+=
prodArr
[
0
].
height
...
@@ -104,6 +105,9 @@ Component({
...
@@ -104,6 +105,9 @@ Component({
scrollTop
:
heightTop
,
scrollTop
:
heightTop
,
duration
:
0
duration
:
0
})
})
setTimeout
(()
=>
{
this
.
data
.
throttle
=
false
},
500
)
},
},
getHeight
(
cla
){
getHeight
(
cla
){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -119,12 +123,6 @@ Component({
...
@@ -119,12 +123,6 @@ Component({
activeNavIdx
:
event
.
target
.
dataset
.
index
activeNavIdx
:
event
.
target
.
dataset
.
index
})
})
},
},
scrolltoupper
(
event
){
const
idx
=
this
.
data
.
heightArr
.
findIndex
(
item
=>
item
>
event
.
detail
.
scrollTop
)
this
.
setData
({
curTabIdx
:
idx
})
},
downVideo
(
e
)
{
downVideo
(
e
)
{
let
{
url
}
=
e
.
target
.
dataset
let
{
url
}
=
e
.
target
.
dataset
this
.
setData
({
this
.
setData
({
...
...
pages/tab/discovery/components/product/product.json
View file @
bfb222d
{
{
"component"
:
true
,
"component"
:
true
,
"usingComponents"
:
{
"usingComponents"
:
{
"tab"
:
"../../../../../components/Tab/Tab"
}
}
}
}
\ No newline at end of file
\ No newline at end of file
pages/tab/discovery/components/product/product.scss
View file @
bfb222d
...
@@ -332,4 +332,55 @@
...
@@ -332,4 +332,55 @@
font-size
:
28rpx
;
font-size
:
28rpx
;
color
:
rgba
(
255
,
255
,
255
,.
6
);
color
:
rgba
(
255
,
255
,
255
,.
6
);
padding
:
16rpx
0
92rpx
;
padding
:
16rpx
0
92rpx
;
}
.tab-box
{
display
:
flex
;
width
:
100%
;
height
:
46px
;
box-sizing
:
border-box
;
border-bottom
:
1rpx
solid
#EAEBEF
;
.tab
{
position
:
relative
;
flex-shrink
:
0
;
.text
{
height
:
84rpx
;
display
:
flex
;
align-items
:
center
;
box-sizing
:
border-box
;
color
:
#8A8C90
;
justify-content
:
center
;
margin
:
0
24rpx
;
font-weight
:
400
;
font-size
:
28rpx
;
font-family
:
PingFangSC-Medium
;
}
.line
{
width
:
48rpx
;
height
:
var
(
--
borderRadius
);
background
:
var
(
--
btnColor
);
border-radius
:
8rpx
8rpx
0
0
;
margin
:
0
auto
;
transform
:
scale
(
0
);
transition
:
all
.25s
;
}
}
.active
{
.text
{
font-weight
:
500
;
font-size
:
28rpx
;
transition
:
all
.25s
;
color
:
var
(
--
btnColor
);
}
.line
{
transform
:
scale
(
1
);
}
}
}
.
tab-box
:
:-
webkit-scrollbar
{
display
:
none
;
width
:
0
;
height
:
0
;
color
:
transparent
;
}
}
\ No newline at end of file
\ No newline at end of file
pages/tab/discovery/components/product/product.wxml
View file @
bfb222d
...
@@ -29,9 +29,17 @@
...
@@ -29,9 +29,17 @@
</view>
</view>
<view class="project-wrap">
<view class="project-wrap">
<view style="position: sticky;top: {{headerHeight}}px ;z-index: 2;background-color: #F5F7FB;">
<view style="position: sticky;top: {{headerHeight}}px ;z-index: 2;background-color: #F5F7FB;">
<tab openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab>
<!-- <tab openScroll="{{true}}" tab="{{tab}}" index="{{curTabIdx}}" bindclick="changeTab"></tab> -->
<scroll-view enhanced="{{true}}" show-scrollbar="{{false}}" scroll-left="{{curTabIdx*46}}" class="tab-box" scroll-x enable-flex scroll-with-animation >
<block wx:for="{{tab}}" wx:key="index">
<view class="tab {{index==curTabIdx?'active':''}}" bindtap="changeTab" data-idx="{{index}}">
<view class="text" >{{item}}</view>
<view class="line"></view>
</view>
</block>
</scroll-view>
</view>
</view>
<scroll-view class="project-img" scroll-
into-view="{{intoViewId}}" bindscroll="scrolltoupper" scroll-
y="{{true}}">
<scroll-view class="project-img" scroll-y="{{true}}">
<block wx:for="{{tab}}" wx:key="index">
<block wx:for="{{tab}}" wx:key="index">
<view id="to-{{index}}" class="img-item img-item{{actNum+1}}{{index+1}}">
<view id="to-{{index}}" class="img-item img-item{{actNum+1}}{{index+1}}">
<image class="img-item{{actNum+1}}{{index+1}}" src="{{IMGURL}}/scene/scene{{actNum+1}}{{index+1}}.png" />
<image class="img-item{{actNum+1}}{{index+1}}" src="{{IMGURL}}/scene/scene{{actNum+1}}{{index+1}}.png" />
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment