Files
shoot-miniprograms/src/components/AppFooter.vue

78 lines
1.4 KiB
Vue
Raw Normal View History

2025-04-10 11:11:46 +08:00
<script setup>
2025-05-30 16:14:17 +08:00
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
2025-06-15 15:53:57 +08:00
const props = defineProps({
signin: {
type: Function,
default: () => {},
},
});
2025-05-01 16:17:51 +08:00
const tabs = [
2025-05-27 12:38:39 +08:00
{ image: "../static/tab-vip.png" },
{ image: "../static/tab-grow.png" },
{ image: "../static/tab-mall.png" },
2025-05-01 16:17:51 +08:00
];
2025-05-27 12:38:39 +08:00
function handleTabClick(index) {
2025-06-15 15:53:57 +08:00
if (!user.value.id) return props.signin();
2025-06-19 01:55:40 +08:00
if (index === 0) {
uni.navigateTo({
url: "/pages/be-vip",
});
}
2025-05-27 12:38:39 +08:00
if (index === 1) {
uni.navigateTo({
url: "/pages/my-growth",
});
}
2025-04-10 11:11:46 +08:00
}
</script>
<template>
2025-05-01 16:17:51 +08:00
<view class="footer">
<image class="footer-bg" src="../static/tab-bg.png" mode="widthFix" />
<view
v-for="(tab, index) in tabs"
2025-05-27 12:38:39 +08:00
:key="index"
2025-05-01 16:17:51 +08:00
class="tab-item"
2025-05-27 12:38:39 +08:00
@click="handleTabClick(index)"
2025-05-01 16:17:51 +08:00
>
<image
:src="tab.image"
:style="{
width: index === 1 ? '100px' : '40px',
transform: index === 1 ? '' : 'translateY(10px)',
}"
mode="widthFix"
/>
</view>
2025-04-10 11:11:46 +08:00
</view>
</template>
2025-05-01 16:17:51 +08:00
<style scoped>
.footer {
height: 90px;
width: 100%;
position: relative;
display: flex;
justify-content: space-around;
align-items: center;
}
.footer-bg {
width: 100%;
height: 100%;
2025-04-10 11:11:46 +08:00
position: absolute;
2025-05-01 16:17:51 +08:00
z-index: 0;
transform: translateX(5px);
2025-04-10 11:11:46 +08:00
}
2025-05-01 16:17:51 +08:00
.tab-item {
z-index: 1;
2025-04-10 11:11:46 +08:00
}
</style>