chapter-generator.page.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <!-- chapter-generator.page.html -->
  2. <ion-header>
  3. <ion-toolbar>
  4. <!-- 返回箭头 -->
  5. <ion-buttons slot="start">
  6. <ion-back-button defaultHref="/"></ion-back-button>
  7. </ion-buttons>
  8. <!-- 页面标题 -->
  9. <ion-title>章节编辑</ion-title>
  10. <!-- 保存作品按钮 -->
  11. <ion-buttons slot="end">
  12. <ion-button (click)="saveWork()" color="primary">保存作品</ion-button>
  13. </ion-buttons>
  14. </ion-toolbar>
  15. </ion-header>
  16. <ion-content>
  17. <!-- 遮罩层 -->
  18. <div class="overlay" [style.display]="isSideShow ? 'block' : 'none'"></div>
  19. <!-- 主要内容区域 -->
  20. <div class="content-container">
  21. <!-- 侧边栏 -->
  22. <div [style.display]="isSideShow ? 'flex' : 'none'"
  23. style="display: flex; width: 200px; flex-direction: column; z-index: 1000;">
  24. <ion-list>
  25. <ion-item *ngFor="let chapter of chapters; let i = index;" (click)="selectChapter(i)">
  26. <ion-label>{{ chapter.title }}</ion-label>
  27. <ion-buttons slot="end">
  28. <ion-button (click)="deleteChapter(i)">
  29. <ion-icon name="trash"></ion-icon>
  30. </ion-button>
  31. </ion-buttons>
  32. </ion-item>
  33. </ion-list>
  34. <ion-button (click)="addChapter()">
  35. <ion-icon name="add"></ion-icon>添加章节
  36. </ion-button>
  37. <ion-button color="light" (click)="toggleSide()">
  38. <ion-icon name="add"></ion-icon>{{isSideShow ? '折叠' : '展开'}}
  39. </ion-button>
  40. </div>
  41. <!-- 内容区域 -->
  42. <div class="chapter-edit-container">
  43. <ion-button (click)="openAiContinueModal()">AI续写</ion-button>
  44. <ion-button (click)="openAiPolishModal()">AI润色</ion-button>
  45. <ion-button (click)="openAiExpandModal()">AI扩写</ion-button>
  46. @if(selectedChapterIndex !== null){
  47. <ion-item>
  48. <ion-label position="floating">章节标题</ion-label>
  49. <ion-input [(ngModel)]="selectedChapterTitle"></ion-input>
  50. </ion-item>
  51. <ion-label position="floating">章节内容</ion-label>
  52. <ion-item>
  53. <textarea [(ngModel)]="selectedChapterContent" style="width: 100%; height: 300px;"></textarea>
  54. </ion-item>
  55. <ion-button (click)="saveChapter()" expand="block" color="success">保存章节</ion-button>
  56. } @else {
  57. <p>请选择一个章节进行编辑。</p>
  58. }
  59. </div>
  60. </div>
  61. <!-- 悬浮球 -->
  62. <ion-fab vertical="bottom" horizontal="start" slot="fixed">
  63. <ion-fab-button (click)="toggleSide()">
  64. <ion-icon name="chevron-forward"></ion-icon>
  65. </ion-fab-button>
  66. </ion-fab>
  67. </ion-content>