2026-02-05 18:00:11 +08:00
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
|
import { onMounted, ref } from 'vue'
|
2026-02-10 08:45:26 +08:00
|
|
|
|
import { useRoute } from 'vue-router'
|
2026-02-05 18:00:11 +08:00
|
|
|
|
import CompetitionLayout from '@/components/custom/user/CompetitionLayout.vue'
|
2026-02-06 17:45:44 +08:00
|
|
|
|
import { useRouterPush } from '@/hooks/common/router'
|
2026-02-11 17:27:08 +08:00
|
|
|
|
import { fetchGetGroupListByActivityID } from '@/service/api/game'
|
2026-02-05 18:00:11 +08:00
|
|
|
|
|
2026-02-10 08:45:26 +08:00
|
|
|
|
const { routerPushByKey, routerBack } = useRouterPush()
|
|
|
|
|
|
const route = useRoute()
|
2026-02-05 18:00:11 +08:00
|
|
|
|
|
2026-02-11 17:27:08 +08:00
|
|
|
|
const groups = ref<Api.Competition.ActivityTeamGroup[]>([])
|
2026-02-10 08:45:26 +08:00
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const activityId = route.query.activityId as string
|
2026-02-11 17:27:08 +08:00
|
|
|
|
const isAllEnd = ref(false)
|
2026-02-10 08:45:26 +08:00
|
|
|
|
|
|
|
|
|
|
async function getGroups() {
|
|
|
|
|
|
if (!activityId)
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
try {
|
2026-02-11 17:27:08 +08:00
|
|
|
|
const { data, error } = await fetchGetGroupListByActivityID(activityId, 0)
|
2026-02-10 08:45:26 +08:00
|
|
|
|
if (error) {
|
|
|
|
|
|
window?.$message?.error(error.message)
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const list = data?.data || []
|
|
|
|
|
|
if (list && Array.isArray(list)) {
|
|
|
|
|
|
groups.value = list.map((item: any) => ({
|
2026-02-11 17:27:08 +08:00
|
|
|
|
...item,
|
|
|
|
|
|
// id: item.Id,
|
|
|
|
|
|
// name: item.Name,
|
2026-02-10 08:45:26 +08:00
|
|
|
|
icon: 'activity', // Default icon since API might not provide one
|
|
|
|
|
|
}))
|
|
|
|
|
|
}
|
2026-02-11 17:27:08 +08:00
|
|
|
|
isAllEnd.value = list.every((item: Api.Competition.ActivityTeamGroup) => item.IsEnd)
|
|
|
|
|
|
// console.log(groups.value, 'groups.value')
|
2026-02-10 08:45:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
finally {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-05 18:00:11 +08:00
|
|
|
|
|
|
|
|
|
|
const showContent = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
function handleBack() {
|
2026-02-10 08:45:26 +08:00
|
|
|
|
routerBack()
|
2026-02-05 18:00:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleNext() {
|
2026-02-11 17:27:08 +08:00
|
|
|
|
routerPushByKey('user')
|
2026-02-05 18:00:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-11 17:27:08 +08:00
|
|
|
|
function selectGroup(item: Api.Competition.ActivityTeamGroup) {
|
|
|
|
|
|
if (item.IsEnd)
|
|
|
|
|
|
return
|
|
|
|
|
|
|
2026-02-05 18:00:11 +08:00
|
|
|
|
// 选择组别逻辑
|
2026-02-11 17:27:08 +08:00
|
|
|
|
routerPushByKey('user_teams', { query: { activityId, groupsId: item.Id } })
|
2026-02-05 18:00:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
showContent.value = true
|
2026-02-10 08:45:26 +08:00
|
|
|
|
getGroups()
|
2026-02-05 18:00:11 +08:00
|
|
|
|
}, 100)
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<CompetitionLayout
|
2026-02-27 08:37:45 +08:00
|
|
|
|
:show-back="true" :show-next="isAllEnd" next-btn-text="查看队伍结果" :title-bg-type="2"
|
|
|
|
|
|
title="展示组别" @back="handleBack" @next="handleNext"
|
2026-02-05 18:00:11 +08:00
|
|
|
|
>
|
|
|
|
|
|
<!-- Groups Grid -->
|
|
|
|
|
|
<div class="groups-container">
|
|
|
|
|
|
<TransitionGroup name="list-anim" tag="div" class="groups-grid">
|
|
|
|
|
|
<div
|
2026-02-27 08:37:45 +08:00
|
|
|
|
v-for="(item, index) in groups" v-show="showContent" :key="item.Id" class="group-item"
|
|
|
|
|
|
:class="{ 'is-disabled': item.IsEnd }" :style="{ '--delay': `${index * 0.05}s` }" @click="selectGroup(item)"
|
2026-02-05 18:00:11 +08:00
|
|
|
|
>
|
|
|
|
|
|
<div class="icon-wrapper">
|
|
|
|
|
|
<div class="flower-bg" />
|
|
|
|
|
|
<div class="inner-icon">
|
2026-02-06 17:45:44 +08:00
|
|
|
|
<img src="@/assets/imgs/user/star-icon.svg" alt="star" class="star-img">
|
2026-02-05 18:00:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="group-name-tag">
|
|
|
|
|
|
<span class="sun-icon">☀️</span>
|
2026-02-11 17:27:08 +08:00
|
|
|
|
{{ item.Name }}
|
2026-02-05 18:00:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</TransitionGroup>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</CompetitionLayout>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.groups-container {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 0 60px;
|
|
|
|
|
|
margin-top: 60px;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.groups-grid {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
gap: 20px;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
max-width: 1200px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.group-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: transform 0.3s ease;
|
|
|
|
|
|
width: calc(20% - 16px);
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
margin-bottom: 30px;
|
|
|
|
|
|
|
2026-02-11 17:27:08 +08:00
|
|
|
|
&.is-disabled {
|
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
filter: grayscale(100%);
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
transform: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-05 18:00:11 +08:00
|
|
|
|
&:hover {
|
|
|
|
|
|
transform: translateY(-5px);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.icon-wrapper {
|
|
|
|
|
|
width: 100px;
|
|
|
|
|
|
height: 100px;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
background-size: contain;
|
|
|
|
|
|
|
|
|
|
|
|
.star-img {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
object-fit: contain;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.group-name-tag {
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
background: #e0f2f1;
|
|
|
|
|
|
padding: 4px 16px;
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
font-size: 1rem;
|
2026-02-06 17:45:44 +08:00
|
|
|
|
color: $group-text-color;
|
2026-02-05 18:00:11 +08:00
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
border: 2px solid #fff;
|
|
|
|
|
|
|
|
|
|
|
|
.sun-icon {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
right: -8px;
|
|
|
|
|
|
top: -8px;
|
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
|
|
content: '🌸';
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
left: -12px;
|
|
|
|
|
|
bottom: -4px;
|
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Transitions
|
|
|
|
|
|
.fade-slide-down-enter-active,
|
|
|
|
|
|
.fade-slide-down-leave-active {
|
|
|
|
|
|
transition: all 0.8s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.fade-slide-down-enter-from,
|
|
|
|
|
|
.fade-slide-down-leave-to {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
transform: translateY(-30px);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.list-anim-enter-active,
|
|
|
|
|
|
.list-anim-leave-active {
|
|
|
|
|
|
transition: all 0.5s cubic-bezier(0.5, 0, 0.25, 1);
|
|
|
|
|
|
transition-delay: var(--delay);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.list-anim-enter-from,
|
|
|
|
|
|
.list-anim-leave-to {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
transform: scale(0.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Responsive styles auto-handled by flex-wrap */
|
|
|
|
|
|
</style>
|