Files
FiDA_Front/src/views/home/top-nav.vue

98 lines
2.1 KiB
Vue
Raw Normal View History

2026-02-03 11:11:04 +08:00
<template>
<div class="top-nav" :style_="topNavStyle">
<span class="icon" v-show="topNavStyle === '2'" @click="onBack">
<svg-icon name="back" size="18" />
</span>
<p class="division"></p>
<div class="credits-box">
2026-02-04 17:00:58 +08:00
<span class="credits">{{ $t('Home.creditsNum', { num: 6000 }) }}</span>
2026-02-03 11:11:04 +08:00
<span class="icon" @click="onRefresh" :class="{ loading }">
<svg-icon name="refresh" size="21" />
</span>
<span class="link"></span>
<span class="icon" @click="onShop"><svg-icon name="shop" size="21" /></span>
</div>
<img class="pic" src="@/assets/images/pic.jpg" />
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const topNavStyle = computed(() => route.meta.topNavStyle)
const router = useRouter()
const loading = ref(false)
const onBack = () => {
router.back()
}
const onShop = () => {
console.log('onShop')
// router.push({ name: 'shop' })
}
const onRefresh = () => {
console.log('onRefresh')
loading.value = true
setTimeout(() => {
loading.value = false
}, 1500)
}
</script>
<style lang="less" scoped>
.top-nav {
height: 8rem;
display: flex;
align-items: center;
padding: 0 2rem 0 3rem;
&[style_='1'] {
border-bottom: 1px solid rgba(201, 201, 201, 1);
}
&[style_='2'] {
border-bottom: 1px solid rgba(201, 201, 201, 1);
background-color: #fff;
}
> .division {
margin: auto;
}
> .icon {
cursor: pointer;
width: 2.4rem;
height: 2.4rem;
}
> .credits-box {
display: flex;
align-items: center;
justify-content: center;
min-width: 18rem;
height: 4.3rem;
margin-right: 1rem;
background-color: rgba(255, 252, 244, 1);
2026-02-06 16:23:22 +08:00
border: 1px solid #FFCF90;
2026-02-03 11:11:04 +08:00
border-radius: 0.8rem;
> .credits {
flex: 1;
font-size: 1.3rem;
margin-left: 1rem;
}
> .link {
height: 100%;
width: 0;
2026-02-06 16:23:22 +08:00
border-right: 1px solid #FFCF90;
2026-02-03 11:11:04 +08:00
}
> .icon {
cursor: pointer;
margin: 0 1rem;
}
> .loading {
animation: loading 0.6s linear infinite;
}
}
> .pic {
width: 4.65rem;
height: 4.65rem;
border-radius: 50%;
}
}
</style>