Add sample management and upload flows to Assets module.

Extend media library for sample kind with project selection, wire home routing for sample entries, and expand Assets tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-24 10:06:16 +08:00
parent 607130ade0
commit c772b25897
13 changed files with 523 additions and 111 deletions

View File

@ -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()