WelcomeContent.vue
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!--
* @Date: 2026-01-28 17:24:46
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2026-01-28 17:25:09
* @FilePath: /mlaj/src/components/welcome/WelcomeContent.vue
* @Description: 欢迎页内容组件
-->
<template>
<div class="welcome-content">
<!-- 功能入口区域 - 水平布局 -->
<div class="entry-orbit">
<div class="orbit-entries">
<WelcomeEntryItem
v-for="entry in entries"
:key="entry.id"
:entry="entry"
class="orbit-entry"
@click="handleEntryClick"
/>
</div>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { welcomeEntries } from '@/config/welcomeEntries'
import WelcomeEntryItem from './WelcomeEntryItem.vue'
const router = useRouter()
const entries = ref(welcomeEntries)
const handleEntryClick = (entry) => {
if (entry.isExternal) {
// 外部链接:获取用户ID并拼接
const currentUser = JSON.parse(localStorage.getItem('currentUser') || '{}')
const userId = currentUser.id || currentUser.user_id || ''
const url = entry.externalUrl + userId
window.open(url, '_blank')
} else {
// 内部路由跳转
router.push(entry.route)
}
}
</script>
<style lang="less" scoped>
.welcome-content {
position: relative;
width: 100%;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
padding-left: 2rem;
padding-right: 2rem;
padding-bottom: 3rem;
z-index: 1;
}
.entry-orbit {
position: relative;
width: 100%;
max-width: 36rem;
.orbit-entries {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
gap: 0;
.orbit-entry {
flex: 1;
display: flex;
justify-content: center;
animation: float 3s ease-in-out infinite;
&:nth-child(1) {
animation-delay: 0s;
}
&:nth-child(2) {
animation-delay: 0.5s;
}
&:nth-child(3) {
animation-delay: 1s;
}
}
}
}
// 动画定义
@keyframes float {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
}
</style>