11<!-- 参量质变仪显示组件 -->
22<template >
33 <div :class =" { 'ph-dnt-ready': ready }" class =" ph-dnt-box" >
4- <div class =" pdb-trans-icon" >
4+ <div :class = " { 'ph-dnt-none': !props.trans.obtained } " class =" pdb-trans-icon" >
55 <img alt =" 参量质变仪" src =" /UI/daily/trans.webp" />
66 </div >
77 <div class =" pdb-trans-info" >
@@ -29,15 +29,13 @@ const formattedTime = ref<string>("");
2929let timer: ReturnType <typeof setInterval > | null = null ;
3030
3131const valueText = computed <string >(() => {
32- if (! props .trans .obtained && ! props .trans .recovery_time .reached ) {
33- return " 恢复中" ;
34- }
35- if (props .trans .obtained || props .trans .recovery_time .reached ) {
32+ if (! props .trans .obtained ) return " 未拥有" ;
33+ if (props .trans .recovery_time .reached ) {
3634 return " 可使用" ;
3735 }
3836 return formattedTime .value ;
3937});
40- const ready = computed <boolean >(() => props .trans .obtained || props .trans .recovery_time .reached );
38+ const ready = computed <boolean >(() => props .trans .obtained && props .trans .recovery_time .reached );
4139
4240onMounted (() => {
4341 initTime ();
@@ -61,19 +59,19 @@ watch(
6159function initTime(): void {
6260 const time = props .trans .recovery_time ;
6361 if (time ) {
64- const hours = time .hour || 0 ;
65- const minutes = time .minute || 0 ;
66- const seconds = time .second || 0 ;
67- remainedTime .value = hours * 3600 + minutes * 60 + seconds ;
62+ const days = time .Day || 0 ;
63+ const hours = time .Hour || 0 ;
64+ const minutes = time .Minute || 0 ;
65+ const seconds = time .Second || 0 ;
66+ remainedTime .value = days * 86400 + hours * 3600 + minutes * 60 + seconds ;
6867 } else {
6968 remainedTime .value = 0 ;
7069 }
7170 updateFormattedTime ();
7271}
7372
7473function startTimer(): void {
75- if (remainedTime .value <= 0 || props .trans .obtained || props .trans .recovery_time .reached ) return ;
76-
74+ if (remainedTime .value <= 0 || ! props .trans .obtained || props .trans .recovery_time .reached ) return ;
7775 timer = setInterval (() => {
7876 if (remainedTime .value > 0 ) {
7977 remainedTime .value -= 1 ;
@@ -91,11 +89,12 @@ function stopTimer(): void {
9189
9290function updateFormattedTime(): void {
9391 if (remainedTime .value <= 0 ) {
94- formattedTime .value = " 0 小时 0 分钟 0 秒 " ;
92+ formattedTime .value = " 00:00:00 " ;
9593 return ;
9694 }
97-
98- formattedTime .value = stamp2LastTime (remainedTime .value * 1000 );
95+ const days = Math .floor (remainedTime .value / 86400 );
96+ if (days > 0 ) formattedTime .value = ` ${days }天后可再次使用 ` ;
97+ else formattedTime .value = stamp2LastTime (remainedTime .value * 1000 );
9998}
10099 </script >
101100<style lang="scss" scoped>
@@ -128,6 +127,13 @@ function updateFormattedTime(): void {
128127 height : 100% ;
129128 object-fit : cover ;
130129 }
130+
131+ & .ph-dnt-none {
132+ img {
133+ filter : grayscale (1 );
134+ opacity : 0.5 ;
135+ }
136+ }
131137}
132138
133139.pdb-trans-info {
0 commit comments