瀏覽代碼

fix:full app3

祝雨婧 5 月之前
父節點
當前提交
b0f289e9ba

+ 4 - 1
novel-app/angular.json

@@ -126,7 +126,10 @@
     }
   },
   "cli": {
-    "schematicCollections": ["@ionic/angular-toolkit"]
+    "schematicCollections": [
+      "@ionic/angular-toolkit"
+    ],
+    "analytics": "689cbd1b-8d21-4964-9713-7bd41c273cdb"
   },
   "schematics": {
     "@ionic/angular-toolkit:component": {

File diff suppressed because it is too large
+ 641 - 14
novel-app/package-lock.json


+ 1 - 0
novel-app/package.json

@@ -27,6 +27,7 @@
     "@capacitor/keyboard": "6.0.3",
     "@capacitor/status-bar": "6.0.2",
     "@ionic/angular": "^8.0.0",
+    "fmode-ng": "^0.0.62",
     "ionicons": "^7.2.1",
     "rxjs": "~7.8.0",
     "tslib": "^2.3.0",

+ 3 - 2
novel-app/src/app/app.component.html

@@ -1,3 +1,4 @@
-<ion-app>
+<!-- <ion-app>
   <ion-router-outlet></ion-router-outlet>
-</ion-app>
+</ion-app> -->
+<router-outlet></router-outlet>

+ 3 - 2
novel-app/src/app/app.component.ts

@@ -1,12 +1,13 @@
 import { Component } from '@angular/core';
+import { RouterOutlet } from '@angular/router';
 import { IonApp, IonRouterOutlet } from '@ionic/angular/standalone';
 
 @Component({
   selector: 'app-root',
   templateUrl: 'app.component.html',
   standalone: true,
-  imports: [IonApp, IonRouterOutlet],
+  imports: [IonApp, IonRouterOutlet, RouterOutlet],
 })
 export class AppComponent {
-  constructor() {}
+  constructor() { }
 }

+ 102 - 0
novel-app/src/app/home/home.page.html

@@ -0,0 +1,102 @@
+<ion-header>
+  <ion-toolbar>
+    <ion-buttons slot="start">
+      <ion-button (click)="goToHome()">
+        <ion-icon name="home-outline"></ion-icon>
+      </ion-button>
+    </ion-buttons>
+    <ion-searchbar [(ngModel)]="searchQuery" (ionInput)="onSearchInput($event)"
+      placeholder="搜索小说、角色或创意内容"></ion-searchbar>
+    <ion-buttons slot="end">
+      <ion-menu-button></ion-menu-button>
+      <ion-button (click)="openUserMenu($event)">
+        <ion-avatar>
+          <img [src]="userAvatar" *ngIf="userAvatar; else defaultAvatar">
+          <ng-template #defaultAvatar>
+            <ion-icon name="person-outline"></ion-icon>
+          </ng-template>
+        </ion-avatar>
+      </ion-button>
+    </ion-buttons>
+  </ion-toolbar>
+</ion-header>
+
+<!--轮播图/推荐位-->
+<ion-content [fullscreen]="true">
+  <ion-slides pager="true" autoplay="3000">
+    <ion-slide *ngFor="let item of recommendedItems; let i = index">
+      <img [src]="item.image" />
+      <div class="carousel-caption">
+        <h3>{{ item.title }}</h3>
+        <p>{{ item.description }}</p>
+        <button (click)="goToItem(item)">阅读更多</button>
+      </div>
+    </ion-slide>
+  </ion-slides>
+
+
+  <!-- 功能亮点介绍 -->
+  <ion-grid>
+    <ion-row>
+      <ion-col size="6">
+        <ion-card>
+          <ion-card-header>
+            <ion-card-title>小说生成</ion-card-title>
+          </ion-card-header>
+          <ion-card-content>
+            <ion-button expand="full" (click)="navigateToNovelGeneration()">
+              <ion-icon name="book" slot="start"></ion-icon>
+              定制你的小说世界
+            </ion-button>
+          </ion-card-content>
+        </ion-card>
+      </ion-col>
+      <ion-col size="6">
+        <ion-card>
+          <ion-card-header>
+            <ion-card-title>智能体创建</ion-card-title>
+          </ion-card-header>
+          <ion-card-content>
+            <ion-button expand="full" (click)="navigateToCharacterCreation()">
+              <ion-icon name="person" slot="start"></ion-icon>
+              创建你的智能体
+            </ion-button>
+          </ion-card-content>
+        </ion-card>
+      </ion-col>
+    </ion-row>
+  </ion-grid>
+
+  <!-- 社区互动板块 -->
+  <ion-list>
+    <ion-item-group>
+      <ion-item-divider>
+        <ion-label>最新动态</ion-label>
+      </ion-item-divider>
+      <ion-item *ngFor="let post of latestPosts">
+        <ion-avatar slot="start">
+          <img [src]="post.avatarUrl" alt="Avatar">
+        </ion-avatar>
+        <ion-label>
+          <h2>{{ post.title }}</h2>
+          <p>{{ post.content }}</p>
+        </ion-label>
+      </ion-item>
+    </ion-item-group>
+
+    <ion-item-group>
+      <ion-item-divider>
+        <ion-label>热门话题</ion-label>
+      </ion-item-divider>
+      <ion-item *ngFor="let topic of popularTopics">
+        <ion-label>
+          <h2>{{ topic.name }}</h2>
+          <p>{{ topic.description }}</p>
+        </ion-label>
+      </ion-item>
+    </ion-item-group>
+  </ion-list>
+
+
+
+</ion-content>

+ 0 - 0
novel-app/src/app/tab1/tab1.page.scss → novel-app/src/app/home/home.page.scss


+ 4 - 4
novel-app/src/app/tab1/tab1.page.spec.ts → novel-app/src/app/home/home.page.spec.ts

@@ -1,13 +1,13 @@
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 
-import { Tab1Page } from './tab1.page';
+import { HomePage } from './home.page';
 
 describe('Tab1Page', () => {
-  let component: Tab1Page;
-  let fixture: ComponentFixture<Tab1Page>;
+  let component: HomePage;
+  let fixture: ComponentFixture<HomePage>;
 
   beforeEach(async () => {
-    fixture = TestBed.createComponent(Tab1Page);
+    fixture = TestBed.createComponent(HomePage);
     component = fixture.componentInstance;
     fixture.detectChanges();
   });

+ 88 - 0
novel-app/src/app/home/home.page.ts

@@ -0,0 +1,88 @@
+import { Component, OnInit, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import {
+  IonHeader, IonToolbar, IonTitle, IonContent, IonSearchbar, IonButtons, IonButton, IonIcon, IonMenuButton, IonAvatar,
+  IonGrid, IonRow, IonCol, IonCard, IonCardHeader, IonCardContent, IonList, IonItem, IonLabel
+} from '@ionic/angular/standalone';
+
+import { CommonModule } from '@angular/common';
+import { Router } from '@angular/router';
+
+@Component({
+  selector: 'app-home',
+  templateUrl: 'home.page.html',
+  styleUrls: ['home.page.scss'],
+  standalone: true,
+  imports: [
+    IonHeader, IonToolbar, IonContent,
+    IonSearchbar, IonButtons, IonButton, IonIcon, IonMenuButton, IonAvatar, IonGrid, IonRow,
+    IonCol, IonCard, IonCardHeader, IonCardContent, IonList, IonItem, IonLabel, IonLabel, CommonModule
+  ],
+  schemas: [CUSTOM_ELEMENTS_SCHEMA]
+})
+export class HomePage implements OnInit {
+  // 属性
+  searchQuery: string = ''; // 搜索查询字符串
+  recommendedItems: any[] = []; // 推荐位数据
+
+  userAvatar: string | null = null; // 用户头像
+
+
+
+  constructor(private router: Router) { }
+  ngOnInit(): void {
+    throw new Error('Method not implemented.');
+  }
+  // 导航到首页
+  goToHome() {
+    // 实现导航逻辑,例如使用Angular Router
+  }
+
+  // 处理搜索输入
+  onSearchInput(event: any) {
+    // 处理搜索输入的逻辑,例如过滤显示结果
+    console.log(this.searchQuery);
+  }
+
+  latestPosts = [
+    { title: '新小说发布', content: '用户XX发布了一部新小说《XX传》', avatarUrl: 'assets/images/avatar1.jpg' },
+    { title: '热门讨论', content: '关于小说创作的技巧讨论火热进行中', avatarUrl: 'assets/images/avatar2.jpg' },
+  ];
+
+  popularTopics = [
+    { name: '小说创作大赛', description: '参与大赛,赢取丰厚奖品!' },
+    { name: '智能体互动体验', description: '分享你与智能体的互动故事。' },
+  ];
+
+
+
+  openUserProfile() {
+    // 跳转到用户个人中心页面
+    this.router.navigate(['/profile']);
+  }
+
+  openSettings() {
+    // 跳转到设置页面
+    this.router.navigate(['/settings']);
+  }
+
+  navigateToNovelGeneration() {
+    // 跳转到小说生成页面
+    this.router.navigate(['/tabs/novel']);
+  }
+
+  navigateToCharacterCreation() {
+    // 跳转到智能体创建页面
+    this.router.navigate(['/character-creation']);
+  }
+  goToItem(item: any): void {
+    // 假设item有一个属性可以用来导航,比如item.id
+    // 这里你需要根据你的应用逻辑来调整
+    this.router.navigate(['/some-route', item.id]);
+  }
+  openUserMenu($event: Event): void {
+    // 在这里添加打开用户菜单的逻辑
+    // 例如,你可以切换一个布尔值来控制菜单的显示状态
+    console.log('User menu button clicked', $event);
+  }
+
+}

+ 3 - 0
novel-app/src/app/page-novel/page-novel.component.html

@@ -0,0 +1,3 @@
+<p>
+  page-novel works!
+</p>

+ 0 - 0
novel-app/src/app/page-novel/page-novel.component.scss


+ 22 - 0
novel-app/src/app/page-novel/page-novel.component.spec.ts

@@ -0,0 +1,22 @@
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+
+import { PageNovelComponent } from './page-novel.component';
+
+describe('PageNovelComponent', () => {
+  let component: PageNovelComponent;
+  let fixture: ComponentFixture<PageNovelComponent>;
+
+  beforeEach(waitForAsync(() => {
+    TestBed.configureTestingModule({
+      imports: [PageNovelComponent],
+    }).compileComponents();
+
+    fixture = TestBed.createComponent(PageNovelComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  }));
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 15 - 0
novel-app/src/app/page-novel/page-novel.component.ts

@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+  selector: 'app-page-novel',
+  templateUrl: './page-novel.component.html',
+  styleUrls: ['./page-novel.component.scss'],
+  standalone: true,
+})
+export class PageNovelComponent implements OnInit {
+
+  constructor() { }
+
+  ngOnInit() { }
+
+}

+ 0 - 17
novel-app/src/app/tab1/tab1.page.html

@@ -1,17 +0,0 @@
-<ion-header [translucent]="true">
-  <ion-toolbar>
-    <ion-title>
-      Tab 1
-    </ion-title>
-  </ion-toolbar>
-</ion-header>
-
-<ion-content [fullscreen]="true">
-  <ion-header collapse="condense">
-    <ion-toolbar>
-      <ion-title size="large">Tab 1</ion-title>
-    </ion-toolbar>
-  </ion-header>
-
-  <app-explore-container name="Tab 1 page"></app-explore-container>
-</ion-content>

+ 0 - 16
novel-app/src/app/tab1/tab1.page.ts

@@ -1,16 +0,0 @@
-import { Component } from '@angular/core';
-import { IonHeader, IonToolbar, IonTitle, IonContent } from '@ionic/angular/standalone';
-import { ExploreContainerComponent } from '../explore-container/explore-container.component';
-
-@Component({
-  selector: 'app-tab1',
-  templateUrl: 'tab1.page.html',
-  styleUrls: ['tab1.page.scss'],
-  standalone: true,
-  imports: [IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent]
-})
-export class Tab1Page {
-
-  constructor() { }
-
-}

+ 3 - 3
novel-app/src/app/tabs/tabs.page.html

@@ -1,16 +1,16 @@
 <ion-tabs>
   <ion-tab-bar slot="bottom">
-    <ion-tab-button tab="tab1" href="/tabs/tab1">
+    <ion-tab-button tab="home" (click)="goPage('/tabs/home')">
       <ion-icon aria-hidden="true" name="home"></ion-icon>
       <ion-label>首页</ion-label>
     </ion-tab-button>
 
-    <ion-tab-button tab="tab2" href="/tabs/tab2">
+    <ion-tab-button tab="tab2" (click)="goPage('/tabs/tab2')">
       <ion-icon aria-hidden="true" name="reader"></ion-icon>
       <ion-label>创作</ion-label>
     </ion-tab-button>
 
-    <ion-tab-button tab="tab3" href="/tabs/tab3">
+    <ion-tab-button tab="tab3" (click)="goPage('/tabs/tab3')">
       <ion-icon aria-hidden="true" name="chatbox"></ion-icon>
       <ion-label>论坛</ion-label>
     </ion-tab-button>

+ 9 - 2
novel-app/src/app/tabs/tabs.page.ts

@@ -1,5 +1,6 @@
 import { Component, EnvironmentInjector, inject } from '@angular/core';
-import { IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel } from '@ionic/angular/standalone';
+import { Router } from '@angular/router';
+import { IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel, NavController } from '@ionic/angular/standalone';
 import { addIcons } from 'ionicons';
 import { home, reader, chatbox } from 'ionicons/icons';
 
@@ -13,7 +14,13 @@ import { home, reader, chatbox } from 'ionicons/icons';
 export class TabsPage {
   public environmentInjector = inject(EnvironmentInjector);
 
-  constructor() {
+  constructor(
+    private navCtrl: NavController,
+    private router: Router
+  ) {
     addIcons({ home, reader, chatbox });
   }
+  goPage(page: string) {
+    this.router.navigateByUrl(page)
+  }
 }

+ 9 - 4
novel-app/src/app/tabs/tabs.routes.ts

@@ -7,9 +7,9 @@ export const routes: Routes = [
     component: TabsPage,
     children: [
       {
-        path: 'tab1',
+        path: 'home',
         loadComponent: () =>
-          import('../tab1/tab1.page').then((m) => m.Tab1Page),
+          import('../home/home.page').then((m) => m.HomePage),
       },
       {
         path: 'tab2',
@@ -21,16 +21,21 @@ export const routes: Routes = [
         loadComponent: () =>
           import('../tab3/tab3.page').then((m) => m.Tab3Page),
       },
+      {
+        path: 'novel',
+        loadComponent: () =>
+          import('../page-novel/page-novel.component').then((m) => m.PageNovelComponent),
+      },
       {
         path: '',
-        redirectTo: '/tabs/tab1',
+        redirectTo: '/tabs/home',
         pathMatch: 'full',
       },
     ],
   },
   {
     path: '',
-    redirectTo: '/tabs/tab1',
+    redirectTo: '/tabs/home',
     pathMatch: 'full',
   },
 ];

+ 19 - 0
novel-app/src/main.ts

@@ -5,10 +5,29 @@ import { IonicRouteStrategy, provideIonicAngular } from '@ionic/angular/standalo
 import { routes } from './app/app.routes';
 import { AppComponent } from './app/app.component';
 
+
+// 引用HttpClient方法
+import { provideHttpClient } from '@angular/common/http';
+// 引用移动端授权检测供应器
+import { Diagnostic } from '@awesome-cordova-plugins/diagnostic/ngx';
+// 设置Parse服务属性
+import Parse from "parse";
+Parse.initialize("ncloudmaster");
+Parse.serverURL = "https://server.fmode.cn/parse";
+localStorage.setItem("NOVA_APIG_SERVER", 'aHR0cHMlM0ElMkYlMkZzZXJ2ZXIuZm1vZGUuY24lMkZhcGklMkZhcGlnJTJG')
+
+// 注意:替换Token 根据Token设置Parse服务帐套权限
+Parse.User.become('r:E4KpGvTEto-198080033981732582472')
+
+//'r:E4KpGvTEto-198080033981732582472'
 bootstrapApplication(AppComponent, {
   providers: [
     { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
     provideIonicAngular(),
     provideRouter(routes, withPreloading(PreloadAllModules)),
+    // 添加HttpClient供应器
+    provideHttpClient(),
+    // 添加Diagnostic
+    Diagnostic,
   ],
 });

+ 6 - 2
novel-app/tsconfig.json

@@ -2,6 +2,7 @@
 {
   "compileOnSave": false,
   "compilerOptions": {
+    "allowSyntheticDefaultImports": true,
     "baseUrl": "./",
     "outDir": "./dist/out-tsc",
     "forceConsistentCasingInFileNames": true,
@@ -18,7 +19,10 @@
     "importHelpers": true,
     "target": "es2022",
     "module": "es2020",
-    "lib": ["es2018", "dom"],
+    "lib": [
+      "es2018",
+      "dom"
+    ],
     "useDefineForClassFields": false
   },
   "angularCompilerOptions": {
@@ -27,4 +31,4 @@
     "strictInputAccessModifiers": true,
     "strictTemplates": true
   }
-}
+}

Some files were not shown because too many files changed in this diff