diff --git a/AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift b/AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift index fd612fe..7d86e3d 100644 --- a/AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift +++ b/AIStudyApp/AIStudyApp/Features/Library/LibrarySubpages.swift @@ -128,15 +128,6 @@ struct AddKnowledgePage: View { var body: some View { ZStack { Color.zxBg0.ignoresSafeArea(); VStack(spacing: 0) { ScrollView { VStack(spacing: 16) { - // 标题 - VStack(alignment: .leading, spacing: 8) { - Text("标题(可选,留空使用文件名)").font(.system(size: 12, weight: .semibold)).foregroundColor(Color.zxF035) - TextField("输入知识点标题,留空则用文件名", text: $title).font(.system(size: 15)).tint(Color.zxPurple) - .padding(.horizontal, 16).frame(height: 52) - .background(Color.zxFill004).clipShape(RoundedRectangle(cornerRadius: 14)) - .overlay(RoundedRectangle(cornerRadius: 14).stroke(Color.zxBorder008, lineWidth: 1)) - } - // 内容来源选择 VStack(alignment: .leading, spacing: 8) { Text("内容来源").font(.system(size: 12, weight: .semibold)).foregroundColor(Color.zxF035) @@ -149,6 +140,13 @@ struct AddKnowledgePage: View { // 内容区 switch sourceType { case .manual: + VStack(alignment: .leading, spacing: 8) { + Text("标题").font(.system(size: 12, weight: .semibold)).foregroundColor(Color.zxF035) + TextField("输入知识点标题", text: $title).font(.system(size: 15)).tint(Color.zxPurple) + .padding(.horizontal, 16).frame(height: 52) + .background(Color.zxFill004).clipShape(RoundedRectangle(cornerRadius: 14)) + .overlay(RoundedRectangle(cornerRadius: 14).stroke(Color.zxBorder008, lineWidth: 1)) + } VStack(alignment: .leading, spacing: 8) { Text("内容").font(.system(size: 12, weight: .semibold)).foregroundColor(Color.zxF035) TextEditor(text: $content) @@ -253,7 +251,7 @@ struct AddKnowledgePage: View { private var canSave: Bool { switch sourceType { - case .manual: return !content.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + case .manual: return !title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty && !content.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty case .file: return !selectedFiles.isEmpty && !isUploading } }