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

123 lines
2.4 KiB
Vue
Raw Normal View History

2025-04-10 11:11:46 +08:00
<script setup>
2026-01-12 16:21:32 +08:00
import { ref } from "vue";
2025-05-01 16:17:51 +08:00
2026-01-13 11:35:36 +08:00
import useStore from "@/store";
import { storeToRefs } from "pinia";
const { user } = storeToRefs(useStore());
2026-01-12 16:21:32 +08:00
const props = defineProps({
selected: {
type: Number,
default: 0,
},
2026-01-13 11:35:36 +08:00
onSignin: {
type: Function,
default: () => {},
},
2026-01-12 16:21:32 +08:00
onChange: {
type: Function,
default: () => {},
},
});
const isIOS = uni.getDeviceInfo().osName === "ios";
const tabs = {
2026-01-13 15:46:40 +08:00
VIP: "vip",
2026-01-12 16:21:32 +08:00
智能弓: "mall",
计分本: "tab-point-book",
勋章: "medal",
个人中心: "user",
};
const onTabChange = (index) => {
2026-01-13 15:46:40 +08:00
if (index === 0) {
return uni.navigateTo({
url: "/pages/be-vip",
});
}
2026-01-12 16:21:32 +08:00
if (index === 1) {
return uni.navigateTo({
url: "/pages/device-intro",
2025-06-19 01:55:40 +08:00
});
}
2026-01-12 16:21:32 +08:00
if (index === 2) {
return uni.navigateTo({
2025-09-24 21:05:06 +08:00
url: "/pages/point-book",
2025-05-27 12:38:39 +08:00
});
}
2026-01-12 16:21:32 +08:00
if (index === 4) {
2026-01-13 11:35:36 +08:00
if (!user.value.id) {
props.onSignin();
return;
}
2026-01-12 16:21:32 +08:00
return uni.navigateTo({
url: "/pages/user",
2025-06-19 21:03:33 +08:00
});
}
2026-01-12 16:21:32 +08:00
// props.onChange(index);
};
2025-04-10 11:11:46 +08:00
</script>
<template>
2026-01-12 16:21:32 +08:00
<view class="footer" :style="{ paddingBottom: isIOS ? '30rpx' : '0' }">
<button
hover-class="none"
v-for="(key, index) in Object.keys(tabs)"
:key="key"
@click="onTabChange(index)"
:class="index === 2 ? 'point-book-tab' : ''"
2025-05-01 16:17:51 +08:00
>
2026-01-13 15:46:40 +08:00
<image
2026-01-12 16:21:32 +08:00
v-if="index !== 2"
2026-01-13 15:46:40 +08:00
:src="`../static/tab-${tabs[key]}.png`"
mode="widthFix"
/>
<image v-else src="../static/tab-point-book.png" mode="widthFix" />
<text v-if="index !== 2">{{ key }}</text>
2026-01-12 16:21:32 +08:00
</button>
2025-04-10 11:11:46 +08:00
</view>
</template>
2025-05-01 16:17:51 +08:00
<style scoped>
.footer {
2026-01-12 16:21:32 +08:00
height: 140rpx;
2025-07-02 17:21:44 +08:00
width: 100vw;
2025-05-01 16:17:51 +08:00
position: relative;
display: flex;
2026-01-13 15:46:40 +08:00
justify-content: center;
2025-05-01 16:17:51 +08:00
align-items: center;
2026-01-12 16:21:32 +08:00
background: linear-gradient(
180deg,
rgba(70, 55, 34, 0.75) 0%,
2026-01-13 15:46:40 +08:00
rgba(5, 11, 25, 0.58) 77%
2026-01-12 16:21:32 +08:00
),
#000000;
2026-01-13 15:46:40 +08:00
/* box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.06); */
2025-04-10 11:11:46 +08:00
}
2026-01-12 16:21:32 +08:00
.footer > button {
2025-09-04 18:06:28 +08:00
display: flex;
2026-01-12 16:21:32 +08:00
flex-direction: column;
align-items: center;
2025-09-04 18:06:28 +08:00
justify-content: center;
2026-01-13 15:46:40 +08:00
width: 19%;
color: #8e7d5c;
2025-04-10 11:11:46 +08:00
}
2026-01-12 16:21:32 +08:00
.footer > button > image {
2026-01-13 15:46:40 +08:00
width: 46rpx;
height: 46rpx;
2025-07-30 17:38:48 +08:00
}
2026-01-12 16:21:32 +08:00
.footer > button > text {
font-weight: 500;
font-size: 20rpx;
margin-top: 10rpx;
2025-09-04 18:06:28 +08:00
}
2026-01-12 16:21:32 +08:00
.point-book-tab {
overflow: unset;
2026-01-13 15:46:40 +08:00
margin: 0 1%;
2025-07-15 18:36:57 +08:00
}
2026-01-12 16:21:32 +08:00
.point-book-tab > image {
width: 144rpx !important;
height: 144rpx !important;
2026-01-13 15:46:40 +08:00
transform: translateY(-20rpx);
2025-07-15 18:36:57 +08:00
}
2025-04-10 11:11:46 +08:00
</style>