Commit 7a14b572 by yancanhua

fix: 车辆详情自定义跳转

1 parent a230e8ff
<template>
<page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
<customNav :status-bar-height="statusBarHeight"></customNav>
<view class="page" :style="{ paddingTop: statusBarHeight + 44 + 'px' }" >
<view class="car-detail-container" v-if="auctionVehicle">
<view v-if="currentAnchorId && currentAnchorId != 'section0'" class="header-anchor">
<view v-if="currentAnchorId && currentAnchorId != 'section0'" class="header-anchor" :style="{ top: statusBarHeight + 44 + 'px' }" >
<view class="header-anchor-list" :class="{ headerActive: currentAnchorId === 'section1' }" @click="scrollToSection('section1')">
车辆档案
<view v-if="currentAnchorId === 'section1'" class="header-anchor-absolute"></view>
......@@ -327,6 +329,7 @@
<bid-success-dialog :order-id="orderId" ref="bidSuccessDialogRef" :auctionVehicle="auctionVehicle" @close="closeBidSuccessDialog"></bid-success-dialog>
</van-dialog>
</view>
</view>
</template>
<script lang="ts">
import {Component, Hook, Ref, Vue} from "vue-facing-decorator";
......@@ -351,11 +354,16 @@ import {DepositController} from "@/api/DepositController";
import roundBidBottom from "@/module/auction/roundBidBottom.vue";
import RoundBidPopup from "@/components/RoundBidPopup.vue";
import customNav from "@/module/auction/customNav.vue";
@Component({
components: {BidSuccessDialog, roundBidBottom, RoundBidPopup}
components: {BidSuccessDialog, roundBidBottom, RoundBidPopup, customNav}
})
export default class AuctionVehiclePage extends Vue {
statusBarHeight = 0;// 用于接收头部总高度,设置内容区 padding
amountStyle = {'font-size': '20px'};
@Ref()
......@@ -527,6 +535,7 @@ export default class AuctionVehiclePage extends Vue {
const that = this;
onLoad((option) => {
this.aucvehId = option.aucvehId;
this.statusBarHeight = uni.getWindowInfo().statusBarHeight;
this.loadBidPriceRange();
FavoriteController.getFavoriteCountByAucvehId(this.axios, this.aucvehId).then(res => {
this.favoriteCount = res.data;
......@@ -946,7 +955,7 @@ export default class AuctionVehiclePage extends Vue {
// 使用 selector 方式滚动,更准确
uni.pageScrollTo({
selector: `#${sectionId}`,
offsetTop: -40, // 偏移量,减去头部锚点的高度
offsetTop: -88, // 偏移量,减去头部锚点的高度
duration: 300
});
// 延迟更新当前激活的锚点
......@@ -979,6 +988,11 @@ export default class AuctionVehiclePage extends Vue {
</script>
<style lang="scss" scoped>
.page {
width: 100vw;
height: 100vh;
position: relative;
}
.protocolBox {
width: -webkit-calc(100% - 20px);
......
<template>
<view class="custom-nav" :style="{ height: statusBarHeight + 'px' }">
<view :style="{ height: statusBarHeight + 'px' }"></view>
<view class="nav-content">
<view class="nav-left" @click="onBack">
<uni-icons type="left" size="24" color="#333" />
</view>
<view class="nav-title">车辆详情</view>
</view>
</view>
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'vue-facing-decorator';
@Component({})
export default class customNav extends Vue {
// 状态栏高度(微信小程序中由系统提供)
@Prop({ type: Number, required: false, default: 48 })
statusBarHeight: number;
onBack() {
if (this.getPreviousPageOptions() == 'module/auction/AuctionVehiclePage') {
uni.switchTab({ url: '/pages/tabbar/AuctionPage' });
} else {
uni.navigateBack();
}
}
//获取上一个页面传递的参数
getPreviousPageOptions(): any {
const pages = getCurrentPages();
const previousPage = pages[pages.length - 2];
return previousPage?.route || '';
}
}
</script>
<style scoped lang="scss">
.custom-nav {
width: 100%;
position: fixed;
top: -1px;
left: 0;
z-index: 999; // 确保在页面内容上方
background: #ffffff;
}
.nav-content {
display: flex;
align-items: center;
justify-content: center;
position: relative;
height: 44px;
background: #ffffff;
}
.nav-left {
position: absolute;
left: 2px;
width: 80rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.back-icon {
font-size: 36rpx;
color: #333;
}
.nav-title {
font-size: 32rpx;
color: #333;
font-weight: 400;
}
.nav-right {
position: absolute;
right: 16rpx;
height: 100%;
display: flex;
align-items: center;
}
</style>
......@@ -72,8 +72,8 @@
{
"path": "AuctionVehiclePage",
"style": {
"navigationBarTitleText": "车辆详情",
"enablePullDownRefresh": true
"disableScroll": true,
"navigationStyle": "custom"
}
},
{
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!