Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
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 718e843d
authored
Apr 02, 2026
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix(venus-usedcar-quality): 页面滚动问题
1 parent
6f9f2550
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
20 deletions
apps/web/venus-usedcar-quality/src/router/index.ts
apps/web/venus-usedcar-quality/src/views/inspect-detail/index.vue
apps/web/venus-usedcar-quality/src/views/inspect-report/index.vue
apps/web/venus-usedcar-quality/src/router/index.ts
View file @
718e843
...
@@ -22,7 +22,7 @@ const router = createRouter({
...
@@ -22,7 +22,7 @@ const router = createRouter({
});
});
// 不需要登录的白名单路由
// 不需要登录的白名单路由
const
WHITE_LIST
=
new
Set
([
"/inspect-detail"
,
"/inspect-report"
,
"/login"
]);
const
WHITE_LIST
=
new
Set
([
"/inspect-report"
,
"/login"
]);
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
const
userStore
=
useUserStore
();
const
userStore
=
useUserStore
();
...
...
apps/web/venus-usedcar-quality/src/views/inspect-detail/index.vue
View file @
718e843
...
@@ -10,25 +10,25 @@ import { useRoute } from "vue-router";
...
@@ -10,25 +10,25 @@ import { useRoute } from "vue-router";
import
{
detail
}
from
"@api/modules/inspect-report"
;
import
{
detail
}
from
"@api/modules/inspect-report"
;
interface
InspectItem
{
interface
InspectItem
{
name
:
string
;
status
:
"abnormal"
|
"normal"
;
descriptions
:
string
[];
descriptions
:
string
[];
images
:
string
[];
images
:
string
[];
name
:
string
;
status
:
"abnormal"
|
"normal"
;
videos
:
string
[];
videos
:
string
[];
}
}
interface
InspectCategory
{
interface
InspectCategory
{
items
:
InspectItem
[];
name
:
string
;
name
:
string
;
totalCount
:
number
;
totalCount
:
number
;
items
:
InspectItem
[];
}
}
interface
DisplayGroup
{
interface
DisplayGroup
{
type
:
"abnormal"
|
"normal"
;
label
:
string
;
icon
:
string
;
icon
:
string
;
iconColor
:
string
;
iconColor
:
string
;
items
:
InspectItem
[];
items
:
InspectItem
[];
label
:
string
;
type
:
"abnormal"
|
"normal"
;
}
}
const
MAX_VISIBLE
=
5
;
const
MAX_VISIBLE
=
5
;
...
@@ -228,8 +228,17 @@ async function fetchDetail() {
...
@@ -228,8 +228,17 @@ async function fetchDetail() {
}
}
}
}
const
scrollRootRef
=
ref
<
HTMLElement
|
null
>
(
null
);
const
stickyRef
=
ref
<
HTMLElement
|
null
>
(
null
);
const
stickyRef
=
ref
<
HTMLElement
|
null
>
(
null
);
const
sectionRefs
=
ref
<
HTMLElement
[]
>
([]);
const
sectionRefs
=
ref
<
HTMLElement
[]
>
([]);
function
sectionOffsetTop
(
sectionEl
:
HTMLElement
,
scrollEl
:
HTMLElement
):
number
{
return
(
sectionEl
.
getBoundingClientRect
().
top
-
scrollEl
.
getBoundingClientRect
().
top
+
scrollEl
.
scrollTop
);
}
// 是否处于程序化滚动中,锁定期间不更新 activeTab
// 是否处于程序化滚动中,锁定期间不更新 activeTab
let
scrollLocked
=
false
;
let
scrollLocked
=
false
;
// 用于检测滚动停止的定时器
// 用于检测滚动停止的定时器
...
@@ -246,23 +255,27 @@ function getStickyHeight() {
...
@@ -246,23 +255,27 @@ function getStickyHeight() {
function
onClickTab
({
name
}:
{
name
:
number
|
string
})
{
function
onClickTab
({
name
}:
{
name
:
number
|
string
})
{
const
index
=
Number
(
name
);
const
index
=
Number
(
name
);
const
el
=
sectionRefs
.
value
[
index
];
const
el
=
sectionRefs
.
value
[
index
];
if
(
!
el
)
return
;
const
scrollEl
=
scrollRootRef
.
value
;
if
(
!
el
||
!
scrollEl
)
return
;
scrollLocked
=
true
;
scrollLocked
=
true
;
activeTab
.
value
=
index
;
activeTab
.
value
=
index
;
window
.
scrollTo
({
const
top
=
sectionOffsetTop
(
el
,
scrollEl
)
-
getStickyHeight
();
top
:
el
.
offsetTop
-
getStickyHeight
(),
scrollEl
.
scrollTo
({
top
:
Math
.
max
(
0
,
top
),
behavior
:
"smooth"
,
behavior
:
"smooth"
,
});
});
}
}
function
handleScroll
()
{
function
handleScroll
()
{
const
threshold
=
window
.
scrollY
+
getStickyHeight
()
+
1
;
const
scrollEl
=
scrollRootRef
.
value
;
if
(
!
scrollEl
)
return
;
const
threshold
=
scrollEl
.
scrollTop
+
getStickyHeight
()
+
1
;
let
active
=
0
;
let
active
=
0
;
for
(
let
i
=
sectionRefs
.
value
.
length
-
1
;
i
>=
0
;
i
--
)
{
for
(
let
i
=
sectionRefs
.
value
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
el
=
sectionRefs
.
value
[
i
];
const
el
=
sectionRefs
.
value
[
i
];
if
(
el
&&
el
.
offsetTop
<=
threshold
)
{
if
(
el
&&
sectionOffsetTop
(
el
,
scrollEl
)
<=
threshold
)
{
active
=
i
;
active
=
i
;
break
;
break
;
}
}
...
@@ -288,12 +301,12 @@ function onScroll() {
...
@@ -288,12 +301,12 @@ function onScroll() {
}
}
onMounted
(()
=>
{
onMounted
(()
=>
{
fetchDetail
();
void
fetchDetail
();
window
.
addEventListener
(
"scroll"
,
onScroll
,
{
passive
:
true
});
scrollRootRef
.
value
?
.
addEventListener
(
"scroll"
,
onScroll
,
{
passive
:
true
});
});
});
onUnmounted
(()
=>
{
onUnmounted
(()
=>
{
window
.
removeEventListener
(
"scroll"
,
onScroll
);
scrollRootRef
.
value
?
.
removeEventListener
(
"scroll"
,
onScroll
);
cancelAnimationFrame
(
rafId
);
cancelAnimationFrame
(
rafId
);
if
(
scrollEndTimer
)
clearTimeout
(
scrollEndTimer
);
if
(
scrollEndTimer
)
clearTimeout
(
scrollEndTimer
);
});
});
...
@@ -301,6 +314,7 @@ onUnmounted(() => {
...
@@ -301,6 +314,7 @@ onUnmounted(() => {
<
template
>
<
template
>
<div
class=
"inspect-detail-page"
>
<div
class=
"inspect-detail-page"
>
<div
ref=
"scrollRootRef"
class=
"inspect-detail-scroll"
>
<div
ref=
"stickyRef"
class=
"sticky-header"
>
<div
ref=
"stickyRef"
class=
"sticky-header"
>
<van-tabs
v-model:active=
"activeTab"
@
click-tab=
"onClickTab"
>
<van-tabs
v-model:active=
"activeTab"
@
click-tab=
"onClickTab"
>
<van-tab
v-for=
"cat in displayCategories"
<van-tab
v-for=
"cat in displayCategories"
...
@@ -410,17 +424,32 @@ onUnmounted(() => {
...
@@ -410,17 +424,32 @@ onUnmounted(() => {
:start-position=
"previewIndex"
:start-position=
"previewIndex"
teleport=
"#vant-portal-host"
/>
teleport=
"#vant-portal-host"
/>
</div>
</div>
</div>
</template>
</template>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@use
"@assets/styles/variables"
as
*
;
@use
"@assets/styles/variables"
as
*
;
.inspect-detail-page
{
.inspect-detail-page
{
min-height
:
100vh
;
display
:
flex
;
padding-bottom
:
calc
(
40vh
+
env
(
safe-area-inset-bottom
));
flex-direction
:
column
;
width
:
100%
;
min-width
:
0
;
height
:
100vh
;
height
:
100
dvh
;
overflow
:
hidden
;
background
:
#f2f3f7
;
background
:
#f2f3f7
;
}
}
.inspect-detail-scroll
{
box-sizing
:
border-box
;
flex
:
1
;
min-height
:
0
;
padding-bottom
:
calc
(
40vh
+
env
(
safe-area-inset-bottom
));
overflow
:
hidden
auto
;
-webkit-overflow-scrolling
:
touch
;
}
.sticky-header
{
.sticky-header
{
position
:
sticky
;
position
:
sticky
;
top
:
0
;
top
:
0
;
...
...
apps/web/venus-usedcar-quality/src/views/inspect-report/index.vue
View file @
718e843
...
@@ -113,7 +113,7 @@ async function fetchDetail() {
...
@@ -113,7 +113,7 @@ async function fetchDetail() {
const
res
=
await
detail
(
recordId
);
const
res
=
await
detail
(
recordId
);
// 车辆基础信息
// 车辆基础信息
reportData
.
value
.
carName
=
(
res
.
carSeriesName
??
""
)
+
(
res
.
carTypeName
??
""
)
;
reportData
.
value
.
carName
=
`
${
res
.
carSeriesName
??
""
}
$
{
res
.
carTypeName
??
""
}
`
;
reportData.value.licensePlate = res.licensePlate ?? "";
reportData.value.licensePlate = res.licensePlate ?? "";
reportData.value.coverUrl = res.cover?.url ?? "";
reportData.value.coverUrl = res.cover?.url ?? "";
reportData.value.albums = res.albums ?? [];
reportData.value.albums = res.albums ?? [];
...
@@ -366,6 +366,8 @@ onMounted(() => {
...
@@ -366,6 +366,8 @@ onMounted(() => {
<
template
>
<
template
>
<div
class=
"report-page"
>
<div
class=
"report-page"
>
<!-- 与 car-detail 一致:视口内独立滚动层,避免 iOS/WebView 下整页文档滚动失效 -->
<div
class=
"report-scroll"
>
<!-- 顶部认证头 -->
<!-- 顶部认证头 -->
<div
class=
"cert-header"
:style=
"
{ backgroundImage: `url(${CDN.bg})` }">
<div
class=
"cert-header"
:style=
"
{ backgroundImage: `url(${CDN.bg})` }">
<div
class=
"cert-header__left"
>
<div
class=
"cert-header__left"
>
...
@@ -691,17 +693,32 @@ onMounted(() => {
...
@@ -691,17 +693,32 @@ onMounted(() => {
</div>
</div>
</Teleport>
</Teleport>
</div>
</div>
</div>
</template>
</template>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@use
"@assets/styles/variables"
as
*
;
@use
"@assets/styles/variables"
as
*
;
.report-page
{
.report-page
{
min-height
:
100vh
;
display
:
flex
;
padding-bottom
:
calc
(
20px
+
env
(
safe-area-inset-bottom
));
flex-direction
:
column
;
width
:
100%
;
min-width
:
0
;
height
:
100vh
;
height
:
100
dvh
;
overflow
:
hidden
;
background
:
#f2f3f7
;
background
:
#f2f3f7
;
}
}
.report-scroll
{
box-sizing
:
border-box
;
flex
:
1
;
min-height
:
0
;
padding-bottom
:
calc
(
20px
+
env
(
safe-area-inset-bottom
));
overflow
:
hidden
auto
;
-webkit-overflow-scrolling
:
touch
;
}
.report-share
{
.report-share
{
padding
:
$
spacing-base
$
spacing-md
0
;
padding
:
$
spacing-base
$
spacing-md
0
;
}
}
...
@@ -1297,6 +1314,8 @@ onMounted(() => {
...
@@ -1297,6 +1314,8 @@ onMounted(() => {
.video-swipe
{
.video-swipe
{
overflow
:
hidden
;
overflow
:
hidden
;
//
允许纵向页面滚动:避免移动端手势从轮播区域起步时被当成「禁用的平移」而滚不动
touch-action
:
pan-y
;
border-radius
:
$
radius-base
;
border-radius
:
$
radius-base
;
//
指示器置于轮播区域正中(默认在底部)
//
指示器置于轮播区域正中(默认在底部)
...
@@ -1324,7 +1343,9 @@ onMounted(() => {
...
@@ -1324,7 +1343,9 @@ onMounted(() => {
&--slide
{
&--slide
{
height
:
190px
;
height
:
190px
;
touch-action
:
manipulation
;
//
`manipulation`
会禁用双指缩放等能力;在部分
WebView/浏览器组合下也会影响纵向滑动命中
//
这里保留点击/轻触优化,同时明确允许纵向滚动与双击缩放(如需也可改为
`auto`)
touch-action
:
pan-y
pinch-zoom
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
...
...
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