| 
					
				 | 
			
			
				@@ -0,0 +1,77 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// chapter-generator.page.ts 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { CommonModule } from '@angular/common'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { Component } from '@angular/core'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { FormsModule } from '@angular/forms'; // 导入 FormsModule 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { IonBackButton, IonButton, IonButtons, IonContent, IonFab, IonFabButton, IonHeader, IonIcon, IonInput, IonItem, IonLabel, IonList, IonMenu, IonMenuButton, IonRouterOutlet, IonTitle, IonToolbar } from '@ionic/angular/standalone'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { addIcons } from 'ionicons'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { chevronForward } from 'ionicons/icons'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+addIcons({ chevronForward }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Component({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  selector: 'app-chapter-generator', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  templateUrl: './chapter-generator.page.html', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  styleUrls: ['./chapter-generator.page.scss'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  standalone: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  imports: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    FormsModule, // 添加 FormsModule 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonIcon, IonRouterOutlet, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonList, IonFab, IonBackButton, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonFabButton, CommonModule, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonTitle, IonMenuButton, IonMenu, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    IonContent, IonItem, IonInput, IonLabel, IonButton, IonButtons, IonHeader, IonToolbar 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+export class ChapterGeneratorPage { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  chapters = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { title: 'Chapter 1', content: '这是第一章的内容。' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 其他章节... 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  isSideShow: boolean = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  toggleSide() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.isSideShow = !this.isSideShow; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  addChapter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const newChapter = { title: `Chapter ${this.chapters.length + 1}`, content: '' }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.chapters.push(newChapter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.selectChapter(this.chapters.length - 1); // 自动编辑新添加的章节 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  deleteChapter(index: number) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (index === this.selectedChapterIndex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.selectedChapterIndex = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.selectedChapterTitle = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.selectedChapterContent = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.chapters.splice(index, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  selectedChapterIndex: number | null = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  selectedChapterTitle: string = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  selectedChapterContent: string = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  selectChapter(index: number) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.editChapter(index); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.isSideShow = false; // 隐藏侧边栏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  editChapter(index: number) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.selectedChapterIndex = index; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.selectedChapterTitle = this.chapters[index].title; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.selectedChapterContent = this.chapters[index].content; // 初始化内容为当前章节的内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  saveChapter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (this.selectedChapterIndex !== null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.chapters[this.selectedChapterIndex].title = this.selectedChapterTitle; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.chapters[this.selectedChapterIndex].content = this.selectedChapterContent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('章节内容已保存:', this.selectedChapterContent); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.selectedChapterIndex = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.selectedChapterTitle = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.selectedChapterContent = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.isSideShow = true; // 显示侧边栏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |