|
| 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> |
0 commit comments