Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
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 51985c71
authored
Mar 10, 2026
by
yancanhua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 小程序描点定位开发
1 parent
1fab3bbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
146 additions
and
5 deletions
aus-front/app/src/module/auction/AuctionVehiclePage.vue
aus-front/app/src/module/auction/AuctionVehiclePage.vue
View file @
51985c7
<
template
>
<page-meta
:page-style=
"'overflow:'+(show?'hidden':'visible')"
></page-meta>
<view
class=
"car-detail-container"
v-if=
"auctionVehicle"
>
<view
class=
"header-anchor"
>
<view
class=
"header-anchor-list"
:class=
"
{ headerActive: currentAnchorId === 'section1' }" @click="scrollToSection('section1')">
车辆档案
<view
v-if=
"currentAnchorId === 'section1'"
class=
"header-anchor-absolute"
></view>
</view>
<view
class=
"header-anchor-list"
:class=
"
{ headerActive: currentAnchorId === 'section2' }" @click="scrollToSection('section2')">
车况描述
<view
v-if=
"currentAnchorId === 'section2'"
class=
"header-anchor-absolute"
></view>
</view>
<view
class=
"header-anchor-list"
:class=
"
{ headerActive: currentAnchorId === 'section3' }" @click="scrollToSection('section3')">
检测报告
<view
v-if=
"currentAnchorId === 'section3'"
class=
"header-anchor-absolute"
></view>
</view>
<view
class=
"header-anchor-list"
:class=
"
{ headerActive: currentAnchorId === 'section4' }" @click="scrollToSection('section4')">
车辆图片
<view
v-if=
"currentAnchorId === 'section4'"
class=
"header-anchor-absolute"
></view>
</view>
<view
class=
"header-anchor-list"
:class=
"
{ headerActive: currentAnchorId === 'section5' }" @click="scrollToSection('section5')">
协议规则
<view
v-if=
"currentAnchorId === 'section5'"
class=
"header-anchor-absolute"
></view>
</view>
</view>
<!-- 页面头部 -->
<!--
<view
class=
"page-header"
>
-->
<!-- <!– 搜索框 –>-->
...
...
@@ -82,6 +105,7 @@
</view>
-->
<!-- 车辆基本参数 -->
<section
id=
"section1"
>
<view
class=
"section-card"
v-if=
"auctionVehicle"
>
<view
class=
"section-title"
>
车辆档案
</view>
<view
class=
"params-row"
>
...
...
@@ -114,17 +138,19 @@
<text
class=
"config-tip"
>
*过户次数、年检到期、交强险到期、钥匙、是否有抵押、电池购买方式均为车主口述
</text>
<van-button
type=
"default"
round
block
@
click=
"navigateTo('/module/auction/AuctionVehicleDetail?aucvehId=' + auctionVehicle?.aucvehId)"
>
查看完整车辆信息
</van-button>
</view>
</section>
<!-- 车况描述 -->
<section
id=
"section2"
>
<view
class=
"section-card"
>
<view
class=
"section-title"
>
车况描述
</view>
<view
class=
"description-content"
>
<text>
{{
vehicle
.
historyCondition
.
conditionDescription
}}
</text>
</view>
</view>
</section>
<
!-- 车辆配置 --
>
<!-- 检测报告 -->
<
section
id=
"section3"
>
<view
class=
"section-card"
>
<view
class=
"section-title"
>
检测报告
</view>
<van-row
:gutter=
"12"
>
...
...
@@ -142,9 +168,10 @@
</van-col>
</van-row>
</view>
</section>
<!-- 车辆图片展示 -->
<section
id=
"section4"
>
<view
class=
"section-card"
>
<view
class=
"section-title"
>
车辆图片
</view>
<view
style=
"margin-bottom: 6px"
v-if=
"albums.length>0"
>
...
...
@@ -161,8 +188,10 @@
<uni-icons
type=
"right"
size=
"14"
color=
"#999"
/>
</view>
</view>
</section>
<!-- 协议规则 -->
<section
id=
"section5"
>
<view
class=
"protocolBox"
>
<view
class=
"protocolBox-title"
>
协议规则
</view>
<view
class=
"protocolBox-content"
>
...
...
@@ -171,8 +200,9 @@
<text
class=
"protocolBox-rule"
@
click=
"navigateToAgreement('VIOLATION')"
>
《违约扣款规则》
</text>
</view>
</view>
</section>
<view
:style=
"
{ height: auctionVehicle.auction.auctionMode == 2 ? '146px' : '60px' }">
</view>
</view>
</view>
<!-- 底部操作栏 -->
<view
class=
"bottom-action-bar"
v-if=
"auctionVehicle.auction.auctionMode != 2"
>
...
...
@@ -338,6 +368,16 @@ export default class AuctionVehiclePage extends Vue {
show
=
false
;
/**
* 当前激活的锚点ID
*/
currentAnchorId
=
'section1'
;
/**
* 各个锚点的位置信息
*/
anchorPositions
:
any
=
{};
/**
* 距开拍剩余时间
*/
bidStartRemaining
=
0
;
...
...
@@ -487,6 +527,7 @@ export default class AuctionVehiclePage extends Vue {
onShow
((
option
)
=>
{
this
.
loadData
();
this
.
loadBidInfo
();
this
.
updateAnchorPositions
();
});
onUnload
(()
=>
{
this
.
stopFetchOrderState
();
...
...
@@ -528,6 +569,26 @@ export default class AuctionVehiclePage extends Vue {
async
onPullDownRefresh
()
{
this
.
loadData
().
finally
(()
=>
uni
.
stopPullDownRefresh
());
this
.
loadBidInfo
();
this
.
updateAnchorPositions
();
}
/**
* 监听页面滚动
*/
@
Hook
(
'onPageScroll'
)
onPageScroll
(
e
:
any
)
{
const
scrollTop
=
e
.
scrollTop
+
47
;
// 加上头部锚点的高度
// 遍历所有锚点位置,找到当前滚动位置对应的锚点
let
currentSection
=
'section1'
;
const
sections
=
[
'section1'
,
'section2'
,
'section3'
,
'section4'
,
'section5'
];
for
(
let
i
=
sections
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
sectionId
=
sections
[
i
];
if
(
this
.
anchorPositions
[
sectionId
]
&&
scrollTop
>=
this
.
anchorPositions
[
sectionId
])
{
currentSection
=
sectionId
;
break
;
}
}
this
.
currentAnchorId
=
currentSection
;
}
loadData
():
Promise
<
void
>
{
...
...
@@ -550,6 +611,12 @@ export default class AuctionVehiclePage extends Vue {
}
}
}
// 数据加载完成后,延迟更新锚点位置,确保 DOM 已渲染
this
.
$nextTick
(()
=>
{
setTimeout
(()
=>
{
this
.
updateAnchorPositions
();
},
300
);
});
return
Promise
.
resolve
();
});
}
...
...
@@ -856,6 +923,43 @@ export default class AuctionVehiclePage extends Vue {
};
}
/**
* 滚动到指定锚点
* @param sectionId 锚点ID
*/
scrollToSection
(
sectionId
:
string
)
{
// 使用 selector 方式滚动,更准确
uni
.
pageScrollTo
({
selector
:
`#
${
sectionId
}
`
,
offset
:
-
47
,
// 偏移量,减去头部锚点的高度
duration
:
300
});
// 延迟更新当前激活的锚点
setTimeout
(()
=>
{
this
.
currentAnchorId
=
sectionId
;
},
300
);
}
/**
* 更新所有锚点的位置信息
*/
updateAnchorPositions
()
{
const
sections
=
[
'section1'
,
'section2'
,
'section3'
,
'section4'
,
'section5'
];
const
query
=
uni
.
createSelectorQuery
();
sections
.
forEach
(
sectionId
=>
{
query
.
select
(
`#
${
sectionId
}
`
).
boundingClientRect
();
});
query
.
exec
((
res
)
=>
{
sections
.
forEach
((
sectionId
,
index
)
=>
{
if
(
res
[
index
])
{
this
.
anchorPositions
[
sectionId
]
=
res
[
index
].
top
;
}
});
});
}
}
</
script
>
...
...
@@ -910,6 +1014,43 @@ export default class AuctionVehiclePage extends Vue {
margin-bottom
:
60px
;
}
.header-anchor
{
position
:
fixed
;
top
:
-1px
;
left
:
0
;
width
:
100%
;
height
:
47px
;
z-index
:
99
;
background
:
#ffffff
;
}
.header-anchor-list
{
width
:
20%
;
height
:
47px
;
line-height
:
47px
;
color
:
#333333
;
font-size
:
14px
;
float
:
left
;
text-align
:
center
;
position
:
relative
;
}
.header-anchor-absolute
{
position
:
absolute
;
left
:
50%
;
transform
:
translateX
(
-50%
);
bottom
:
0
;
width
:
16px
;
height
:
3px
;
border-radius
:
1.5px
;
background
:
#185efe
;
}
.headerActive
{
color
:
#333333
;
font-size
:
16px
;
}
/* 页面头部样式 */
.page-header
{
display
:
flex
;
...
...
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