GZP il y a 4 mois
Parent
commit
88e2c2afd3

+ 12 - 12
package-lock.json

@@ -21,7 +21,7 @@
         "@capacitor/haptics": "6.0.0",
         "@capacitor/keyboard": "6.0.0",
         "@capacitor/status-bar": "6.0.0",
-        "@ionic/angular": "^8.0.0",
+        "@ionic/angular": "^8.2.5",
         "@types/parse": "^3.0.9",
         "ionicons": "^7.0.0",
         "parse": "^5.1.0",
@@ -3256,11 +3256,11 @@
       "dev": true
     },
     "node_modules/@ionic/angular": {
-      "version": "8.2.0",
-      "resolved": "https://registry.npmmirror.com/@ionic/angular/-/angular-8.2.0.tgz",
-      "integrity": "sha512-47y/J3yqLwzHqe+50QTTIr+9AYbjpu9IR+p33bRbxJhUEaUCl5VKzLwjL94bVi+eTVwr786eu2kK8TRTaPyEBw==",
+      "version": "8.2.5",
+      "resolved": "https://registry.npmmirror.com/@ionic/angular/-/angular-8.2.5.tgz",
+      "integrity": "sha512-vvL5TIN8YbrkW5IZ4TYw2zVa4/+boITe19nElPz1Bu7O15lEEzLe+9RqcIMDERwzgqzsBXLh1CUJk+1TXkMhJg==",
       "dependencies": {
-        "@ionic/core": "8.2.0",
+        "@ionic/core": "8.2.5",
         "ionicons": "^7.0.0",
         "jsonc-parser": "^3.0.0",
         "tslib": "^2.3.0"
@@ -3299,11 +3299,11 @@
       }
     },
     "node_modules/@ionic/core": {
-      "version": "8.2.0",
-      "resolved": "https://registry.npmmirror.com/@ionic/core/-/core-8.2.0.tgz",
-      "integrity": "sha512-+TjHDFluiGYVNiQZOLsETCE+om5FKYbaOKkfmCQYvRGxlg4WtOwaX6YCrpP4MMuerGt36PA196oh/JTcVe9ByA==",
+      "version": "8.2.5",
+      "resolved": "https://registry.npmmirror.com/@ionic/core/-/core-8.2.5.tgz",
+      "integrity": "sha512-NhK5KfP5NL5NITibj8sOUlfI/ARNCF5rBu5HdIEfFe25MJkd0IYBQWjVaESFhSk7aB8pXEP8DIx1AHbT9e3Sog==",
       "dependencies": {
-        "@stencil/core": "^4.17.2",
+        "@stencil/core": "^4.19.2",
         "ionicons": "^7.2.2",
         "tslib": "^2.1.0"
       }
@@ -4677,9 +4677,9 @@
       "dev": true
     },
     "node_modules/@stencil/core": {
-      "version": "4.18.2",
-      "resolved": "https://registry.npmmirror.com/@stencil/core/-/core-4.18.2.tgz",
-      "integrity": "sha512-GLYbzv3Bq/oUbQk3CH09zkjISANccyE5/A1C7+1JZhdnWUx1MRuWQR9/2uzSPR7kF0sdppwzXvArl7VqYCxLOQ==",
+      "version": "4.19.2",
+      "resolved": "https://registry.npmmirror.com/@stencil/core/-/core-4.19.2.tgz",
+      "integrity": "sha512-ZdnbHmHEl8E5vN0GWDtONe5w6j3CrSqqxZM4hNLBPkV/aouWKug7D5/Mi6RazfYO5U4fmHQYLwMz60rHcx0G4g==",
       "bin": {
         "stencil": "bin/stencil"
       },

+ 1 - 1
package.json

@@ -26,7 +26,7 @@
     "@capacitor/haptics": "6.0.0",
     "@capacitor/keyboard": "6.0.0",
     "@capacitor/status-bar": "6.0.0",
-    "@ionic/angular": "^8.0.0",
+    "@ionic/angular": "^8.2.5",
     "@types/parse": "^3.0.9",
     "ionicons": "^7.0.0",
     "parse": "^5.1.0",

BIN
src/assets/aichat.png


BIN
src/assets/register.png


+ 0 - 12
src/luck-16th/luck-16th.module.ts

@@ -1,12 +0,0 @@
-import { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-
-
-
-@NgModule({
-  declarations: [],
-  imports: [
-    CommonModule
-  ]
-})
-export class Luck16thModule { }

+ 2 - 1
src/modules/contacts/add-frends/add-frends.page.ts

@@ -8,6 +8,7 @@ import * as Parse from "parse"
 Parse.initialize("dev")
 
 
+
 @Component({
   selector: 'app-add-frends',
   templateUrl: './add-frends.page.html',
@@ -34,7 +35,7 @@ export class AddFrendsPage implements OnInit {
     // console.log(this.cares)
   }
   goAiChatPage(){
-    this.router.navigate(["/pocket-local/social-interactions/ai-chat-page"],{
+    this.router.navigate([""],{
     })
   }
   goChatPage(spot:Parse.Object){

+ 4 - 1
src/modules/contacts/contacts-routing.module.ts

@@ -7,7 +7,10 @@ const routes: Routes = [
     path: 'add-frends',
     loadChildren: () => import('./add-frends/add-frends.module').then( m => m.AddFrendsPageModule)
   },
-  // {path: 'ai-chat-page', loadChildren: () => import('./ai-chat-page/ai-chat-page.component').then(mod => mod.AiChatPageComponent)},
+  // {
+  //   path: 'ai-chat',
+  //   loadChildren: () => import('./ai-chat/ai-chat.module').then( m => m.AiChatPageModule)
+  // },
   // {path: 'chat-page', loadChildren: () => import('./chat-page/chat-page.component').then(mod => mod.ChatPageComponent)},
 ];
 

+ 19 - 5
src/modules/contacts/friends/friends.page.html

@@ -22,14 +22,27 @@
     <a routerLink="/contacts/add-frends">添加好友</a>
     
   </div>
-  <ion-item-sliding (click)="goChatPage()" *ngFor="let result of results">
+    <ion-item (click)="goAiChatPage()">
+      <ion-avatar slot="start">
+        <img [src]="assets/aichat.png" alt="care Avatar">
+      </ion-avatar>
+      <ion-grid>
+        <ion-row>
+          <h4>Ai小助手</h4>
+        </ion-row>
+        <ion-row>
+          <ion-label>您好,有什么可以帮到您的。</ion-label>
+        </ion-row>
+      </ion-grid>
+    </ion-item>
+  <ion-item-sliding (click)="goChatPage()" *ngFor="let care of cares">
     <ion-item>
       <ion-avatar slot="start">
-        <img [src]="result.avatar" alt="result Avatar">
+        <img [src]="care.careUserImg" alt="care Avatar">
       </ion-avatar>
       <ion-grid>
         <ion-row>
-          <h4>{{result.name}}</h4>
+          <h4>{{care.careUsername}}</h4>
         </ion-row>
         <ion-row>
           <ion-label>您好,有什么可以帮到您的。</ion-label>
@@ -37,8 +50,9 @@
       </ion-grid>
     </ion-item>
     <ion-item-options side="end">
-      <ion-item-option color="danger" (click)="deleteContact(result)">删除</ion-item-option>
-      <ion-item-option color="secondary" (click)="pinContact(result)">置顶</ion-item-option>
+      <ion-item-option color="danger" (click)="deleteContact(care)">删除</ion-item-option>
+      <ion-item-option color="red" (click)="noCareThis(care)">取消关注</ion-item-option>
+      <ion-item-option color="secondary" (click)="pinContact(care)">置顶</ion-item-option>
     </ion-item-options>
   </ion-item-sliding>  
 </div>

+ 55 - 1
src/modules/contacts/friends/friends.page.ts

@@ -1,5 +1,10 @@
 import { Component, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
+import {AlertController } from '@ionic/angular';
+import {SharedService} from 'src/modules/user/service-user/Share.service'
+import * as Parse from "parse"
+(Parse as any).serverURL = "https://web2023.fmode.cn/parse"
+Parse.initialize("dev")
 
 interface Contact {
   name: string;
@@ -14,6 +19,9 @@ interface Contact {
 export class FriendsPage implements OnInit {
 
 
+  userId :any = '';
+  cares :any = [];
+
   contacts: Contact[] = [
     { name: '张三', avatar: 'https://via.placeholder.com/150' },
     { name: '李四', avatar: 'https://via.placeholder.com/150' },
@@ -22,11 +30,57 @@ export class FriendsPage implements OnInit {
   ];
 
   ngOnInit() {
+    this.userId=this.sharedService.getUserId()
+    this.findMyCare()
   }
-  constructor(private router:Router) {
+  constructor(private sharedService: SharedService,private router:Router,private alertCtrl:AlertController){
     
+    this.userId=this.sharedService.getUserId()
+    console.log(this.userId)
+    // findMyCare(this.userId,this.cares)
+    // console.log(this.cares)
+  }
+
+  async findMyCare() {
+    console.log(this.userId)
+    const GzpCare = Parse.Object.extend('GzpCare')
+    const query = new Parse.Query(GzpCare);
+    query.equalTo("userId", this.userId);
+    try {
+      const Cares = await query.find();
+      for (const care of Cares) {
+        this.cares.push({
+          careUserId:care.get("careUserId"),
+          careUsername:care.get('careUsername'),
+          careUserImg:"http://q1.qlogo.cn/g?b=qq&nk="+care.get("careUserId")+"&s=100"
+        }) 
+      }
+    } catch (error) {
+      console.error("查询消息时出错:", error);
+    }
   }
 
+  async noCareThis(care: any) {
+    if (this.userId != null) {
+      const GzpCare = Parse.Object.extend('GzpCare');
+      const query = new Parse.Query(GzpCare);
+      query.equalTo("userId", this.userId);
+      query.equalTo("careUserId", care.careUserId);
+      query.equalTo("careUsername", care.careUsername);
+      const noCare = await query.find();
+      for (const obj of noCare) {
+        await obj.destroy();
+      }
+      const alert =  await this.alertCtrl.create({
+        header: '取关成功',
+        subHeader: '该用户已不是你的关注用户',
+        buttons: ['好的'],
+      });
+      await alert.present();
+      this.cares=[]
+      this.findMyCare()
+    }
+  }
   goChatPage(){
     this.router.navigate(["..//chat-page"],{
     })

+ 5 - 0
src/modules/function/function-routing.module.ts

@@ -4,6 +4,11 @@ import { RouterModule, Routes } from '@angular/router';
 const routes: Routes = [
   {path: 'boos', loadChildren: () => import('./boos/boos.module').then(mod => mod.BoosPageModule)},
   {path: 'employer', loadChildren: () => import('./employer/employer.module').then(mod => mod.EmployerPageModule)},
+  {
+    path: 'trave',
+    loadChildren: () => import('./trave/trave.module').then( m => m.TravePageModule)
+  },
+  // {path: 'trave', loadChildren: () => import('./trave/trave-routing.module').then(mod => mod.TravePageRoutingModule)},
 ];
 
 @NgModule({

+ 1 - 1
src/modules/homepage/home-first/home-first.page.html

@@ -25,7 +25,7 @@
    <ion-card>
     <ion-row class="bar-icon">
       <div class="project-bar-container">
-        <ion-col size="2" class="project-item" *ngFor="let icon of icons">
+        <ion-col size="2" class="project-item" *ngFor="let icon of icons" routerLink="/homepage/trave">
           <img src="{{ icon.imageUrl }}" alt="{{ icon.name }}" class="project-icon" />
           <div class="project-name">{{ icon.name }}</div>
         </ion-col>

+ 1 - 0
src/modules/homepage/homepage-routing.module.ts

@@ -5,6 +5,7 @@ const routes: Routes = [
   {path: 'homeFirst', loadChildren: () => import('./home-first/home-first.module').then(mod => mod.HomeFirstPageModule)},
   {path: 'boos', loadChildren: () => import('../function/boos/boos.module').then(mod => mod.BoosPageModule)},
   {path: 'employer', loadChildren: () => import('../function/employer/employer.module').then(mod => mod.EmployerPageModule)},
+  // {path: 'trave', loadChildren: () => import('../function/trave/trave-routing.module').then(mod => mod.TravePageRoutingModule)},
 ];
 
 @NgModule({

+ 3 - 21
src/modules/user/login/login.page.html

@@ -1,22 +1,4 @@
-<ion-header [translucent]="true">
-  <ion-toolbar>
-    <ion-grid>
-      <ion-row>
-        <ion-col style="display: flex; justify-content: flex-start;">
-          <ion-icon name="chevron-back-outline"></ion-icon>
-        </ion-col>
-        <ion-col style="display: flex; justify-content: center;">
-          登入/注册
-        </ion-col>
-        <ion-col style="display: flex; justify-content: flex-end;">
-          <ion-icon name="notifications-circle-outline"></ion-icon>
-        </ion-col>
-      </ion-row>
-    </ion-grid>
-  </ion-toolbar>
-</ion-header>
-
-<body class="主体区" class="page-color" style="background-size: cover;
+<body class="主体区" style="background-image: url(assets/register.png);background-size: cover;
 background-position: center;">
   <!-- IonicModule + FormsModule实现,默认好看 -->
 <div class="login-modal">
@@ -53,7 +35,7 @@ background-position: center;">
 
 
   <!-- 纯HTML + FormsModule实现,可任意定制样式 -->
-<!-- <ng-container *ngIf="false">
+<ng-container *ngIf="false">
 
     请输入用户名:{{userData.userId}} <br/>
     
@@ -66,5 +48,5 @@ background-position: center;">
     <ion-button expand="block" routerLink="/user/register">注册</ion-button>
     <p style="color: red;">密码错误请确认后点击登入</p>
 
-</ng-container> -->
+</ng-container>
 </body>

+ 2 - 4
src/modules/user/login/login.page.ts

@@ -12,7 +12,6 @@ export class LoginPage {
 
   wrong:any
   constructor(
-    private navCtrl:NavController,
     private userServ:UserService,
     private router:Router,
     private alertCtrl:AlertController
@@ -24,6 +23,8 @@ export class LoginPage {
   }
 
   goBack(){
+    localStorage.removeItem("REDIRECT_URL");
+    localStorage.setItem("REDIRECT_URL", "../");
     let path = localStorage.getItem("REDIRECT_URL") || "../"
     this.router.navigate([path])
   }
@@ -50,7 +51,4 @@ export class LoginPage {
 
     await alert.present();
   }
-  back(){
-    this.navCtrl.back()
-  }
 }

+ 3 - 5
src/modules/user/mine/mine.page.html

@@ -34,10 +34,10 @@
     </ion-card>
   
     <ion-card>
-      <ion-card-header>
-        <ion-card-title style="font-size: 20px;">个人资料</ion-card-title>
+      <ion-list-header>
+        <ion-label>任务提醒</ion-label>
         <ion-button *ngIf="userId" fill="clear" routerLink="/user/edit/info">编辑资料</ion-button>
-      </ion-card-header>
+      </ion-list-header>
     
       <ion-card-content>
         <ion-label>
@@ -55,7 +55,6 @@
     <ion-card>
       <ion-card-header>
         <ion-card-title style="font-size: 20px;">设置</ion-card-title>
-        <ion-button *ngIf="userId" fill="clear" routerLink="/user/edit/info">编辑资料</ion-button>
       </ion-card-header>
     
       <ion-card-content>
@@ -80,5 +79,4 @@
         <ion-col></ion-col>
       </ion-row>
     </ion-card>
-    <ion-button *ngIf="userId" fill="clear" (click)="logout()">登出</ion-button>
 </div>

+ 26 - 24
src/modules/user/mine/mine.page.ts

@@ -1,35 +1,37 @@
-import { Component, OnInit } from '@angular/core';
+import { Component } from '@angular/core';
+import { ToastController } from '@ionic/angular';
+import { UserService } from 'src/modules/user/service-user/user.service';
 import {SharedService} from 'src/modules/user/service-user/Share.service'
-// 由于Parse本身是js库,在ts中加载需要通过 * as Parse转换一下
-import * as Parse from "parse"
+
 @Component({
   selector: 'app-mine',
   templateUrl: './mine.page.html',
   styleUrls: ['./mine.page.scss'],
 })
-export class MinePage implements OnInit {
+export class MinePage {
 
-  userImg:any=''
-  public username:any= 'xiaos'
+  currentUser:any
+  username: string = '';
+  userImg: string = '';
   userId:any=''
-  constructor(private sharedService: SharedService) {
-    this.username=this.sharedService.getUsername()
-    this.userImg=this.sharedService.getUserImg()
-    this.userId=this.sharedService.getUserId()
-  }
-
-  // 由于Parse.User.current()是随着localStorage变化的属性
-  // 为了避免首次复制后用户状态变化,页面不同步,通过get方法实现实时获取
-  // user:Parse.User|undefined
-  async ngOnInit() {
-    console.log(this.userImg)
-    console.log(this.username)
-    //   this.user = await Parse.User.current()
-    //   setInterval(async ()=>{
-    //   this.user = await Parse.User.current()
-    // },1000)
+  constructor(
+    private toastCtrl:ToastController,
+    public userServ:UserService,
+    private sharedService: SharedService,
+  ){
+    this.username = this.sharedService.getUsername();
+    this.userImg = this.sharedService.getUserImg();
+    this.userId = this.sharedService.getUserId();
+    console.log('ok')
   }
-  logout(){
-    Parse.User.logOut();
+  async logout(){
+    localStorage.removeItem("USER_AUTH")
+    let toast = await this.toastCtrl.create({
+      message:"登出成功",
+      position:"top",
+      duration:500
+    })
+    this.sharedService.outLogin();
+    toast.present();
   }
 }

+ 2 - 3
src/modules/user/service-user/Share.service.ts

@@ -1,10 +1,9 @@
 import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-
 @Injectable({
   providedIn: 'root'
 })
-export class SharedService {
+export class SharedService
+ {
   private userId: string = '';
   private username: string = '';
   private userImgScr: string = '';

+ 6 - 6
src/modules/user/service-user/user.service.ts

@@ -30,12 +30,13 @@ export class UserService {
       const results = await query.find();
       userData.username = results.map(user => user.get('username'));
       if (results.length > 0) {
-        let userParse = new Parse.User()
-        userParse.set("username",userData.username)
-        userParse.set("userId",userData.userId)
-        Parse.User.logIn(userData.username, userData.password);
         this.sharedService.isLogin()
         this.sharedService.setUsername(userData.username,userData.userId);
+        const userAuth = {
+          username: u,
+          token: 'exampleToken'
+        };
+        localStorage.setItem('USER_AUTH', JSON.stringify(userAuth));
         return true; // 匹配成功
         
       }else{
@@ -48,5 +49,4 @@ export class UserService {
     }
   }
 }
-export { SharedService };
-
+export { SharedService };

+ 3 - 3
src/modules/user/user-routing.module.ts

@@ -2,9 +2,9 @@ import { NgModule } from '@angular/core';
 import { RouterModule, Routes } from '@angular/router';
 
 const routes: Routes = [
-    {path: 'login', loadChildren: () => import('./login/login.module').then(mod => mod.LoginPageModule)},
-    {path: 'mine', loadChildren: () => import('./mine/mine.module').then(mod => mod.MinePageModule)},
-    {path: 'edit/info', loadChildren: () => import('./edit-info/edit-info.module').then(mod => mod.EditInfoPageModule)},
+  {path: 'login', loadChildren: () => import('./login/login.module').then(mod => mod.LoginPageModule)},
+  {path: 'mine', loadChildren: () => import('./mine/mine.module').then(mod => mod.MinePageModule)},
+  {path: 'edit/info', loadChildren: () => import('./edit-info/edit-info.module').then(mod => mod.EditInfoPageModule)},
   {
     path: 'register',
     loadChildren: () => import('./register/register.module').then( m => m.RegisterPageModule)