IOS_Boss/IOS_study/PLJobViewModel.swift
2025-07-01 11:41:38 +08:00

43 lines
1.1 KiB
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.

//
// PLJobViewModel.swift
// IOS_study
//
// Created by CC-star on 2025/6/29.
//
import Foundation
@Observable final class PLJobViewModel {
var job = PLJob()
var draftJob = PLJob()
var jobs: [PLJob] = [.job]//todo
func postJob() {
job = draftJob
// job.updatedAt = Date()
//)
job.title = job.title.trimmed
job.placeName = job.placeName.trimmed
job.province = job.province.trimmed
job.city = job.city.trimmed
//)
if job.otherTime.isBlank { job.otherTime = "" } else { job.otherTime = job.otherTime.trimmed }
if job.otherNeed.isBlank { job.otherNeed = "" } else { job.otherNeed = job.otherNeed.trimmed }
if job.workContent.isBlank { job.workContent = "" } else { job.workContent = job.workContent.trimmed }
if job.otherBenefit.isBlank { job.otherBenefit = "" } else { job.otherBenefit = job.otherBenefit.trimmed }
//todo
}
func toggleJobStatus() {
job.isActive.toggle()
}
func removeJob() {
job.isActive.toggle()
}
}