feat: 实现远征任务事件与报告展示

新增远征任务事件逻辑,支持资源、暗物质、舰船发现及遭遇海盗/外星人等多种结果,并生成对应任务报告。MessagesView支持远征任务详情展示,包括获得资源、舰船及损失舰船。补充多语言包相关远征事件提示。
This commit is contained in:
谦君
2025-12-19 12:37:34 +08:00
parent 752cade67c
commit 20fb2bb6a4
13 changed files with 408 additions and 67 deletions

View File

@@ -11,17 +11,15 @@
</button>
<!-- 页码 - 椭圆形胶囊 -->
<div class="bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-full py-2 px-3 shadow-lg flex items-center gap-1">
<div
class="bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-full py-2 px-3 shadow-lg flex items-center gap-1"
>
<button
v-for="pageNum in pageNumbers"
:key="pageNum"
@click="emit('update:page', pageNum)"
class="h-8 min-w-8 px-2 rounded-full text-sm font-medium transition-colors"
:class="
pageNum === currentPage
? 'bg-primary text-primary-foreground'
: 'hover:bg-accent'
"
:class="pageNum === currentPage ? 'bg-primary text-primary-foreground' : 'hover:bg-accent'"
>
{{ pageNum }}
</button>
@@ -40,54 +38,54 @@
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { ChevronLeft, ChevronRight } from 'lucide-vue-next'
import { computed } from 'vue'
import { ChevronLeft, ChevronRight } from 'lucide-vue-next'
interface Props {
page: number
totalPages: number
maxVisible?: number
}
const props = withDefaults(defineProps<Props>(), {
maxVisible: 3
})
const emit = defineEmits<{
'update:page': [page: number]
}>()
const currentPage = computed(() => props.page)
// 生成页码列表 - 最多显示指定数量页码,不含省略号
const pageNumbers = computed(() => {
const pages: number[] = []
const { totalPages, maxVisible } = props
const current = currentPage.value
if (totalPages <= maxVisible) {
for (let i = 1; i <= totalPages; i++) {
pages.push(i)
}
} else {
let start = current - Math.floor(maxVisible / 2)
let end = current + Math.floor(maxVisible / 2)
// 边界调整
if (start < 1) {
start = 1
end = maxVisible
}
if (end > totalPages) {
end = totalPages
start = totalPages - maxVisible + 1
}
for (let i = start; i <= end; i++) {
pages.push(i)
}
interface Props {
page: number
totalPages: number
maxVisible?: number
}
return pages
})
const props = withDefaults(defineProps<Props>(), {
maxVisible: 3
})
const emit = defineEmits<{
'update:page': [page: number]
}>()
const currentPage = computed(() => props.page)
// 生成页码列表 - 最多显示指定数量页码,不含省略号
const pageNumbers = computed(() => {
const pages: number[] = []
const { totalPages, maxVisible } = props
const current = currentPage.value
if (totalPages <= maxVisible) {
for (let i = 1; i <= totalPages; i++) {
pages.push(i)
}
} else {
let start = current - Math.floor(maxVisible / 2)
let end = current + Math.floor(maxVisible / 2)
// 边界调整
if (start < 1) {
start = 1
end = maxVisible
}
if (end > totalPages) {
end = totalPages
start = totalPages - maxVisible + 1
}
for (let i = start; i <= end; i++) {
pages.push(i)
}
}
return pages
})
</script>