首页/我的

This commit is contained in:
kk
2026-04-29 16:51:52 +08:00
parent cabaa14dd0
commit 8a4cba7769
6 changed files with 587 additions and 160 deletions
@@ -0,0 +1,69 @@
<template>
<view class="float-menu-card">
<view
v-for="(item, index) in list"
:key="index"
class="menu-item"
:class="{ 'last-item': index === list.length - 1 }"
@click="handleItemClick(item, index)"
>
<text class="menu-text">{{ item.title }}</text>
<text class="arrow">></text>
</view>
</view>
</template>
<script>
export default {
name: 'FloatMenuCard',
props: {
list: {
type: Array,
default: () => []
}
},
methods: {
handleItemClick(item, index) {
// 发出事件,让父组件处理跳转逻辑
this.$emit('item-click', { item, index });
}
}
}
</script>
<style scoped>
.float-menu-card {
position: fixed;
bottom: 40rpx;
left: 28rpx;
right: 28rpx;
background: #fff;
border-radius: 16rpx;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.1);
overflow: hidden;
z-index: 100;
}
.menu-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 28rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.menu-item:last-child,
.menu-item.last-item {
border-bottom: none;
}
.menu-text {
font-size: 30rpx;
color: #333;
}
.arrow {
font-size: 28rpx;
color: #ccc;
}
</style>
+66
View File
@@ -0,0 +1,66 @@
<template>
<view class="page-nav-bar">
<view class="nav-btn left" @click="handlePrev">
<text class="arrow-icon"></text>
</view>
<view class="nav-btn right" @click="handleNext">
<text class="arrow-icon"></text>
</view>
</view>
</template>
<script>
export default {
name: 'PageNavBar',
props: {
hasPrev: { type: Boolean, default: true },
hasNext: { type: Boolean, default: true }
},
methods: {
handlePrev() {
if (!this.hasPrev) return;
this.$emit('prev');
},
handleNext() {
if (!this.hasNext) return;
this.$emit('next');
}
}
}
</script>
<style scoped>
.page-nav-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 110rpx;
background: #fff;
box-shadow: 0 -2rpx 16rpx rgba(0, 0, 0, 0.06);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 160rpx;
z-index: 100;
}
.nav-btn {
display: flex;
align-items: center;
justify-content: center;
width: 80rpx;
height: 80rpx;
}
.arrow-icon {
font-size: 72rpx;
color: #333;
font-weight: 300;
line-height: 1;
}
.nav-btn.right .arrow-icon {
color: #ccc;
}
</style>
+115
View File
@@ -0,0 +1,115 @@
<template>
<view class="page-nav">
<!-- 首页按钮 -->
<view class="nav-item" @click="handleNav('home')">
<text class="nav-icon">🏠</text>
<text class="nav-text">首页</text>
</view>
<!-- 开门按钮 - 圆形凸起 -->
<view class="door-btn-wrapper" @click="handleOpenDoor">
<view class="door-btn">开门</view>
</view>
<!-- 我的按钮 -->
<view class="nav-item" @click="handleNav('mine')">
<text class="nav-icon">👤</text>
<text class="nav-text">我的</text>
</view>
</view>
</template>
<script>
export default {
name: 'PageNav',
props: {
// 当前高亮的tab: 'home' | 'mine'
activeTab: {
type: String,
default: 'home'
}
},
methods: {
handleNav(tab) {
// 发出事件,由父组件处理导航
this.$emit('change', tab);
},
handleOpenDoor() {
uni.showModal({
title: '开门',
content: '确认打开柜门?',
success: (res) => {
if (res.confirm) {
uni.showToast({ title: '柜门已打开', icon: 'success' });
}
}
});
this.$emit('openDoor');
}
}
}
</script>
<style scoped>
.page-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 120rpx;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-around;
box-shadow: 0 -2rpx 16rpx rgba(0, 0, 0, 0.08);
z-index: 999;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
}
.nav-icon {
font-size: 40rpx;
margin-bottom: 4rpx;
}
.nav-text {
font-size: 24rpx;
color: #999;
}
.nav-item:active .nav-text,
.nav-item.active .nav-text {
color: #2979ff;
}
.door-btn-wrapper {
position: relative;
display: flex;
align-items: center;
justify-content: center;
margin-top: -80rpx;
}
.door-btn {
width: 160rpx;
height: 160rpx;
border-radius: 50%;
background: linear-gradient(135deg, #2979ff, #1e60e0);
color: #fff;
font-size: 38rpx;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 10rpx 36rpx rgba(41, 121, 255, 0.55);
}
</style>