ソースを参照

数据库连接获取数据

Breeze 4 ヶ月 前
コミット
5dd1312139

+ 1 - 1
src/app/services/parse.service.ts

@@ -12,7 +12,7 @@ export class ParseService {
 
   private initializeParse() {
     Parse.initialize('dev');
-    Parse.serverURL = 'http://127.0.0.1:4040/apps/Web3De/browser/';
+    Parse.serverURL = 'http://web2023.fmode.cn:9999/parse';
   }
 
   public async queryMovies(): Promise<any[]> {

+ 28 - 14
src/app/tab2/smovies/smovies.page.html

@@ -85,18 +85,32 @@
   </ion-card>
 
 
-  <!-- 电影列表展示部分 -->
-  <ion-card *ngFor="let movie of filteredMovies">
-    <ion-card-header>
-      <ion-card-title>{{ movie.get('name') }}</ion-card-title>
-    </ion-card-header>
-    <ion-card-content>
-      <p>{{ movie.get('type') }}</p>
-      <p>{{ movie.get('releaseDate') | date }}</p>
-      <p>{{ movie.get('duration') }}</p>
-      <p>{{ movie.get('language') }}</p>
-      <p>{{ movie.get('introduction') }}</p>
-      <p>{{ movie.get('rating') }}</p>
-    </ion-card-content>
-  </ion-card>
+
+
+  <ion-content>
+    <!-- <ion-searchbar [(ngModel)]="searchQuery" (ionInput)="fetchPets()"></ion-searchbar>
+    <ion-segment [(ngModel)]="selectedType" (ionChange)="fetchPets()"> -->
+      <!-- <ion-segment-button *ngFor="let type of petTypes" [value]="type">
+        {{ type }}
+      </ion-segment-button> -->
+    <!-- </ion-segment> -->
+    <!-- <ion-button (click)="toggleSort()">Sort by Price</ion-button> -->
+    <ion-list>
+      <ion-card *ngFor="let movie of filteredMovies">
+        <ion-card-header>
+          <ion-card-title>{{ movie.get('name') }}</ion-card-title>
+        </ion-card-header>
+        <ion-card-content>
+          <p>类型:{{ movie.get('type') }}</p>
+          <p>日期:{{ movie.get('releaseDate')}}</p>
+          <p>时长:{{ movie.get('duration') }}</p>
+          <p>语言:{{ movie.get('language') }}</p>
+          <p>介绍:{{ movie.get('introduction') }}</p>
+          <p>评分:{{ movie.get('rating') }}</p>
+        </ion-card-content>
+        <!-- <ion-button fill="clear" routerLink="/study/pet/{{pet.id}}">详情</ion-button> -->
+        <!-- <ion-button *ngIf="pet?.get('user')?.id == user?.id" fill="clear" routerLink="/study/pet/edit/{{pet.id}}">编辑</ion-button> -->
+      </ion-card>
+    </ion-list>
+  </ion-content>
 </ion-content>

+ 12 - 5
src/app/tab2/smovies/smovies.page.ts

@@ -11,11 +11,13 @@ import { ParseService } from 'src/app/services/parse.service';
   styleUrls: ['./smovies.page.scss'],
 })
 export class SMoviesPage implements OnInit {
-
+//
+  user:Parse.User|undefined
   ngOnInit(): void {
-    
+    this.user = Parse.User.current();
+    this.fetchMovies();
   }
-
+//
   constructor(private navCtrl: NavController,private router: Router,private parseService: ParseService) {
     this.fetchMovies();
   }
@@ -52,6 +54,9 @@ export class SMoviesPage implements OnInit {
     // 
     // 
 
+    
+
+
     if (category === '') {
       this.filteredMovies = this.allMovies;
     } else {
@@ -63,9 +68,11 @@ export class SMoviesPage implements OnInit {
   
   filteredMovies: any[] = [];
   allMovies: any[] = [];
-
-
+  searchQuery: string = '';
+  selectedType: string = '';
+  
   async fetchMovies() {
+
     const YJMovies = Parse.Object.extend('YJMovies');
     const query = new Parse.Query(YJMovies);
     this.allMovies = await query.find();