IOS_Boss/IOS_study/Job/PLJobView+.swift
2025-07-27 12:33:06 +08:00

35 lines
918 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// 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("删除失败,请检查网络并重试")
}
}
}