从 iOS 17 Observation 迁移至 iOS 16 兼容的 Combine 架构
将最低部署版本降至 iOS 16,以 ObservableObject 替换 @Observable,新增导航与 UI 兼容层,并补充登录冒烟 UI 测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -9,15 +9,15 @@ import SwiftUI
|
||||
|
||||
/// 排班管理页面,展示月视图日期标记和当天排班列表。
|
||||
struct ScheduleManagementView: View {
|
||||
@Environment(AccountContext.self) private var accountContext
|
||||
@Environment(ScheduleAPI.self) private var scheduleAPI
|
||||
@EnvironmentObject private var accountContext: AccountContext
|
||||
@Environment(\.scheduleAPI) private var scheduleAPI
|
||||
@Environment(\.globalLoading) private var globalLoading
|
||||
@State private var viewModel = ScheduleManagementViewModel()
|
||||
@StateObject private var viewModel = ScheduleManagementViewModel()
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
if accountContext.currentScenic?.id == nil {
|
||||
ContentUnavailableView("缺少景区", systemImage: "calendar.badge.exclamationmark", description: Text("请选择景区后再查看排班。"))
|
||||
AppContentUnavailableView("缺少景区", systemImage: "calendar.badge.exclamationmark", description: Text("请选择景区后再查看排班。"))
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
} else {
|
||||
ScrollView {
|
||||
@ -96,7 +96,7 @@ struct ScheduleManagementView: View {
|
||||
Text(viewModel.selectedDate.scheduleDayText)
|
||||
.font(.system(size: AppMetrics.FontSize.body, weight: .semibold))
|
||||
if viewModel.items.isEmpty {
|
||||
ContentUnavailableView("当天暂无日程", systemImage: "calendar")
|
||||
AppContentUnavailableView("当天暂无日程", systemImage: "calendar")
|
||||
.frame(minHeight: 180)
|
||||
} else {
|
||||
ForEach(viewModel.items) { item in
|
||||
@ -126,10 +126,10 @@ struct ScheduleManagementView: View {
|
||||
/// 新增排班页面,支持手动录入和关联订单。
|
||||
struct ScheduleAddView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@Environment(AccountContext.self) private var accountContext
|
||||
@Environment(ScheduleAPI.self) private var scheduleAPI
|
||||
@EnvironmentObject private var accountContext: AccountContext
|
||||
@Environment(\.scheduleAPI) private var scheduleAPI
|
||||
@Environment(\.globalLoading) private var globalLoading
|
||||
@State private var viewModel = ScheduleAddViewModel()
|
||||
@StateObject private var viewModel = ScheduleAddViewModel()
|
||||
@State private var date = Date()
|
||||
@State private var startTime = Date()
|
||||
@State private var endTime = Calendar.current.date(byAdding: .hour, value: 1, to: Date()) ?? Date()
|
||||
|
||||
Reference in New Issue
Block a user