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

236 lines
8.6 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.

//
// PLJobsView+JobUI.swift
// IOS_study
//
// Created by CC-star on 2025/7/24.
//
import SwiftUI
extension PLJobView {
// MARK: -
var tilteView: some View {
VStack(alignment: .leading,spacing: kStackSpacing) {
//
HStack {
VStack(alignment: .leading) {
HStack {
Text(job.business)
.labelBG2()
if job.updatedAt.daysFromNow <= 7 { Text("新到").labelWA() }
if job.wantWorkNum > 0 {
Text("\(job.wantWorkNum)").size13s()
}
}
Text(job.title + titleAD).tc().size18b()
}
Spacer()
Text("\(job.hourlyWage)").accent().headline()
}.padding(.bottom,-2)
//
HStack{
Text(job.placeName)
if job.tax == "不报税" {
Text(job.tax).accentBorder()
} else if job.tax == "报税" {
Text(job.tax).redBorder()
} else {
Text(job.tax).grayBorder()
}
Text("\(job.updatedAt.toStr)发布").secondary()
}
//
HStack(spacing: kStackSpacing){
HStack {
HStack(spacing: kIconSpacing) {
//icon
Image("station").iconStyle()
Text("\(job.province)-\(job.city)").semib()
//
Button {
let destination = LocationHelper.shared.buildSmartAddress(job: job)
LocationHelper.shared.navigateToDestination(destination: destination) { errorMessage in
if let message = errorMessage {
hud.show(message)
}
}
} label: {
Text("导航")
}.btnStyle()
}
HStack(spacing: kIconSpacing) {
Image("want").iconStyle()
Text("\(job.wantNum)")
}
if canEdit && job.userID == AuthManager.shared.getUserID(){
HStack {
Button("编辑") {
vm.draftJob = job
naviPath.append(Navi5.PLJobToEdit)
}.buttonStyle(.borderless).accent().disabled(isIng)
Button { showActiveDialog = true } label: {
if vm.isToggling { ProgressView().controlSize(.small) } else { Text(isActive ? "下线" : "上线") }
}.buttonStyle(.borderless).accent().disabled(isIng)
.confirmationDialog(isActive ? "确定下线吗" : "确定上线吗", isPresented: $showActiveDialog, titleVisibility: .visible) {
Button("确定") {
Task { await toggleJobStatus() }
}
Button("再想想", role: .cancel) { }
}
Button { showRemoveDialog = true } label: {
if vm.isRemoving { ProgressView().controlSize(.small) } else { Text("删除") }
}.buttonStyle(.borderless).accent().disabled(isIng)
.confirmationDialog("确定删除吗", isPresented: $showRemoveDialog, titleVisibility: .visible) {
Button("确定", role: .destructive) {
showRemoveAlert = true
}
Button("再想想", role: .cancel) { }
}.alert("删除之后不可恢复", isPresented: $showRemoveAlert) {
Button("确定", role: .destructive) { Task { await removeJob() } }
Button("取消", role: .cancel) { }
}
}
}
}
}
}.textStyle2().cellStyle()
}
// MARK: -
var companyView: some View {
Button {
//todo
} label: {
HStack(spacing: kIconSpacing){
Image("company").iconStyle()
Text(job.companyName).size16semib().oneLineStyleMiddle()
Spacer()
Group {
Text("更多工作")
Image(systemName: "chevron.right")
}.secondary()
}
}.textStyle().cellStyle().buttonStyle(.borderless)
}
// MARK: -
var detailView: some View {
VStack(alignment: .leading,spacing:kStackSpacingS) {
//
VStack(alignment: .leading,spacing: kStackSpacingS) {
HStack(spacing: kIconSpacing) {
Image("time").iconStyle()
Text("工作时间").subTStyle()
}
HStack(spacing: 2) {
Text("\(job.startHour)")
Text(":").conlonStyle()
Text(job.startMin == 0 ? "00" : "\(job.startMin)")
Text("-").conlonStyle()
Text("\(job.endHour)")
Text(":").conlonStyle()
Text(job.endMin == 0 ? "00" : "\(job.endMin)")
}
if job.has2 {
HStack(spacing: 2) {
Text("\(job.startHour2)")
Text(":").conlonStyle()
Text(job.startMin2 == 0 ? "00" : "\(job.startMin2)")
Text("-").conlonStyle()
Text("\(job.endHour2)")
Text(":").conlonStyle()
Text(job.endMin2 == 0 ? "00" : "\(job.endMin2)")
}
}
// Text("\(job.startHour)-\(job.endHour)").labelBG()
// if job.has2 {
// Text("\(job.startHour2)-\(job.endHour2)").labelBG()
// }
}
// Divider()
exDivider()
if !job.workContent.isEmpty {
//
VStack(alignment: .leading,spacing: kStackSpacingS) {
HStack(spacing: kIconSpacing) {
Image("content").iconStyle()
Text("工作内容").subTStyle()
}
Text(job.workContent).allowMulti()
}
exDivider()
}
//
VStack(alignment: .leading,spacing: kStackSpacingS) {
HStack(spacing: kIconSpacing) {
Image("need").iconStyle()
Text("工作要求").subTStyle()
}
HStack {
Text(job.needExp).labelWAL()
Text(job.needEdu).labelWAL()
}
HStack {
Text(job.needLan).labelWAL()
Text(job.needFrame).labelWAL()
}
if !job.otherNeed.isEmpty {
Text(job.otherNeed).allowMulti()
}
}
//
exDivider()
VStack(alignment: .leading,spacing: kStackSpacingS) {
HStack(spacing: kIconSpacing) {
Image("benefit").iconStyle()
Text("公式福利").subTStyle()
}
HStack {
if job.noOverTime {
Text("不加班").labelWAL()
}
if job.moveFee {
Text("交通费").labelWAL()
}
}
//
if !job.otherBenefit.isEmpty {
Text(job.otherBenefit).allowMulti()
}
}
}.textStyle2().cellStyle()
}
// MARK: -
var contactView: some View {
VStack(alignment: .leading,spacing:kStackSpacingS){
Text("应聘方式(\(job.contactType)").subTStyleL()
HStack {
Text("\(job.contact)").size20b().tc().allowMulti()
Spacer()
Button("复制"){
UIPasteboard.general.string = job.contact
hud.show("复制成功")
//todo
}.btnStyle().padding(6)
// Button {
// UIPasteboard.general.string = "0423-1230-1241"
// //todo
// }
// } label: {
// Text("")
// }.btnStyle().padding(6)
}
Text("若问起,请说是在测试软件上看到的").size14().purple()
}.cellStyle()
}
}