| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <section class="stats-section" style="background-image: url(/images/home/home-bg.png)">
- <NuxtPicture class="stats-figure" src="/images/home/home-d.png" alt="游戏盾" ></NuxtPicture>
- <div class="stat-item">
- <div class="stat-label">今日 CC 攻击次数</div>
- <div class="stat-value">{{ formatNumber(stats.ccAttacks) }}</div>
- </div>
- <div class="stat-item state-other">
- <div class="stat-label">今日 DDoS 攻击峰值</div>
- <div class="stat-value">{{ formatNumber(stats.ddosPeak) }}</div>
- </div>
- <div class="stat-item">
- <div class="stat-label">今日 WAF 拦截次数</div>
- <div class="stat-value">{{ formatNumber(stats.wafBlocks) }}</div>
- </div>
- </section>
- </template>
- <script setup>
- import { onMounted, onUnmounted } from 'vue'
- import { storeToRefs } from 'pinia'
- const statsStore = useStatsStore()
- const { stats } = storeToRefs(statsStore)
- let intervalId = null
- onMounted(() => {
- intervalId = statsStore.startAutoIncrement()
- })
- onUnmounted(() => {
- if (intervalId) {
- statsStore.stopAutoIncrement(intervalId)
- }
- })
- const formatNumber = (num) => {
- return num.toLocaleString()
- }
- </script>
- <style scoped lang="scss">
- .stats-section {
- width: 100%;
- max-width: 1920px;
- height: 749px;
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- background-size: cover;
- background-position: center top;
- overflow: hidden;
- .stats-figure {
- position: absolute;
- top: 280px;
- left: 50%;
- transform: translateX(-50%) translateY(0);
- width: 226.059px;
- height: 305.118px;
- object-fit: contain;
- pointer-events: none;
- z-index: 0;
- will-change: transform;
- animation: float 3s ease-in-out infinite;
- }
- @keyframes float {
- 0% {
- transform: translateX(-50%) translateY(0);
- }
- 50% {
- transform: translateX(-50%) translateY(-20px);
- }
- 100% {
- transform: translateX(-50%) translateY(0);
- }
- }
- .state-other {
- position: absolute;
- top: 100px;
- }
- .stat-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- margin: 0 300px;
- z-index: 1;
- .stat-label {
- font-family: 'Source Han Sans CN', sans-serif;
- font-size: 24px;
- font-weight: 400;
- line-height: 24px;
- color: #ffffff;
- text-align: center;
- margin-bottom: 20px;
- }
- .stat-value {
- font-family: 'Roboto', sans-serif;
- font-size: 56px;
- font-weight: 700;
- line-height: 56px;
- color: #a182ff;
- text-align: center;
- }
- }
- }
- </style>
|