|
@@ -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);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|