|
|
@@ -1,15 +1,74 @@
|
|
|
-import { Component, OnInit } from '@angular/core';
|
|
|
-
|
|
|
+import { Component} from '@angular/core';
|
|
|
+import { ActivatedRoute, Router } from '@angular/router';
|
|
|
+import { IonButton, IonButtons, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, IonContent, IonHeader, IonIcon, IonTitle, IonToolbar } from '@ionic/angular/standalone';
|
|
|
+import { CloudObject, CloudQuery } from 'src/lib/ncloud';
|
|
|
+import {chevronBack} from 'ionicons/icons';
|
|
|
+addIcons({chevronBack})
|
|
|
+import { addIcons } from 'ionicons';
|
|
|
+import { CommonModule } from '@angular/common';
|
|
|
@Component({
|
|
|
selector: 'app-detail-page',
|
|
|
templateUrl: './detail-page.component.html',
|
|
|
styleUrls: ['./detail-page.component.scss'],
|
|
|
standalone: true,
|
|
|
+ imports:[IonCard,IonContent,IonButton,IonCardContent,IonCardHeader,IonCardSubtitle,IonCardTitle,
|
|
|
+ IonTitle,IonIcon,IonButtons,IonToolbar,IonHeader,CommonModule
|
|
|
+ ],
|
|
|
})
|
|
|
-export class DetailPageComponent implements OnInit {
|
|
|
+export class DetailPageComponent{
|
|
|
+
|
|
|
+
|
|
|
+ constructor(private router: Router,
|
|
|
+ private route:ActivatedRoute
|
|
|
+ ){}
|
|
|
+
|
|
|
+
|
|
|
+ paintList:Array<CloudObject> = []
|
|
|
+ paintnameid: string='name5'; // 用于存储传递的参数
|
|
|
+
|
|
|
+
|
|
|
+ ngOnInit() {
|
|
|
+ console.log('接收到的参数');
|
|
|
+ // 订阅路由参数变化
|
|
|
+ this.route.params.subscribe(params => {
|
|
|
+ // 从路由参数中获取 'id' 参数并赋值给 paintname
|
|
|
+ this.paintnameid = params['id'];
|
|
|
+ console.log('接收到的参数:', this.paintnameid); // 打印接收到的参数以进行调试
|
|
|
+
|
|
|
+ // 根据 paintname 加载相关的绘画数据
|
|
|
+ // 这里可以调用一个方法来加载与 paintname 相关的数据
|
|
|
+ // this.loadPaintData(this.paintname); // 示例:根据 paintname 加载数据
|
|
|
+ });
|
|
|
+
|
|
|
+ // 调用方法加载绘画列表
|
|
|
+ this.loadpaintList(); // 加载绘画列表数据
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ gopage(){
|
|
|
+ this.router.navigate(['/tabs/tab2'])
|
|
|
+ }
|
|
|
+ gopage1(){
|
|
|
+ this.router.navigate(['/tabs/tab2'])
|
|
|
+ }
|
|
|
+
|
|
|
+ async loadpaintList(){
|
|
|
+ let query = new CloudQuery("paint");
|
|
|
+
|
|
|
+ await query.equalTo("nameid",this.paintnameid)
|
|
|
|
|
|
- constructor() { }
|
|
|
+ this.paintList = await query.find()
|
|
|
|
|
|
- ngOnInit() {}
|
|
|
+ if (this.paintList && this.paintList.length > 0) {
|
|
|
+ console.log('有列表');
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ console.log('无列表');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ getPaintDetail(property: string): string {
|
|
|
+ return this.paintList.length > 0 ? this.paintList[0].get(property) : '';
|
|
|
+ }
|
|
|
}
|