Browse Source

fit:import delete

0225304 2 days ago
parent
commit
6adc12b723

+ 99 - 98
myapp/src/app/tab1/tab1.page.ts

@@ -46,107 +46,108 @@ export class Tab1Page implements OnInit{
   }
 
    async importDiary(){
-    // 获取当前用户
-    const diaryDataset=[
-  {
-    "Did": 1,
-    "date": "15",
-    "weekday": "周三",
-    "time": "14:30",
-    "content": "今天阳光明媚,去公园散步时看到樱花开了。粉色的花瓣随风飘落,美得像一幅画。坐在长椅上读了一会儿书,感觉心情特别平静。",
-    "weather": "晴",
-    "mood": "😊"
-  },
-  {
-    "Did": 2,
-    "date": "14",
-    "weekday": "周二",
-    "time": "21:15",
-    "content": "项目终于告一段落,加班到很晚但很有成就感。回家的路上买了杯热奶茶犒劳自己,发现常去的那家奶茶店换了新包装,杯子上画着可爱的小兔子。",
-    "weather": "多云",
-    "mood": "😌"
-  },
-  {
-    "Did": 3,
-    "date": "12",
-    "weekday": "周日",
-    "time": "09:45",
-    "content": "周末尝试做了新的菜谱 - 番茄牛腩。虽然炖的时间比预期长,但结果非常美味!下午窝在沙发上看了一部老电影,窗外下着小雨,这种慵懒的周末真是太棒了。",
-    "weather": "小雨",
-    "mood": "🥰"
-  },
-  {
-    "Did": 4,
-    "date": "18",
-    "weekday": "周五",
-    "time": "18:20",
-    "content": "参加了公司的团队建设活动,第一次体验了攀岩项目。虽然爬到一半有些害怕,但在同事的鼓励下成功登顶,突破自我的感觉真好!",
-    "weather": "阴",
-    "mood": "😄"
-  },
-  {
-    "Did": 5,
-    "date": "20",
-    "weekday": "周六",
-    "time": "15:10",
-    "content": "和朋友去了新开的猫咖,有十几只不同品种的猫咪。最喜欢那只胖乎乎的橘猫,它居然在我腿上睡了一下午,治愈了连日的疲惫。",
-    "weather": "晴",
-    "mood": "😺"
-  },
-  {
-    "Did": 6,
-    "date": "22",
-    "weekday": "周一",
-    "time": "08:05",
-    "content": "早起晨跑时发现小区里的桂花开了,空气里都是甜甜的香气。顺手拍了张晨光中的花枝,设为手机壁纸后整天都有好心情。",
-    "weather": "雾",
-    "mood": "🌼"
-  },
-  {
-    "Did": 7,
-    "date": "25",
-    "weekday": "周四",
-    "time": "19:40",
-    "content": "下班路上遇到卖糖炒栗子的小摊,热乎乎的栗子捧在手里,边走边吃仿佛回到学生时代。突然想念大学的林荫道和图书馆了。",
-    "weather": "微风",
-    "mood": "🍂"
-  },
-  {
-    "Did": 8,
-    "date": "28",
-    "weekday": "周日",
-    "time": "22:30",
-    "content": "整理旧物时发现了高中时期的同学录,翻看那些青涩的留言和夸张的贴纸,忍不住笑出声。那些以为忘记的回忆突然都鲜活起来。",
-    "weather": "晴",
-    "mood": "📖"
-  }
-  ]; 
-    const Diary=new CloudObject("Diary");
-    const query=new CloudQuery("Diary");
+    
+  //   // 获取当前用户
+  //   const diaryDataset=[
+  // {
+  //   "Did": 1,
+  //   "date": "15",
+  //   "weekday": "周三",
+  //   "time": "14:30",
+  //   "content": "今天阳光明媚,去公园散步时看到樱花开了。粉色的花瓣随风飘落,美得像一幅画。坐在长椅上读了一会儿书,感觉心情特别平静。",
+  //   "weather": "晴",
+  //   "mood": "😊"
+  // },
+  // {
+  //   "Did": 2,
+  //   "date": "14",
+  //   "weekday": "周二",
+  //   "time": "21:15",
+  //   "content": "项目终于告一段落,加班到很晚但很有成就感。回家的路上买了杯热奶茶犒劳自己,发现常去的那家奶茶店换了新包装,杯子上画着可爱的小兔子。",
+  //   "weather": "多云",
+  //   "mood": "😌"
+  // },
+  // {
+  //   "Did": 3,
+  //   "date": "12",
+  //   "weekday": "周日",
+  //   "time": "09:45",
+  //   "content": "周末尝试做了新的菜谱 - 番茄牛腩。虽然炖的时间比预期长,但结果非常美味!下午窝在沙发上看了一部老电影,窗外下着小雨,这种慵懒的周末真是太棒了。",
+  //   "weather": "小雨",
+  //   "mood": "🥰"
+  // },
+  // {
+  //   "Did": 4,
+  //   "date": "18",
+  //   "weekday": "周五",
+  //   "time": "18:20",
+  //   "content": "参加了公司的团队建设活动,第一次体验了攀岩项目。虽然爬到一半有些害怕,但在同事的鼓励下成功登顶,突破自我的感觉真好!",
+  //   "weather": "阴",
+  //   "mood": "😄"
+  // },
+  // {
+  //   "Did": 5,
+  //   "date": "20",
+  //   "weekday": "周六",
+  //   "time": "15:10",
+  //   "content": "和朋友去了新开的猫咖,有十几只不同品种的猫咪。最喜欢那只胖乎乎的橘猫,它居然在我腿上睡了一下午,治愈了连日的疲惫。",
+  //   "weather": "晴",
+  //   "mood": "😺"
+  // },
+  // {
+  //   "Did": 6,
+  //   "date": "22",
+  //   "weekday": "周一",
+  //   "time": "08:05",
+  //   "content": "早起晨跑时发现小区里的桂花开了,空气里都是甜甜的香气。顺手拍了张晨光中的花枝,设为手机壁纸后整天都有好心情。",
+  //   "weather": "雾",
+  //   "mood": "🌼"
+  // },
+  // {
+  //   "Did": 7,
+  //   "date": "25",
+  //   "weekday": "周四",
+  //   "time": "19:40",
+  //   "content": "下班路上遇到卖糖炒栗子的小摊,热乎乎的栗子捧在手里,边走边吃仿佛回到学生时代。突然想念大学的林荫道和图书馆了。",
+  //   "weather": "微风",
+  //   "mood": "🍂"
+  // },
+  // {
+  //   "Did": 8,
+  //   "date": "28",
+  //   "weekday": "周日",
+  //   "time": "22:30",
+  //   "content": "整理旧物时发现了高中时期的同学录,翻看那些青涩的留言和夸张的贴纸,忍不住笑出声。那些以为忘记的回忆突然都鲜活起来。",
+  //   "weather": "晴",
+  //   "mood": "📖"
+  // }
+  // ]; 
+  //   const Diary=new CloudObject("Diary");
+  //   const query=new CloudQuery("Diary");
 
-    for(const diary of diaryDataset){
-      try{
-        const query=new CloudQuery("Diary");
-        //检查是否已存在相同内容
-        query.equalTo("Did",diary.Did);
-        const existing=await query.first();
+  //   for(const diary of diaryDataset){
+  //     try{
+  //       const query=new CloudQuery("Diary");
+  //       //检查是否已存在相同内容
+  //       query.equalTo("Did",diary.Did);
+  //       const existing=await query.first();
 
-        if(existing){
-          console.log(`日记${diary.content}"已存在,保存跳过`);
-          continue;
-        }
-        //创建新日记
-        const newDiary=new CloudObject("Diary");
-        newDiary.set(diary);
+  //       if(existing){
+  //         console.log(`日记${diary.content}"已存在,保存跳过`);
+  //         continue;
+  //       }
+  //       //创建新日记
+  //       const newDiary=new CloudObject("Diary");
+  //       newDiary.set(diary);
 
-        //保存到数据库
-        await newDiary.save();
-        console.log(`日记${diary.content}保存成功`);
-      }catch(error){
-        console.error(`保存日记${diary.content}时出错`,error);
-      }
-    }
-    console.log("所有日记数据处理完成");
+  //       //保存到数据库
+  //       await newDiary.save();
+  //       console.log(`日记${diary.content}保存成功`);
+  //     }catch(error){
+  //       console.error(`保存日记${diary.content}时出错`,error);
+  //     }
+  //   }
+  //   console.log("所有日记数据处理完成");
   }
 
   async goToEditPage(edit?:string) {

+ 0 - 17
myapp/src/app/tab4/owner-diary/owner-diary-routing.module.ts

@@ -1,17 +0,0 @@
-import { NgModule } from '@angular/core';
-import { Routes, RouterModule } from '@angular/router';
-
-import { OwnerDiaryPage } from './owner-diary.page';
-
-const routes: Routes = [
-  {
-    path: '',
-    component: OwnerDiaryPage
-  }
-];
-
-@NgModule({
-  imports: [RouterModule.forChild(routes)],
-  exports: [RouterModule],
-})
-export class OwnerDiaryPageRoutingModule {}

+ 0 - 20
myapp/src/app/tab4/owner-diary/owner-diary.module.ts

@@ -1,20 +0,0 @@
-import { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { FormsModule } from '@angular/forms';
-
-import { IonicModule } from '@ionic/angular';
-
-import { OwnerDiaryPageRoutingModule } from './owner-diary-routing.module';
-
-import { OwnerDiaryPage } from './owner-diary.page';
-
-@NgModule({
-  imports: [
-    CommonModule,
-    FormsModule,
-    IonicModule,
-    OwnerDiaryPageRoutingModule
-  ],
-  declarations: [OwnerDiaryPage]
-})
-export class OwnerDiaryPageModule {}

+ 0 - 13
myapp/src/app/tab4/owner-diary/owner-diary.page.html

@@ -1,13 +0,0 @@
-<ion-header [translucent]="true">
-  <ion-toolbar>
-    <ion-title>owner-diary</ion-title>
-  </ion-toolbar>
-</ion-header>
-
-<ion-content [fullscreen]="true">
-  <ion-header collapse="condense">
-    <ion-toolbar>
-      <ion-title size="large">owner-diary</ion-title>
-    </ion-toolbar>
-  </ion-header>
-</ion-content>

+ 0 - 17
myapp/src/app/tab4/owner-diary/owner-diary.page.spec.ts

@@ -1,17 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { OwnerDiaryPage } from './owner-diary.page';
-
-describe('OwnerDiaryPage', () => {
-  let component: OwnerDiaryPage;
-  let fixture: ComponentFixture<OwnerDiaryPage>;
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(OwnerDiaryPage);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 16
myapp/src/app/tab4/owner-diary/owner-diary.page.ts

@@ -1,16 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-
-@Component({
-  selector: 'app-owner-diary',
-  templateUrl: './owner-diary.page.html',
-  styleUrls: ['./owner-diary.page.scss'],
-  standalone:false,
-})
-export class OwnerDiaryPage implements OnInit {
-
-  constructor() { }
-
-  ngOnInit() {
-  }
-
-}

+ 0 - 4
myapp/src/app/tab4/tab4-routing.module.ts

@@ -8,10 +8,6 @@ const routes: Routes = [
     path: '',
     component: Tab4Page
   },
-  {
-    path: 'diary',
-    loadChildren: () => import('./owner-diary/owner-diary.module').then( m => m.OwnerDiaryPageModule)
-  },
   {
     path: 'login',
     loadChildren: () => import('./login/login.module').then( m => m.LoginPageModule)

+ 1 - 1
myapp/src/app/tab4/tab4.page.html

@@ -20,7 +20,7 @@
         </div>
         
         <div class="stats-container">
-            <div (click)="goDiary('日记卡片1')" class="stat-item">
+            <div class="stat-item">
                 <div class="stat-number">0</div>
                 <div class="stat-label">日记数量</div>
             </div>

+ 1 - 4
myapp/src/app/tab4/tab4.page.ts

@@ -17,10 +17,7 @@ export class Tab4Page implements OnInit {
   ngOnInit() {
   }
 
-  goDiary(diary?:string){
-
-    this.navCtrl.navigateForward(["tabs","tab4","diary"])
-  }
+  
 
   goLogin(user?:string){
     this.navCtrl.navigateForward(["tabs","tab4","login"])

+ 0 - 0
myapp/src/app/tab4/owner-diary/owner-diary.page.scss → myapp/src/lib/import-data.ts


+ 3 - 7
myapp/src/lib/ncloud.ts

@@ -1,12 +1,5 @@
 // CloudObject.ts
 export class CloudObject {
-    
-    delete() {
-      throw new Error('Method not implemented.');
-    }
-    toJSON(): any {
-      throw new Error('Method not implemented.');
-    }
     className: string;
     id: string | null = null;
     createdAt:any;
@@ -222,6 +215,9 @@ export class CloudQuery {
 
 // CloudUser.ts
 export class CloudUser extends CloudObject {
+    static current(): CloudUser | PromiseLike<CloudUser | null> | null {
+      throw new Error('Method not implemented.');
+    }
     constructor() {
         super("_User"); // 假设用户类在Parse中是"_User"
         // 读取用户缓存信息