👽️ 适配月谕圣牌模式

This commit is contained in:
BTMuli
2025-10-01 10:37:46 +08:00
parent 145438373b
commit 3ece987c80
8 changed files with 57 additions and 25 deletions

View File

@@ -29,13 +29,7 @@
<!-- 处理真境剧诗 -->
<template v-else-if="props.pos.type === ActCalendarTypeEnum.RoleCombat">
<div class="combat-append" @click="toCombat()" title="点击前往剧诗页面">
<template v-if="!props.pos.role_combat_detail.is_unlock">
<span>未解锁</span>
</template>
<template v-else-if="!props.pos.role_combat_detail.has_data">
<span>尚未挑战</span>
</template>
<span v-else>{{ props.pos.role_combat_detail.max_round_id }}</span>
<span>{{ getCombatStat(props.pos.role_combat_detail) }}</span>
</div>
</template>
<!-- 处理深境螺旋 -->
@@ -129,6 +123,10 @@ onMounted(() => {
timer = setInterval(handlePosition, 1000);
});
onUnmounted(() => {
if (timer !== null) clearInterval(timer);
});
function handlePosition(): void {
if (restTs.value < 1) {
if (timer !== null) clearInterval(timer);
@@ -155,9 +153,12 @@ function showMaterial(reward: TGApp.Game.ActCalendar.ActReward): void {
emits("clickM", reward);
}
onUnmounted(() => {
if (timer !== null) clearInterval(timer);
});
function getCombatStat(detail: TGApp.Game.ActCalendar.ActRoleCombat): string {
if (!detail.is_unlock) return "未解锁";
if (!detail.has_data) return "尚未挑战";
if (detail.difficulty_id < 5) return `${detail.max_round_id}`;
return `月谕模式·第${detail.max_round_id}幕·圣牌${detail.tarot_finished_cnt}`;
}
</script>
<style lang="scss" scoped>
.ph-pos-user-card {

View File

@@ -1,8 +1,8 @@
<template>
<div class="tuco-box">
<TucTile title="最佳记录" :val="props.data.max_round_id" />
<TucTile title="最佳记录" :val="getBestVal()" />
<TucTile :title="`获得星章-${props.data.medal_num}`" :val="props.data.get_medal_round_list" />
<TucTile :title="getTitle()" :val="`第${props.data.max_round_id}幕`" />
<TucTile :title="getRoundTitle()" :val="getRoundVal()" />
<TucTile title="消耗幻剧之花" :val="props.data.coin_num" />
<TucFight label="最快完成演出" :data="props.fights.shortest_avatar_list" />
<TucTile title="总耗时" :val="getTime()" />
@@ -21,7 +21,7 @@ type TucOverviewProps = { data: TGApp.Game.Combat.Stat; fights: TGApp.Game.Comba
const props = defineProps<TucOverviewProps>();
function getTitle(): string {
function getRoundTitle(): string {
switch (props.data.difficulty_id) {
case 0:
return "未选择";
@@ -33,11 +33,23 @@ function getTitle(): string {
return "困难模式";
case 4:
return "卓越模式";
case 5:
return "月谕模式";
default:
return `未知模式${props.data.difficulty_id}`;
}
}
function getBestVal(): string {
if (props.data.difficulty_id < 5) return `${props.data.max_round_id}`;
return `${props.data.max_round_id}幕·圣牌${props.data.tarot_finished_cnt}`;
}
function getRoundVal(): string {
if (props.data.difficulty_id < 5) return `${props.data.max_round_id}`;
return `${props.data.tarot_finished_cnt + props.data.max_round_id}`;
}
function getTime(): string {
const sec = props.fights.total_use_time % 60;
const min = (props.fights.total_use_time - sec) / 60;
@@ -48,7 +60,7 @@ function getTime(): string {
.tuco-box {
display: grid;
width: 100%;
grid-gap: 8px;
gap: 8px;
grid-template-columns: repeat(3, 1fr);
}
</style>

View File

@@ -2,7 +2,10 @@
<div class="tucr-box">
<div class="tucr-title">
<img :src="`/icon/star/combat${modelValue.is_get_medal ? 1 : 0}.webp`" alt="combat" />
<span class="main">{{ modelValue.round_id }}</span>
<span class="main" v-if="modelValue.is_tarot">
圣牌挑战·{{ modelValue.tarot_serial_no }}
</span>
<span class="main" v-else>{{ modelValue.round_id }}</span>
<span class="sub">{{ timestampToDate(Number(modelValue.finish_time) * 1000) }}</span>
</div>
<div class="tucr-content">

View File

@@ -1,3 +1,4 @@
<!-- TODO: 链接处理重构 -->
<template>
<div class="tp-image-box" v-if="localUrl !== undefined">
<img :src="localUrl" @click="showOverlay = true" :alt="oriUrl" :title="getImageTitle()" />
@@ -118,9 +119,7 @@ function getImageTitle(): string {
}
function getImageExt(): string {
if (props.data.attributes) {
if (props.data.attributes.ext) return props.data.attributes.ext;
}
if (props.data.attributes && props.data.attributes.ext) return props.data.attributes.ext;
if (typeof props.data.insert.image === "string") {
const arr = props.data.insert.image.split(".");
return arr[arr.length - 1];

View File

@@ -1,3 +1,4 @@
<!-- TODO: 重构UI -->
<template>
<v-app-bar>
<template #prepend>
@@ -201,6 +202,7 @@ async function refreshCombat(): Promise<void> {
await TGLogger.Info("[UserCombat][refreshCombat] 更新剧诗数据");
await showLoading.start(`正在获取${account.value.gameUid}的剧诗数据`);
const res = await recordReq.roleCombat(cookie.value, account.value);
console.log(res);
if (res === false) {
await showLoading.end();
showSnackbar.warn("用户未解锁幻想真境剧诗");

View File

@@ -1,7 +1,7 @@
/**
* @file src/types/Game/ActCalendar.d.ts
* @description 游戏-活动日历相关类型定义文件
* @since Beta v0.8.0
* @since Beta v0.8.3
*/
declare namespace TGApp.Game.ActCalendar {
@@ -258,13 +258,21 @@ declare namespace TGApp.Game.ActCalendar {
/**
* @description 真境剧诗活动详情
* @since Beta v0.8.0
* @since Beta v0.8.3
* @interface ActRoleCombat
* @property {number} difficulty_id 难度id
* @property {boolean} has_data 是否有数据
* @property {boolean} is_unlock 是否解锁
* @property {number} max_round_id 最大回合数
* @property {boolean} has_data 是否有数据
* @property {number} tarot_finished_cnt 塔罗牌完成数
*/
type ActRoleCombat = { is_unlock: boolean; max_round_id: number; has_data: boolean };
type ActRoleCombat = {
difficulty_id: number;
has_data: boolean;
is_unlock: boolean;
max_round_id: number;
tarot_finished_cnt: number;
};
/**
* @description 活动信息-深渊螺旋

View File

@@ -1,7 +1,7 @@
/**
* @file types/Game/Combat.d.ts
* @description 幻想真境剧诗类型定义
* @since Beta v0.8.0
* @since Beta v0.8.3
*/
declare namespace TGApp.Game.Combat {
@@ -94,7 +94,7 @@ declare namespace TGApp.Game.Combat {
/**
* @description 状态
* @interface Stat
* @since Beta v0.6.3
* @since Beta v0.8.3
* @property {number} difficulty_id 难度等级
* @property {number} max_round_id 最多层数
* @property {number} heraldry 纹章数
@@ -103,6 +103,7 @@ declare namespace TGApp.Game.Combat {
* @property {number} coin_num 硬币数
* @property {number} avatar_bonus_num 角色声援数
* @property {number} rent_cnt 出借次数
* @property {number} tarot_finished_cnt 塔罗牌完成数
*/
type Stat = {
difficulty_id: number;
@@ -113,6 +114,7 @@ declare namespace TGApp.Game.Combat {
coin_num: number;
avatar_bonus_num: number;
rent_cnt: number;
tarot_finished_cnt: number;
};
/**
@@ -163,7 +165,7 @@ declare namespace TGApp.Game.Combat {
/**
* @description 轮次数据
* @since Beta v0.8.0
* @since Beta v0.8.3
* @interface RoundData
* @property {Array<Avatar>} avatars 角色
* @property {Array<Card>} choice_cards 选中卡片
@@ -174,6 +176,8 @@ declare namespace TGApp.Game.Combat {
* @property {TGApp.Game.Base.DateTime} finish_date_time 完成时间
* @property {Array<Enemy>} enemies 敌人
* @property {SplendourBuff} splendour_buff 总体Buff
* @property {boolean} is_tarot 是否为塔罗牌
* @property {number} tarot_serial_no 塔罗牌序号
*/
type RoundData = {
avatars: Array<Avatar>;
@@ -185,6 +189,8 @@ declare namespace TGApp.Game.Combat {
finish_date_time: TGApp.Game.Base.DateTime;
enemies: Array<Enemy>;
splendour_buff: SplendourBuff;
is_tarot: boolean;
tarot_serial_no: number;
};
/**

View File

@@ -2,6 +2,7 @@
* @file utils/TGClient.ts
* @desc 负责米游社客户端的 callback 处理
* @since Beta v0.7.6
* @todo Cookie 切换异常
*/
import showSnackbar from "@comp/func/snackbar.js";