feat:登录注册完成

This commit is contained in:
李伊帆
2026-10-09 14:29:58 +08:00
parent da83a58948
commit ee3ecc00eb
106 changed files with 4937 additions and 59 deletions

View File

@@ -0,0 +1,129 @@
<template>
<view class="app-tab-bar" :style="{ paddingBottom: safeBottom + 'px' }">
<view
class="app-tab-bar__item"
:class="{ 'app-tab-bar__item--active': activeTab === 'device' }"
@tap="switchTo('device')"
>
<view class="app-tab-bar__icon-box">
<image
class="app-tab-bar__icon"
:src="activeTab === 'device' ? staticAssets.tabDeviceActive : staticAssets.tabDevice"
mode="aspectFit"
/>
</view>
<text class="app-tab-bar__text">设备</text>
</view>
<view
class="app-tab-bar__item"
:class="{ 'app-tab-bar__item--active': activeTab === 'mine' }"
@tap="switchTo('mine')"
>
<view class="app-tab-bar__icon-box">
<image
class="app-tab-bar__icon"
:src="activeTab === 'mine' ? staticAssets.tabMineActive : staticAssets.tabMine"
mode="aspectFit"
/>
</view>
<text class="app-tab-bar__text">我的</text>
</view>
</view>
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import { staticAssets } from '@/utils/static-assets'
export type TabKey = 'device' | 'mine'
const props = defineProps<{
current: TabKey
}>()
const safeBottom = uni.getSystemInfoSync().safeAreaInsets?.bottom ?? 0
const routes: Record<TabKey, string> = {
device: '/pages/device/index',
mine: '/pages/mine/index',
}
function resolveTabFromRoute(): TabKey {
const route = getCurrentPages().at(-1)?.route ?? ''
return route.includes('mine') ? 'mine' : 'device'
}
const activeTab = ref<TabKey>(props.current)
watch(
() => props.current,
(value) => {
activeTab.value = value
},
{ immediate: true },
)
onMounted(() => {
activeTab.value = resolveTabFromRoute()
})
function switchTo(key: TabKey) {
if (activeTab.value === key) return
activeTab.value = key
uni.reLaunch({ url: routes[key] })
}
</script>
<style lang="scss" scoped>
.app-tab-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
display: flex;
align-items: flex-start;
justify-content: space-around;
min-height: 100rpx;
padding-top: 10rpx;
background: #ffffff;
border-top: 1rpx solid #eeeeee;
box-sizing: border-box;
}
.app-tab-bar__item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8rpx;
min-height: 96rpx;
}
.app-tab-bar__icon-box {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
}
.app-tab-bar__icon {
width: 48rpx;
height: 48rpx;
}
/* 设备 / 我的:未选中、选中文字样式完全一致 */
.app-tab-bar__text {
font-size: 22rpx;
font-weight: 400;
color: #999999;
line-height: 1.2;
}
.app-tab-bar__item--active .app-tab-bar__text {
color: #333333;
font-weight: 500;
}
</style>