// // PLJobView+.swift // IOS_study // // Created by CC-star on 2025/7/1. // import SwiftUI extension PLJobView { func toggleJobStatus() async { do { try await vm.toggleJobStatus(id: job.id) profileVM.shouldRefreshMyPLJobs = true hud.show(isActive ? "上线成功" : "下线成功")//这里是相反的逻辑,应为之前已经反转过一次了 } catch { print("修改pljob的状态失败:\(error)") hud.show("修改失败,请检查网络并重试") vm.job.isActive.toggle() } } func removeJob() async { do { try await vm.removeJob(id: job.id) profileVM.shouldRefreshMyPLJobs = true hud.show("删除成功") if !naviPath.isEmpty { naviPath.removeLast() } } catch { print("删除plJob失败:\(error)") hud.show("删除失败,请检查网络并重试") } } }