为资产模块新增样片管理与上传流程
扩展媒体库以支持样片类型及项目选择,为样片入口接入首页路由,并扩展 Assets 测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -301,9 +301,10 @@ struct CloudTransferItem: Identifiable, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
/// 素材库类型实体,当前只接管素材管理,样片管理后续单独迁移。
|
||||
/// 素材库类型实体,表示素材或样片两类媒体资产。
|
||||
enum MediaLibraryKind: Int, CaseIterable, Identifiable {
|
||||
case material = 1
|
||||
case sample = 2
|
||||
|
||||
var id: Int { rawValue }
|
||||
|
||||
@ -312,6 +313,58 @@ enum MediaLibraryKind: Int, CaseIterable, Identifiable {
|
||||
switch self {
|
||||
case .material:
|
||||
"素材管理"
|
||||
case .sample:
|
||||
"样片管理"
|
||||
}
|
||||
}
|
||||
|
||||
/// 返回上传页面标题。
|
||||
var uploadTitle: String {
|
||||
switch self {
|
||||
case .material:
|
||||
"上传素材"
|
||||
case .sample:
|
||||
"上传样片"
|
||||
}
|
||||
}
|
||||
|
||||
/// 返回详情页面标题。
|
||||
var detailTitle: String {
|
||||
switch self {
|
||||
case .material:
|
||||
"素材详情"
|
||||
case .sample:
|
||||
"样片详情"
|
||||
}
|
||||
}
|
||||
|
||||
/// 返回名称输入占位文案。
|
||||
var namePlaceholder: String {
|
||||
switch self {
|
||||
case .material:
|
||||
"素材名称"
|
||||
case .sample:
|
||||
"样片名称"
|
||||
}
|
||||
}
|
||||
|
||||
/// 返回搜索输入占位文案。
|
||||
var searchPlaceholder: String {
|
||||
switch self {
|
||||
case .material:
|
||||
"搜索素材名称"
|
||||
case .sample:
|
||||
"搜索样片名称"
|
||||
}
|
||||
}
|
||||
|
||||
/// 返回空列表标题。
|
||||
var emptyTitle: String {
|
||||
switch self {
|
||||
case .material:
|
||||
"暂无素材"
|
||||
case .sample:
|
||||
"暂无样片"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -643,21 +696,24 @@ struct MediaAlbumEditRequest: Encodable, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
/// 素材操作请求实体,用于上下架。
|
||||
/// 素材操作请求实体,用于素材或样片上下架。
|
||||
struct MediaAlbumOperationRequest: Encodable, Equatable {
|
||||
let id: Int
|
||||
let type: Int
|
||||
let listingStatus: Int
|
||||
|
||||
/// 请求字段映射,兼容后端下划线命名。
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
case type
|
||||
case listingStatus = "listing_status"
|
||||
}
|
||||
}
|
||||
|
||||
/// 素材删除请求实体。
|
||||
/// 素材删除请求实体,用于删除素材或样片。
|
||||
struct MediaAlbumDeleteRequest: Encodable, Equatable {
|
||||
let id: Int
|
||||
let type: Int
|
||||
}
|
||||
|
||||
/// 素材标签新增请求实体。
|
||||
@ -665,6 +721,52 @@ struct MediaAlbumAddTagRequest: Encodable, Equatable {
|
||||
let name: String
|
||||
}
|
||||
|
||||
/// 摄影项目列表项实体,表示样片上传时可关联的项目。
|
||||
struct PhotographerProjectItem: Decodable, Identifiable, Hashable {
|
||||
let id: Int
|
||||
let type: Int
|
||||
let typeName: String
|
||||
let status: Int
|
||||
let statusName: String
|
||||
let name: String
|
||||
let coverProject: String
|
||||
let coverVideo: String
|
||||
let price: String
|
||||
let otPrice: String
|
||||
let priceDeposit: String
|
||||
|
||||
/// 字段映射,兼容后端下划线命名。
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
case type
|
||||
case typeName = "type_name"
|
||||
case status
|
||||
case statusName = "status_name"
|
||||
case name
|
||||
case coverProject = "cover_project"
|
||||
case coverVideo = "cover_video"
|
||||
case price
|
||||
case otPrice = "ot_price"
|
||||
case priceDeposit = "price_deposit"
|
||||
}
|
||||
|
||||
/// 宽松解码项目列表项。
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
id = try container.decodeLossyInt(forKey: .id) ?? 0
|
||||
type = try container.decodeLossyInt(forKey: .type) ?? 0
|
||||
typeName = try container.decodeLossyString(forKey: .typeName)
|
||||
status = try container.decodeLossyInt(forKey: .status) ?? 0
|
||||
statusName = try container.decodeLossyString(forKey: .statusName)
|
||||
name = try container.decodeLossyString(forKey: .name)
|
||||
coverProject = try container.decodeLossyString(forKey: .coverProject)
|
||||
coverVideo = try container.decodeLossyString(forKey: .coverVideo)
|
||||
price = try container.decodeLossyString(forKey: .price)
|
||||
otPrice = try container.decodeLossyString(forKey: .otPrice)
|
||||
priceDeposit = try container.decodeLossyString(forKey: .priceDeposit)
|
||||
}
|
||||
}
|
||||
|
||||
/// 素材本地待上传文件实体,表示封面或媒体文件的内存数据。
|
||||
struct MediaLocalUploadFile: Identifiable, Equatable {
|
||||
let id = UUID()
|
||||
|
||||
Reference in New Issue
Block a user