feat: 倒计时从30秒开始
This commit is contained in:
parent
3dc171aefe
commit
c5a314f72b
@ -196,14 +196,14 @@ final class BlindBoxViewModel: ObservableObject {
|
|||||||
if status == "preparing" {
|
if status == "preparing" {
|
||||||
// 若没有在计时或已结束,则从默认 36:50 开始;如后续需要可改为读取服务端剩余时间
|
// 若没有在计时或已结束,则从默认 36:50 开始;如后续需要可改为读取服务端剩余时间
|
||||||
if countdownTask == nil || remainingSeconds <= 0 {
|
if countdownTask == nil || remainingSeconds <= 0 {
|
||||||
startCountdown(minutes: 36, seconds: 50)
|
startCountdown(minutes: 30, seconds: 0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stopCountdown()
|
stopCountdown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func startCountdown(minutes: Int = 36, seconds: Int = 50) {
|
func startCountdown(minutes: Int = 30, seconds: Int = 0) {
|
||||||
stopCountdown()
|
stopCountdown()
|
||||||
remainingSeconds = max(0, minutes * 60 + seconds)
|
remainingSeconds = max(0, minutes * 60 + seconds)
|
||||||
countdownText = String(format: "%02d:%02d", remainingSeconds / 60, remainingSeconds % 60)
|
countdownText = String(format: "%02d:%02d", remainingSeconds / 60, remainingSeconds % 60)
|
||||||
|
|||||||
@ -6,6 +6,8 @@ struct SettingsView: View {
|
|||||||
|
|
||||||
/// 环境变量 - 用于dismiss视图
|
/// 环境变量 - 用于dismiss视图
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
/// 环境变量 - 打开外部URL
|
||||||
|
@Environment(\.openURL) private var openURL
|
||||||
|
|
||||||
/// 状态 - 控制视图显示/隐藏
|
/// 状态 - 控制视图显示/隐藏
|
||||||
@Binding var isPresented: Bool
|
@Binding var isPresented: Bool
|
||||||
@ -59,7 +61,11 @@ struct SettingsView: View {
|
|||||||
settingRow(
|
settingRow(
|
||||||
icon: "Suport",
|
icon: "Suport",
|
||||||
title: "Support & Service",
|
title: "Support & Service",
|
||||||
action: {}
|
action: {
|
||||||
|
if let url = URL(string: "https://work.weixin.qq.com/kfid/kfca0ac87f4e05e8bfd") {
|
||||||
|
openURL(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// 关于我们
|
// 关于我们
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user