基于 Lottie 在关键流程中新增全局 Loading 遮罩
引入带引用计数的 GlobalLoadingCenter,通过 RootView 及主要登录/订单/个人中心页面接入,并添加 Loading 动画资源与单元测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -13,6 +13,7 @@ struct StoreOrderDetailView: View {
|
||||
@Environment(OrdersAPI.self) private var ordersAPI
|
||||
@Environment(RouterPath.self) private var router
|
||||
@Environment(ToastCenter.self) private var toastCenter
|
||||
@Environment(\.globalLoading) private var globalLoading
|
||||
|
||||
let item: OrderEntity
|
||||
@State private var viewModel: OrderDetailViewModel
|
||||
@ -25,16 +26,6 @@ struct StoreOrderDetailView: View {
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
if viewModel.loading {
|
||||
Section {
|
||||
HStack {
|
||||
Spacer()
|
||||
ProgressView("加载详情中...")
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let contextMessage = viewModel.contextMessage {
|
||||
Section {
|
||||
Label(contextMessage, systemImage: "info.circle")
|
||||
@ -117,7 +108,9 @@ struct StoreOrderDetailView: View {
|
||||
.navigationTitle("订单详情")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.task {
|
||||
await viewModel.load(api: ordersAPI, fallbackStoreId: accountContext.currentStore?.id)
|
||||
await globalLoading.withLoading(message: "加载详情中...") {
|
||||
await viewModel.load(api: ordersAPI, fallbackStoreId: accountContext.currentStore?.id)
|
||||
}
|
||||
}
|
||||
.alert("提示", isPresented: errorBinding) {
|
||||
Button("知道了", role: .cancel) {}
|
||||
|
||||
Reference in New Issue
Block a user