Skip to content

Commit 82750cc

Browse files
committed
✨ 新增励行修远小组件
1 parent e8ab18f commit 82750cc

5 files changed

Lines changed: 174 additions & 6 deletions

File tree

public/UI/daily/week_act.webp

1006 Bytes
Loading

src/components/pageHome/ph-comp-game-status.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ async function handleRefreshDailyNote(acc: TGApp.Sqlite.Account.Game): Promise<v
267267
let dataResp: TGApp.Game.DailyNote.DnResp | undefined;
268268
try {
269269
dataResp = await recordReq.daily(cookie.value!, acc);
270+
console.debug(dataResp);
270271
if (dataResp.retcode !== 0) {
271272
await TGLogger.Warn(`[Game Status Card] [${dataResp.retcode}] ${dataResp.message}`);
272273
showSnackbar.error(`刷新失败:[${dataResp.retcode}] ${dataResp.message}`);

src/components/pageHome/ph-daily-note-item.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,25 @@
2020
</div>
2121
<div v-if="props.data" class="dni-content">
2222
<div class="dni-grid">
23-
<div class="dni-row">
23+
<!-- 日常 -->
24+
<div class="dni-row col-4">
2425
<PhDailyNoteResin
2526
:current-resin="props.data.current_resin"
2627
:max-resin="props.data.max_resin"
2728
:recovery-time="props.data.resin_recovery_time"
2829
/>
30+
<PhDailyNoteTask :task="props.data.daily_task" />
2931
<PhDailyNoteCoin
3032
:current-coin="props.data.current_home_coin"
3133
:max-coin="props.data.max_home_coin"
3234
:recovery-time="props.data.home_coin_recovery_time"
3335
/>
34-
<PhDailyNoteTransformer :trans="props.data.transformer" />
36+
<PhDailyNoteWeekAct :wap="props.data.week_active_progress" />
3537
</div>
38+
<!-- 周常 -->
3639
<div class="dni-row">
3740
<PhDailyNoteQuest :quest="props.data.archon_quest_progress" />
38-
<PhDailyNoteTask :task="props.data.daily_task" />
41+
<PhDailyNoteTransformer :trans="props.data.transformer" />
3942
<PhDailyNoteBoss
4043
:remain-resin-discount-num="props.data.remain_resin_discount_num"
4144
:resin-discount-num-limit="props.data.resin_discount_num_limit"
@@ -56,6 +59,7 @@ import PhDailyNoteTransformer from "./ph-daily-note-transformer.vue";
5659
import PhDailyNoteTask from "./ph-daily-note-task.vue";
5760
import PhDailyNoteQuest from "./ph-daily-note-quest.vue";
5861
import PhDailyNoteBoss from "./ph-daily-note-boss.vue";
62+
import PhDailyNoteWeekAct from "./ph-daily-note-week-act.vue";
5963
import { computed } from "vue";
6064
import dnEnum from "@enum/dailyNote.js";
6165
@@ -154,6 +158,10 @@ function handleRefresh(): void {
154158
display: grid;
155159
gap: 4px;
156160
grid-template-columns: repeat(3, 1fr);
161+
162+
&.col-4 {
163+
grid-template-columns: repeat(4, 1fr);
164+
}
157165
}
158166
159167
.dni-item {
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<!-- 励行修远进度组件 -->
2+
<template>
3+
<div class="pdnwa-box">
4+
<div class="pdnwa-icon">
5+
<img alt="励行修远" src="/UI/daily/week_act.webp" />
6+
</div>
7+
<div class="pdnwa-info">
8+
<div class="pdnwa-title-row">
9+
<span>励行修远</span>
10+
<span>{{ periodProgress }}</span>
11+
</div>
12+
<div class="pdnwa-content">
13+
<span class="pdnwa-dots">
14+
<v-icon v-for="idx in 7" :key="idx" :color="getDayColor(idx)" :size="14">
15+
{{ getDayIcon(idx) }}
16+
</v-icon>
17+
</span>
18+
<span class="pdnwa-progress-text">{{ weekProgress }}</span>
19+
</div>
20+
</div>
21+
</div>
22+
</template>
23+
<script lang="ts" setup>
24+
import { computed } from "vue";
25+
26+
type PhDailyNoteWeekActProps = {
27+
wap?: TGApp.Game.DailyNote.WeekActiveProgress;
28+
};
29+
30+
const props = withDefaults(defineProps<PhDailyNoteWeekActProps>(), {
31+
wap: undefined,
32+
});
33+
34+
const weekProgress = computed<string>(() => {
35+
if (!props.wap) return "0/5";
36+
const { progress_current, progress_total } = props.wap;
37+
return `${progress_current}/${progress_total}`;
38+
});
39+
const periodProgress = computed<string>(() => {
40+
if (!props.wap) return "0/8";
41+
const { period_progress_current, period_progress_total } = props.wap;
42+
return `${period_progress_current}/${period_progress_total}`;
43+
});
44+
const weekDays = computed<Array<number>>(() => {
45+
if (!props.wap) return [];
46+
return props.wap.progress_current_arr;
47+
});
48+
49+
function getDayColor(day: number): string {
50+
console.log(day);
51+
if (weekDays.value.includes(day)) return "var(--tgc-od-green)";
52+
if (props.wap?.current_weekday ?? 1 < day) return "var(--tgc-od-white)";
53+
return "var(--tgc-od-red)";
54+
}
55+
56+
function getDayIcon(day: number): string {
57+
if (weekDays.value.includes(day)) return "mdi-check-circle";
58+
if (props.wap?.current_weekday ?? 1 < day) return "mdi-circle-outline";
59+
return "mdi-information";
60+
}
61+
</script>
62+
<style lang="scss" scoped>
63+
.pdnwa-box {
64+
position: relative;
65+
display: flex;
66+
width: 100%;
67+
align-items: center;
68+
padding: 4px;
69+
border-radius: 4px;
70+
background: var(--box-bg-2);
71+
gap: 4px;
72+
}
73+
74+
.pdnwa-icon {
75+
position: relative;
76+
overflow: hidden;
77+
width: 28px;
78+
height: 28px;
79+
flex-shrink: 0;
80+
border-radius: 4px;
81+
82+
img {
83+
width: 100%;
84+
height: 100%;
85+
object-fit: cover;
86+
}
87+
}
88+
89+
.pdnwa-info {
90+
position: relative;
91+
display: flex;
92+
min-width: 0;
93+
flex: 1;
94+
flex-direction: column;
95+
gap: 2px;
96+
}
97+
98+
.pdnwa-title-row {
99+
display: flex;
100+
align-items: center;
101+
justify-content: space-between;
102+
font-family: var(--font-title);
103+
font-size: 13px;
104+
gap: 4px;
105+
}
106+
107+
.pdnwa-content {
108+
position: relative;
109+
display: flex;
110+
align-items: center;
111+
justify-content: space-between;
112+
gap: 4px;
113+
}
114+
115+
.pdnwa-progress-text {
116+
display: flex;
117+
align-items: center;
118+
color: var(--box-text-2);
119+
font-size: 10px;
120+
gap: 4px;
121+
white-space: nowrap;
122+
}
123+
124+
.pdnwa-dots {
125+
display: flex;
126+
align-items: center;
127+
}
128+
</style>

src/types/Game/DailyNote.d.ts

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* 实时便笺数据
3-
* @since Beta v0.10.0
3+
* @since Beta v0.10.2
44
*/
55

66
declare namespace TGApp.Game.DailyNote {
@@ -12,7 +12,7 @@ declare namespace TGApp.Game.DailyNote {
1212

1313
/**
1414
* 实时便笺返回
15-
* @since Beta v0.10.0
15+
* @since Beta v0.10.2
1616
*/
1717
type DnRes = {
1818
/** 当前体力 */
@@ -51,6 +51,8 @@ declare namespace TGApp.Game.DailyNote {
5151
daily_task: DailyTask;
5252
/** 任务进度 */
5353
archon_quest_progress: ArchonQuestProgress;
54+
/** 砺行修远 */
55+
week_active_progress: WeekActiveProgress;
5456
};
5557

5658
/**
@@ -163,7 +165,10 @@ declare namespace TGApp.Game.DailyNote {
163165
wiki_url: string;
164166
};
165167

166-
/** 任务 */
168+
/**
169+
* 任务
170+
* @since Beta v0.10.1
171+
*/
167172
type ArchonQuest = {
168173
/**
169174
* 章节数
@@ -256,4 +261,30 @@ declare namespace TGApp.Game.DailyNote {
256261
*/
257262
type AttendanceRewardStatusEnum =
258263
(typeof AttendanceRewardStatus)[keyof typeof AttendanceRewardStatus];
264+
265+
/**
266+
* 励行修远进度
267+
* @since Beta v0.10.2
268+
*/
269+
type WeekActiveProgress = {
270+
/** 本周已完成进度 */
271+
progress_current: number;
272+
/** 本周总进度 */
273+
progress_total: number;
274+
/** 周数完成进度 */
275+
period_progress_current: number;
276+
/** 周数总进度 */
277+
period_progress_total: number;
278+
/** 是否解锁 */
279+
unlock: boolean;
280+
/**
281+
* 进度数组
282+
* @remarks 1,2,3 周一,周二,周三
283+
*/
284+
progress_current_arr: Array<number>;
285+
/** 是否激活当前进度 */
286+
is_active_period: boolean;
287+
/** 当前周序数 */
288+
current_weekday: number;
289+
};
259290
}

0 commit comments

Comments
 (0)