Files
TeyvatGuide/src/components/pageHome/ph-comp-pool.vue
Copilot 53174ffdd7 首页添加游戏签到组件,支持补签 (#182)
* Initial plan

* Add sign-in card component to homepage

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Fix v-icon usage in sign-in card buttons

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Fix: Merge new home components into existing localStorage

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Refactor: Remove redundant code in getShowItems

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Add error handling for localStorage parsing

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Redesign sign-in card to show multiple game accounts with compact UI

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Fix reward item spacing with flex properties

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Redesign sign-in card: grid layout, account switching, light mode fixes

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Add forceReload parameter to prevent unnecessary API calls

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Show multiple game accounts with grid layout and MiHoYo account in append

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Use unique keys and concurrent API requests for better performance

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Refactor sign-in component: split into reusable parts with user switcher

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Fix sign-in logic: highlight based on count not date, enable resign button

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Remove duplicate code and fix comment

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Add reward cell component, extra rewards support, and improved visual distinction

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* 🏷️ 添加Store类型,调整首页选项框宽度

* 🏷️签到 → 游戏签到

* ♻️ 首页组件重构,支持组件分享

* ♻️ 调整组件UI

* 💄 调整loading标题文本大小

* 💄 微调样式

* Refactor sign-in component: sequential loading, progress bar, internal data processing

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* Fix code review issues: correct gameInfo reference and add refresh event

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* 🎨 调整逻辑

* Refactor: self-contained data updates and numeric state enums

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* 🚸 调整排序逻辑

* 🚸 调整loading文本

* ✏️ 调整类型,修复打包失败

* ♻️ 添加补签相关请求

* 💄 调整脚本页布局

* 💄 调整首页布局

* Implement resign feature with local data updates and confirmation dialog

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* ✏️ 补充类型描述

* Fix resign logic: check is_sub, optimize resign info loading, improve success message

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* 🎨 调整逻辑,微调样式

* 🎨 调整唤起位置

* Add click handlers to reward cells for sign-in and resign actions

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* 🐛 对ID进行限制

* 💄 微调顶部gameNav样式

* Fix resign logic: only first missed day is clickable

Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>

* 🎨 放宽补签限制

* 🐛 修正删除逻辑判断

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BTMuli <72692909+BTMuli@users.noreply.github.com>
Co-authored-by: BTMuli <bt-muli@outlook.com>
2025-12-14 02:01:26 +08:00

69 lines
2.0 KiB
Vue

<!-- 首页限时祈愿组件 -->
<template>
<THomeCard :append="false" title="限时祈愿">
<template #default>
<div v-if="pools.length < 3" class="pool-grid">
<PhPoolCard v-for="(pool, idx) in pools" :key="idx" :pool="pool" />
</div>
<!-- TODO: 优化Swiper效果 -->
<Swiper
v-else
:autoplay="{ delay: 3000, disableOnInteraction: false }"
:centered-slides="true"
:loop="true"
:modules="swiperModules"
:navigation="true"
:slides-per-view="2"
:space-between="12"
class="pool-swiper"
>
<SwiperSlide v-for="(pool, idx) in pools" :key="idx">
<PhPoolCard :pool="pool" />
</SwiperSlide>
</Swiper>
</template>
</THomeCard>
</template>
<script lang="ts" setup>
import "swiper/css";
import "swiper/css/pagination";
import "swiper/css/navigation";
import showSnackbar from "@comp/func/snackbar.js";
import PhPoolCard from "@comp/pageHome/ph-pool-card.vue";
import takumiReq from "@req/takumiReq.js";
import TGLogger from "@utils/TGLogger.js";
import { A11y, Autoplay } from "swiper/modules";
import { Swiper, SwiperSlide } from "swiper/vue";
import { onMounted, shallowRef } from "vue";
import THomeCard from "./ph-comp-card.vue";
type TPoolEmits = (e: "success") => void;
const emits = defineEmits<TPoolEmits>();
const pools = shallowRef<Array<TGApp.BBS.Obc.GachaItem>>([]);
const swiperModules = [Autoplay, A11y];
onMounted(async () => {
const resp = await takumiReq.obc.gacha();
if (Array.isArray(resp)) {
if (resp.length < 3) pools.value = resp;
else pools.value = [...resp, ...resp];
} else {
showSnackbar.error(`获取限时祈愿失败:[${resp.retcode}]${resp.message}`);
await TGLogger.Error(`获取限时祈愿失败:[${resp.retcode}]${resp.message}`);
}
emits("success");
});
</script>
<style lang="scss" scoped>
.pool-grid {
display: grid;
align-items: center;
justify-content: space-between;
gap: 8px;
grid-template-columns: repeat(2, 0.5fr);
}
</style>