Przeglądaj źródła

add some compentent

GZP 4 miesięcy temu
rodzic
commit
8fab768d35
69 zmienionych plików z 446 dodań i 1600 usunięć
  1. 1 1
      src/app/tabs/tabs.page.html
  2. 17 0
      src/modules/contacts/add-frends/add-frends-routing.module.ts
  3. 20 0
      src/modules/contacts/add-frends/add-frends.module.ts
  4. 61 0
      src/modules/contacts/add-frends/add-frends.page.html
  5. 15 0
      src/modules/contacts/add-frends/add-frends.page.scss
  6. 17 0
      src/modules/contacts/add-frends/add-frends.page.spec.ts
  7. 10 7
      src/modules/contacts/add-frends/add-frends.page.ts
  8. 0 12
      src/modules/contacts/ai-chat-page/ai-chat-page.component.html
  9. 0 104
      src/modules/contacts/ai-chat-page/ai-chat-page.component.scss
  10. 0 21
      src/modules/contacts/ai-chat-page/ai-chat-page.component.spec.ts
  11. 0 117
      src/modules/contacts/ai-chat-page/ai-chat-page.component.ts
  12. 0 95
      src/modules/contacts/ai-chat-page/class-chat-completion.ts
  13. 4 0
      src/modules/contacts/contacts-routing.module.ts
  14. 24 29
      src/modules/contacts/friends/friends.page.html
  15. 10 1
      src/modules/contacts/friends/friends.page.scss
  16. 45 15
      src/modules/contacts/friends/friends.page.ts
  17. 0 104
      src/modules/contacts/my-concern/my-concern.component.html
  18. 0 11
      src/modules/contacts/my-concern/my-concern.component.scss
  19. 0 21
      src/modules/contacts/my-concern/my-concern.component.spec.ts
  20. 1 2
      src/modules/function/employer/employer.page.html
  21. 8 4
      src/modules/function/employer/employer.page.ts
  22. 3 0
      src/modules/homepage/home-first/home-first-routing.module.ts
  23. 23 0
      src/modules/homepage/home-first/home-first.page.html
  24. 2 0
      src/modules/homepage/homepage-routing.module.ts
  25. 0 20
      src/modules/user/guard-auth/auth.guard.ts
  26. 0 15
      src/modules/user/guard-auth/auth.local.guard.ts
  27. 50 27
      src/modules/user/login/login.page.html
  28. 5 0
      src/modules/user/login/login.page.scss
  29. 30 67
      src/modules/user/login/login.page.ts
  30. 9 9
      src/modules/user/mine/mine.page.html
  31. 1 0
      src/modules/user/mine/mine.page.scss
  32. 15 7
      src/modules/user/mine/mine.page.ts
  33. 0 35
      src/modules/user/page-info/page-info.component.html
  34. 0 0
      src/modules/user/page-info/page-info.component.scss
  35. 0 21
      src/modules/user/page-info/page-info.component.spec.ts
  36. 0 31
      src/modules/user/page-info/page-info.component.ts
  37. 0 52
      src/modules/user/page-login/page-login.component.html
  38. 0 10
      src/modules/user/page-login/page-login.component.scss
  39. 0 21
      src/modules/user/page-login/page-login.component.spec.ts
  40. 0 51
      src/modules/user/page-login/page-login.component.ts
  41. 0 36
      src/modules/user/page-register/page-register.component.html
  42. 0 60
      src/modules/user/page-register/page-register.component.scss
  43. 0 21
      src/modules/user/page-register/page-register.component.spec.ts
  44. 17 0
      src/modules/user/register/register-routing.module.ts
  45. 20 0
      src/modules/user/register/register.module.ts
  46. 1 1
      src/modules/user/register/register.page.html
  47. 5 0
      src/modules/user/register/register.page.scss
  48. 17 0
      src/modules/user/register/register.page.spec.ts
  49. 7 6
      src/modules/user/register/register.page.ts
  50. 4 0
      src/modules/user/service-user/user.service.ts
  51. 4 0
      src/modules/user/user-routing.module.ts
  52. 0 20
      src/modules/user2/guard-auth/auth.guard.ts
  53. 0 15
      src/modules/user2/guard-auth/auth.local.guard.ts
  54. 0 35
      src/modules/user2/page-info/page-info.component.html
  55. 0 0
      src/modules/user2/page-info/page-info.component.scss
  56. 0 21
      src/modules/user2/page-info/page-info.component.spec.ts
  57. 0 31
      src/modules/user2/page-info/page-info.component.ts
  58. 0 52
      src/modules/user2/page-login/page-login.component.html
  59. 0 10
      src/modules/user2/page-login/page-login.component.scss
  60. 0 21
      src/modules/user2/page-login/page-login.component.spec.ts
  61. 0 51
      src/modules/user2/page-login/page-login.component.ts
  62. 0 21
      src/modules/user2/page-register/page-register.component.spec.ts
  63. 0 113
      src/modules/user2/page-register/page-register.component.ts
  64. 0 25
      src/modules/user2/service-user/Chat.service.ts
  65. 0 41
      src/modules/user2/service-user/Share.service.ts
  66. 0 16
      src/modules/user2/service-user/user.service.spec.ts
  67. 0 48
      src/modules/user2/service-user/user.service.ts
  68. 0 21
      src/modules/user2/user-routing.module.ts
  69. 0 25
      src/modules/user2/user.module.ts

+ 1 - 1
src/app/tabs/tabs.page.html

@@ -8,7 +8,7 @@
 
     <ion-tab-button tab="tab2" href="/tabs/tab2">
       <ion-icon aria-hidden="true" name="ellipse"></ion-icon>
-      <ion-label>签到</ion-label>
+      <ion-label>通讯录</ion-label>
     </ion-tab-button>
 
     <ion-tab-button tab="tab3" href="/tabs/tab3">

+ 17 - 0
src/modules/contacts/add-frends/add-frends-routing.module.ts

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

+ 20 - 0
src/modules/contacts/add-frends/add-frends.module.ts

@@ -0,0 +1,20 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { AddFrendsPageRoutingModule } from './add-frends-routing.module';
+
+import { AddFrendsPage } from './add-frends.page';
+
+@NgModule({
+  imports: [
+    CommonModule,
+    FormsModule,
+    IonicModule,
+    AddFrendsPageRoutingModule
+  ],
+  declarations: [AddFrendsPage]
+})
+export class AddFrendsPageModule {}

+ 61 - 0
src/modules/contacts/add-frends/add-frends.page.html

@@ -0,0 +1,61 @@
+<ion-header [translucent]="true">
+  <ion-toolbar>
+    <ion-grid>
+      <ion-row>
+        <ion-col style="display: flex; justify-content: flex-start;" (click)="back()">
+          <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-toolbar>
+    <ion-row>
+      <ion-col><ion-searchbar animated="true" placeholder="搜索用户" [(ngModel)]='userInput'></ion-searchbar></ion-col>
+      <ion-col size="auto"><ion-button type="submit" color="primary" (click)="searchCare()">搜索</ion-button></ion-col>
+  </ion-row>
+  </ion-toolbar>
+</ion-header>
+
+<div class="page-color">
+
+    <ion-item *ngIf="!ifSearch">
+      <!-- <ion-avatar slot="start"> -->
+        <ion-card (click)="goAiChatPage()">
+          <img style="width: 100px;"src='assets/aichat.png'/>
+          <ion-label style="text-align: center;">旅行小助手</ion-label>
+        </ion-card>    
+    </ion-item>
+    <ion-item *ngIf="ifSearch">
+      <!-- <ion-avatar slot="start"> -->
+        <ion-card >
+          <img style="width: 100px;"src='{{search.userImg}}'/>
+          <ion-label style="text-align: center;">{{search.username}}</ion-label>
+        </ion-card>
+        <ion-button size="large" style="float: left;" (click)="careThis()">
+          关注<ion-icon slot="icon-only" name="star"></ion-icon>
+        </ion-button>
+    </ion-item>
+    <div *ngIf="!ifSearch">
+      <ion-item *ngFor="let care of cares">
+        <!-- <ion-card *ngIf="care.careUsername == '旅行小助手'" (click)="goAiChatPage()">
+          <img style="width: 100px;"src='assets/aichat.png'/>
+          <ion-label style="text-align: center;">{{care.careUsername}}</ion-label>
+        </ion-card> -->
+        <ion-card>
+          <img style="width: 100px;" src='{{care.careUserImg}}'/>
+          <ion-label style="text-align: center;">{{care.careUsername}}</ion-label>
+          
+        </ion-card> 
+        <ion-button size="large" (click)="noCareThis(care)">
+            <ion-icon slot="icon-only" name="star"></ion-icon>取消关注
+          </ion-button>    
+    </ion-item>
+    </div>
+
+</div>

+ 15 - 0
src/modules/contacts/add-frends/add-frends.page.scss

@@ -0,0 +1,15 @@
+svg {
+    width: 20px;
+    height: 20px;
+    display: inline-block;
+  }
+  
+.infinite-scroll-content {
+    text-align: center;
+    padding: 20px 0;
+  }
+.page-color{
+    background: linear-gradient(220.55deg, #B7DCFF 0%, #ffffff 100%);
+    height: 100vh;
+    overflow: auto;
+}

+ 17 - 0
src/modules/contacts/add-frends/add-frends.page.spec.ts

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

+ 10 - 7
src/modules/contacts/my-concern/my-concern.component.ts → src/modules/contacts/add-frends/add-frends.page.ts

@@ -2,16 +2,18 @@ import { Component, OnInit } from '@angular/core';
 import { AlertController } from '@ionic/angular';
 import {SharedService} from 'src/modules/user/service-user/Share.service'
 import { Router } from '@angular/router';
+import {NavController } from '@ionic/angular';
 import * as Parse from "parse"
 (Parse as any).serverURL = "https://web2023.fmode.cn/parse"
 Parse.initialize("dev")
 
+
 @Component({
-  selector: 'app-my-concern',
-  templateUrl: './my-concern.component.html',
-  styleUrls: ['./my-concern.component.scss']
+  selector: 'app-add-frends',
+  templateUrl: './add-frends.page.html',
+  styleUrls: ['./add-frends.page.scss'],
 })
-export class MyConcernComponent implements OnInit {
+export class AddFrendsPage implements OnInit {
   public userInput:string='';
   cares :any = [];
   search:any={
@@ -25,7 +27,7 @@ export class MyConcernComponent implements OnInit {
   ngOnInit() {
     this.findMyCare()
   }
-  constructor(private sharedService: SharedService,private router:Router,private alertCtrl:AlertController){
+  constructor(private navCtrl:NavController,private sharedService: SharedService,private router:Router,private alertCtrl:AlertController){
     
     this.userId=this.sharedService.getUserId()
     // findMyCare(this.userId,this.cares)
@@ -124,6 +126,7 @@ export class MyConcernComponent implements OnInit {
       this.findMyCare()
     }
   }
-  
+  back(){
+    this.navCtrl.back()
+  }
 }
-

Plik diff jest za duży
+ 0 - 12
src/modules/contacts/ai-chat-page/ai-chat-page.component.html


+ 0 - 104
src/modules/contacts/ai-chat-page/ai-chat-page.component.scss

@@ -1,104 +0,0 @@
-/* ---历史消息--- */
-#service-list .mobile-page pre{
-    white-space: pre-wrap;
-    word-wrap: break-word;
-}
-.mobile-page{
-    margin-bottom: 2.5rem;
-}
-.mobile-page .admin-img, .mobile-page .user-img{
- width: 45px;
- height: 45px;
-}
-i.triangle-admin,i.triangle-user{
- width: 0;
-     height: 0;
-     position: absolute;
-     top: 10px;
- display: inline-block;
-     border-top: 10px solid transparent;
-     border-bottom: 10px solid transparent;
-}
-.mobile-page i.triangle-admin{
- left: 4px;
- border-right: 12px solid rgb(248, 248, 248);
-}
-.mobile-page i.triangle-user{
- right: 4px;
-     border-left: 12px solid #9EEA6A;
-}
-.mobile-page .admin-group, .mobile-page .user-group{
- padding: 6px;
- display: flex;
- display: -webkit-flex;
-}
-.mobile-page .admin-group{
- justify-content: flex-start;
- -webkit-justify-content: flex-start;
-}
-.mobile-page .user-group{
- justify-content: flex-end;
- -webkit-justify-content: flex-end;
-}
-.mobile-page .admin-reply, .mobile-page .user-reply{
- display: inline-block;
- padding: 13px;
- border-radius: 4px;
- background-color: #fff;
- margin:0 15px 12px;
- font-size: .8rem;
- white-space: pre-wrap;
-}
-.mobile-page .admin-reply{
- box-shadow: 0px 0px 2px #ddd;
-}
-.mobile-page .user-reply{
- text-align: left;
- background-color: #9EEA6A;
- box-shadow: 0px 0px 2px #bbb;
-}
-.mobile-page .user-msg, .mobile-page .admin-msg{
- width: 75%;
- position: relative;
-}
-.mobile-page .user-msg{
- text-align: right;
-}
-/*--- 消息输入框--- */
-.footer {
-    padding: .5rem;
-    position: fixed;
-    bottom: 60px;
-    left: 0;
-    right: 0;
-  }
-  .chat-container {
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-    padding: 10px;
-    background-color: #f5f5f5;
-  }
-  
-  .chat-input {
-    flex-grow: 1;
-    padding: 8px;
-    border: none;
-    border-radius: 5px;
-    font-size: 16px;
-    background-color: #fff;
-  }
-  
-  .send-button {
-    margin-left: 10px;
-    padding: 8px 16px;
-    border: none;
-    border-radius: 5px;
-    font-size: 16px;
-    color: #fff;
-    background-color: #007bff;
-    cursor: pointer;
-  }
-  
-  /* 可以根据需要自定义样式,例如调整颜色、边框等 */
-  

+ 0 - 21
src/modules/contacts/ai-chat-page/ai-chat-page.component.spec.ts

@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { AiChatPageComponent } from './ai-chat-page.component';
-
-describe('AiChatPageComponent', () => {
-  let component: AiChatPageComponent;
-  let fixture: ComponentFixture<AiChatPageComponent>;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      declarations: [AiChatPageComponent]
-    });
-    fixture = TestBed.createComponent(AiChatPageComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 117
src/modules/contacts/ai-chat-page/ai-chat-page.component.ts

@@ -1,117 +0,0 @@
-import { Component } from '@angular/core';
-import { TestChatCompletion, TestChatMessage,oldMessage } from './class-chat-completion';
-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")
-
-
-async function historyMessage(senderId: string,receiverId:string,historyMessages:Array<oldMessage>=[]){
-  await findMessagesByUserName(receiverId,senderId,historyMessages,"assistant")
-  await findMessagesByUserName(senderId,receiverId,historyMessages,"user")
-  historyMessages.sort((a, b) => Number(a.createdAt) - Number(b.createdAt));
-}
-
-async function findMessagesByUserName(senderId: string,receiverId:string,historyMessages:Array<oldMessage>=[],role:string) {
-  const Gzpmessage = Parse.Object.extend('Gzpmessage');
-  const query = new Parse.Query(Gzpmessage);
-  query.equalTo("senderId", senderId);
-  query.equalTo("receiverId", receiverId);
-  try {
-    const messages = await query.find();
-    for (const message of messages) {
-      historyMessages.push({
-        role:role,
-        content:message.get("messageContent"),
-        createdAt:message.get("createdAt").getTime()
-      }) 
-    }
-  } catch (error) {
-    console.error("查询消息时出错:", error);
-  }
-  return historyMessage
-}
-
-export function sendToParse(value:string,senderId:string,receiverId:string){
-  const Gzpmessage = Parse.Object.extend('Gzpmessage');
-    const message = new Gzpmessage();
-    message.set('senderId', senderId);
-    message.set('receiverId', receiverId);
-    message.set('messageContent', value);
-    message.set('createdAt', new Date());
-    // 设置其他字段...
-
-    // 保存对象到数据库
-    message.save().then(
-      (result: any) => {
-        console.log('对话消息已保存到数据库:', result);
-      },
-      (error: any) => {
-        console.error('保存对话消息时出错:', error);
-      }
-    );
-}
-@Component({
-  selector: 'app-ai-chat-page',
-  templateUrl: './ai-chat-page.component.html',
-  styleUrls: ['./ai-chat-page.component.scss']
-})
-export class AiChatPageComponent {
-
-  oldMessage:boolean=true;
-  title: string ='小助手';
-  userId: string = '';
-  userImg: string = ''
-  public userInput: string = '';
-  messageList: Array<TestChatMessage> = [];
-  historyMessages:Array<oldMessage>=[]
-  completion: TestChatCompletion;
-
-  constructor(private sharedService: SharedService) {
-    this.messageList.push({
-      role:'assistant',
-      content:"您好,我是您的旅行小助手,请问现在有什么可以帮到您的。",
-    }
-    )
-    this.completion = new TestChatCompletion(this.messageList,this.sharedService);
-    this.userId = this.sharedService.getUserId();
-    this.userImg = this.sharedService.getUserImg();
-    historyMessage(this.userId,'1',this.historyMessages)
-    // findMessagesByUserName('Aichat',this.userId,this.messageList,"assistant")
-    // findMessagesByUserName(this.userId,'Aichat',this.messageList,"user")
-  }
-  send(value: string) {
-    if (this.sharedService.pdlogin()){
-      this.messageList.push({
-            role: 'user',
-            content: value,
-          });
-      sendToParse(value,this.userId,"1")
-      this.completion.createCompletionByStream();
-    }
-    else{
-      if(value=='开始'){
-        this.messageList.push({
-          role:'assistant',
-          content:"请问",
-        }
-        ) 
-        this.sharedService.isLogin()
-      }
-      else{
-        this.messageList.push({
-          role:'user',
-          content:value,
-        }
-        )
-        this.messageList.push({
-          role:'assistant',
-          content:"对不起,您还没有登入,暂时无法使用此功能",
-        }
-        ) 
-      }    
-    }
-    this.userInput='';
-  }
-  
-}

+ 0 - 95
src/modules/contacts/ai-chat-page/class-chat-completion.ts

@@ -1,95 +0,0 @@
-import { sendToParse } from './ai-chat-page.component';
-import {SharedService} from 'src/modules/user/service-user/Share.service'
-
-export interface TestChatMessage{
-        role:string
-        content:string
-}
-export interface oldMessage{
-  role:string
-  content:string
-  createdAt:any
-}
-export class TestChatCompletion{
-  userId: string = '';
-    messageList:Array<TestChatMessage>
-    constructor(messageList:Array<TestChatMessage>,private sharedService: SharedService){
-      this.userId = this.sharedService.getUserId();
-      this.messageList = messageList
-    }
-  async createCompletionByStream() {
-
-    let token = localStorage.getItem("token");
-    let bodyJson = {
-      "token": `Bearer ${token}`,
-      "messages": this.messageList,
-      "model": "gpt-3.5-turbo",
-      "temperature": 0.5,
-      "presence_penalty": 0,
-      "frequency_penalty": 0,
-      "top_p": 1,
-      "stream":true
-    };
-  
-    let response = await fetch("https://test.fmode.cn/api/apig/aigc/gpt/v1/chat/completions", {
-      "headers": {
-        "accept": "text/event-stream",
-        "sec-fetch-dest": "empty",
-        "sec-fetch-mode": "cors",
-        "sec-fetch-site": "same-site"
-      },
-      "referrer": "https://ai.fmode.cn/",
-      "referrerPolicy": "strict-origin-when-cross-origin",
-      "body": JSON.stringify(bodyJson),
-      "method": "POST",
-      "mode": "cors",
-      "credentials": "omit"
-    });
-    let messageAiReply = ""
-    let messageIndex = this.messageList.length
-    let reader = response.body?.getReader();
-    if (!reader) {
-      throw new Error("Failed to get the response reader.");
-    }
-  
-    let decoder = new TextDecoder();
-    let buffer = "";
-    while (true) {
-      let { done, value } = await reader.read();
-      if (done) {
-        break;
-      }
-  
-      buffer += decoder.decode(value);
-  
-      // Split the buffer by newlines to get individual messages
-      let messages = buffer.split("\n");
-      // Process each message
-      for (let i = 0; i < messages.length - 1; i++) {
-        let message = messages[i];
-        let dataText = message.replace("data:\ ","")
-        if(dataText.startsWith("{")){
-          try{
-            let dataJson = JSON.parse(dataText)
-            messageAiReply += dataJson?.choices?.[0]?.delta?.content || ""
-            this.messageList[messageIndex] = {
-              role:"assistant",
-              content:messageAiReply,
-            }
-          }catch(err){}
-        }
-        if(dataText.startsWith("[")){
-          this.messageList[messageIndex] = {
-            role:"assistant",
-            content:messageAiReply,
-          }
-          sendToParse(messageAiReply,'1',this.userId)
-          console.log(messageAiReply)
-          messageAiReply = ""
-          // const filteredMessages = this.messageList.filter(message => message.role == "assistant");
-        }
-        buffer = buffer.slice(message.length + 1);
-      }
-    }
-  }
-}

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

@@ -3,6 +3,10 @@ import { RouterModule, Routes } from '@angular/router';
 
 const routes: Routes = [
   {path: 'friends', loadChildren: () => import('./friends/friends.module').then(mod => mod.FriendsPageModule)},
+  {
+    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: 'chat-page', loadChildren: () => import('./chat-page/chat-page.component').then(mod => mod.ChatPageComponent)},
 ];

+ 24 - 29
src/modules/contacts/friends/friends.page.html

@@ -9,7 +9,7 @@
           通讯录
         </ion-col>
         <ion-col style="display: flex; justify-content: flex-end;">
-          <ion-icon name="notifications-circle-outline"></ion-icon>
+          <ion-icon name="add-circle-outline" (click)="toggleDropdown()"></ion-icon>
         </ion-col>
       </ion-row>
     </ion-grid>
@@ -18,34 +18,29 @@
 
 <div class="page-color">
   <ion-searchbar [debounce]="1000" (ionInput)="handleInput($event)"></ion-searchbar>
-    <ion-item *ngFor="let result of results">
-      <ion-item-sliding (click)="goChatPage()">
-        <ion-item [button]="true">
-          <ion-avatar aria-hidden="true" slot="start">
-            <img class="" src="assets/mychat.png"/>
-          </ion-avatar>
-          <ion-grid>
-            <ion-row>
-              <h4>客服</h4>
-            </ion-row>
-            <ion-row>
-              <ion-label>您好,有什么可以帮到您的。</ion-label>
-            </ion-row>
-          </ion-grid>
-        </ion-item>
-        <ion-item-options slot="end">
-          <ion-item-option color="warning">
-            <ion-icon slot="icon-only" name="pin"></ion-icon>
-          </ion-item-option>
-          <ion-item-option color="tertiary">
-            <ion-icon slot="icon-only" name="share"></ion-icon>
-          </ion-item-option>
-          <ion-item-option color="danger" expandable="true">
-            <ion-icon slot="icon-only" name="trash"></ion-icon>
-          </ion-item-option>
-        </ion-item-options>
-      </ion-item-sliding>
+  <div class="floating-div" *ngIf="showDropdown">
+    <a routerLink="/contacts/add-frends">添加好友</a>
+    
+  </div>
+  <ion-item-sliding (click)="goChatPage()" *ngFor="let result of results">
+    <ion-item>
+      <ion-avatar slot="start">
+        <img [src]="result.avatar" alt="result Avatar">
+      </ion-avatar>
+      <ion-grid>
+        <ion-row>
+          <h4>{{result.name}}</h4>
+        </ion-row>
+        <ion-row>
+          <ion-label>您好,有什么可以帮到您的。</ion-label>
+        </ion-row>
+      </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-options>
+  </ion-item-sliding>  
+</div>
 
 

+ 10 - 1
src/modules/contacts/friends/friends.page.scss

@@ -9,4 +9,13 @@
     border: 1px solid #ccc;
     border-radius: 4px;
   }
-  
+.floating-div {
+    position: fixed;
+    top: 20px;
+    right: 20px;
+    background-color: #f9f9f9;
+    border: 1px solid #ccc;
+    padding: 10px;
+    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+    z-index: 1000;
+}

+ 45 - 15
src/modules/contacts/friends/friends.page.ts

@@ -1,6 +1,10 @@
 import { Component, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
 
+interface Contact {
+  name: string;
+  avatar: string;
+}
 
 @Component({
   selector: 'app-friends',
@@ -10,6 +14,13 @@ import { Router } from '@angular/router';
 export class FriendsPage implements OnInit {
 
 
+  contacts: Contact[] = [
+    { name: '张三', avatar: 'https://via.placeholder.com/150' },
+    { name: '李四', avatar: 'https://via.placeholder.com/150' },
+    { name: '王五', avatar: 'https://via.placeholder.com/150' },
+    { name: '姜皓天', avatar: 'https://ts4.cn.mm.bing.net/th?id=OIP-C.YPJu6C_sxopQW7griUsdjwHaLH&w=204&h=306&c=8&rs=1&qlt=90&o=6&pid=3.1&rm=2' },
+  ];
+
   ngOnInit() {
   }
   constructor(private router:Router) {
@@ -24,22 +35,41 @@ export class FriendsPage implements OnInit {
     this.router.navigate(["..//ai-chat-page"],{
     })
   }
-  public data = [
-    'Amsterdam',
-    'Buenos Aires',
-    'Cairo',
-    'Geneva',
-    'Hong Kong',
-    'Istanbul',
-    'London',
-    'Madrid',
-    'New York',
-    'Panama City',
-  ];
-  public results = [...this.data];
+  // public data = [
+  //   'Amsterdam',
+  //   'Buenos Aires',
+  //   'Cairo',
+  //   'Geneva',
+  //   'Hong Kong',
+  //   'Istanbul',
+  //   'London',
+  //   'Madrid',
+  //   'New York',
+  //   'Panama City',
+  // ];
+  showDropdown = false;
+  public results = [...this.contacts];
 
-  handleInput(event:any) {
+  handleInput(event: any) {
     const query = event.target.value.toLowerCase();
-    this.results = this.data.filter((d) => d.toLowerCase().indexOf(query) > -1);
+    this.results = this.contacts.filter((d) => d.name.toLowerCase().indexOf(query) > -1);
+  }
+
+  deleteContact(contact: Contact): void {
+    const index = this.contacts.indexOf(contact);
+    if (index > -1) {
+      this.contacts.splice(index, 1);
+    }
+  }
+
+  pinContact(contact: Contact): void {
+    const index = this.contacts.indexOf(contact);
+    if (index > -1) {
+      const [removed] = this.contacts.splice(index, 1);
+      this.contacts.unshift(removed);
+    }
+  }
+  toggleDropdown(){
+    this.showDropdown=true
   }
 }

+ 0 - 104
src/modules/contacts/my-concern/my-concern.component.html

@@ -1,104 +0,0 @@
-<ion-header>
-    <ion-toolbar>
-      <ion-title>我的关注</ion-title>
-    </ion-toolbar>
-</ion-header>
-<ion-content>
-  <ion-row>
-    <ion-col><ion-searchbar animated="true" placeholder="搜索用户" [(ngModel)]='userInput'></ion-searchbar></ion-col>
-    <ion-col size="auto"><ion-button type="submit" color="primary" (click)="searchCare()">搜索</ion-button></ion-col>
-  </ion-row>
-  <ion-list>
-    <ion-item *ngIf="!ifSearch">
-      <!-- <ion-avatar slot="start"> -->
-        <ion-card (click)="goAiChatPage()">
-          <img style="width: 100px;"src='assets/aichat.png'/>
-          <ion-label style="text-align: center;">旅行小助手</ion-label>
-        </ion-card>    
-    </ion-item>
-    <ion-item *ngIf="ifSearch">
-      <!-- <ion-avatar slot="start"> -->
-        <ion-card >
-          <img style="width: 100px;"src='{{search.userImg}}'/>
-          <ion-label style="text-align: center;">{{search.username}}</ion-label>
-        </ion-card>
-        <ion-button size="large" style="float: left;" (click)="careThis()">
-          关注<ion-icon slot="icon-only" name="star"></ion-icon>
-        </ion-button>
-    </ion-item>
-    <div *ngIf="!ifSearch">
-      <ion-item *ngFor="let care of cares">
-        <!-- <ion-card *ngIf="care.careUsername == '旅行小助手'" (click)="goAiChatPage()">
-          <img style="width: 100px;"src='assets/aichat.png'/>
-          <ion-label style="text-align: center;">{{care.careUsername}}</ion-label>
-        </ion-card> -->
-        <ion-card>
-          <img style="width: 100px;" src='{{care.careUserImg}}'/>
-          <ion-label style="text-align: center;">{{care.careUsername}}</ion-label>
-          
-        </ion-card> 
-        <ion-button size="large" (click)="noCareThis(care)">
-            <ion-icon slot="icon-only" name="star"></ion-icon>取消关注
-          </ion-button>    
-    </ion-item>
-    </div>
-    
-  </ion-list>
-    
-    <ion-infinite-scroll>
-      <div class="infinite-scroll-content">
-        <svg
-          version="1.1"
-          xmlns="http://www.w3.org/2000/svg"
-          xmlns:xlink="http://www.w3.org/1999/xlink"
-          x="0px"
-          y="0px"
-          viewBox="0 0 100 100"
-          enable-background="new 0 0 100 100"
-          xml:space="preserve"
-        >
-          <circle fill="none" stroke="#1b6dff" stroke-width="4" stroke-miterlimit="10" cx="50" cy="50" r="48" />
-          <line
-            fill="none"
-            stroke-linecap="round"
-            stroke="#1b6dff"
-            stroke-width="4"
-            stroke-miterlimit="10"
-            x1="50"
-            y1="50"
-            x2="85"
-            y2="50.5"
-          >
-            <animateTransform
-              attributeName="transform"
-              dur="2s"
-              type="rotate"
-              from="0 50 50"
-              to="360 50 50"
-              repeatCount="indefinite"
-            />
-          </line>
-          <line
-            fill="none"
-            stroke-linecap="round"
-            stroke="#1b6dff"
-            stroke-width="4"
-            stroke-miterlimit="10"
-            x1="50"
-            y1="50"
-            x2="49.5"
-            y2="74"
-          >
-            <animateTransform
-              attributeName="transform"
-              dur="15s"
-              type="rotate"
-              from="0 50 50"
-              to="360 50 50"
-              repeatCount="indefinite"
-            />
-          </line>
-        </svg>
-      </div>
-    </ion-infinite-scroll>
-  </ion-content>

+ 0 - 11
src/modules/contacts/my-concern/my-concern.component.scss

@@ -1,11 +0,0 @@
-svg {
-    width: 20px;
-    height: 20px;
-    display: inline-block;
-  }
-  
-  .infinite-scroll-content {
-    text-align: center;
-    padding: 20px 0;
-  }
-  

+ 0 - 21
src/modules/contacts/my-concern/my-concern.component.spec.ts

@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { MyConcernComponent } from './my-concern.component';
-
-describe('MyConcernComponent', () => {
-  let component: MyConcernComponent;
-  let fixture: ComponentFixture<MyConcernComponent>;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      declarations: [MyConcernComponent]
-    });
-    fixture = TestBed.createComponent(MyConcernComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 1 - 2
src/modules/function/employer/employer.page.html

@@ -2,7 +2,7 @@
   <ion-toolbar>
     <ion-grid>
       <ion-row>
-        <ion-col style="display: flex; justify-content: flex-start;">
+        <ion-col style="display: flex; justify-content: flex-start;" (click)="back()">
           <ion-icon name="chevron-back-outline"></ion-icon>
         </ion-col>
         <ion-col style="display: flex; justify-content: center;">
@@ -37,5 +37,4 @@
       </ion-row>
     </ion-list>
   </ion-card>
-  <ion-button routerLink="/function/boos">boos</ion-button>
 </div>

+ 8 - 4
src/modules/function/employer/employer.page.ts

@@ -1,4 +1,5 @@
 import { Component, OnInit } from '@angular/core';
+import {NavController } from '@ionic/angular';
 
 @Component({
   selector: 'app-employer',
@@ -6,10 +7,13 @@ import { Component, OnInit } from '@angular/core';
   styleUrls: ['./employer.page.scss'],
 })
 export class EmployerPage implements OnInit {
-
-  constructor() { }
-
-  ngOnInit() {
+  constructor(private navCtrl:NavController,) {
+    
   }
 
+ ngOnInit() {
+ }
+ back(){
+   this.navCtrl.back()
+ }
 }

+ 3 - 0
src/modules/homepage/home-first/home-first-routing.module.ts

@@ -3,7 +3,10 @@ import { Routes, RouterModule } from '@angular/router';
 
 import { HomeFirstPage } from './home-first.page';
 
+
 const routes: Routes = [
+  {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: '',
     component: HomeFirstPage

+ 23 - 0
src/modules/homepage/home-first/home-first.page.html

@@ -53,6 +53,29 @@
     </ion-list>
   </ion-card>
   
+  <ion-card>
+    <ion-grid>
+      <ion-row>
+        <ion-col>
+          <ion-card>
+            <ion-list-header>
+                <ion-label>员工打卡</ion-label>
+            </ion-list-header>
+            <ion-button style="display: flex; justify-content: center;" routerLink="/homepage/employer">点击进入</ion-button>
+          </ion-card>      
+        </ion-col>
+        <ion-col>
+          <ion-card>
+            <ion-list-header>
+               <ion-label>Boos</ion-label>
+           </ion-list-header>
+           <ion-button style="display: flex; justify-content: center;" routerLink="/homepage/boos">点击进入</ion-button>
+          </ion-card>
+        </ion-col>
+      </ion-row>
+    </ion-grid>
+  </ion-card>
+
   <ion-card>
     <ion-grid>
         <ion-row>

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

@@ -3,6 +3,8 @@ import { RouterModule, Routes } from '@angular/router';
 
 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)},
 ];
 
 @NgModule({

+ 0 - 20
src/modules/user/guard-auth/auth.guard.ts

@@ -1,20 +0,0 @@
-import { CanActivateFn } from '@angular/router';
-import * as Parse from "parse";
-
-export const authGuard: CanActivateFn = (route, state) => {
-  // 检查当前本地存储中,是否有用户验证信息
-  let userAuth = Parse.User.current();
-  if(userAuth?.id){
-    return true;
-  }else{
-    // 暂时存储登陆前用户所在页面
-    let REDIRECT_URL = location.pathname;
-    localStorage.setItem("REDIRECT_URL",REDIRECT_URL);
-    if (location.pathname?.startsWith("/s1234567")){
-        location.href = "/s1234567/user/login"
-    }else{
-        location.href = "/user/login"
-    }
-    return false;
-  }
-};

+ 0 - 15
src/modules/user/guard-auth/auth.local.guard.ts

@@ -1,15 +0,0 @@
-import { CanActivateFn } from '@angular/router';
-
-export const authLocalGuard: CanActivateFn = (route, state) => {
-  // 检查当前本地存储中,是否有用户验证信息
-  let userAuth = localStorage.getItem("USER_AUTH")
-  if(userAuth){
-    return true;
-  }else{
-    // 暂时存储登陆前用户所在页面
-    let REDIRECT_URL = location.pathname;
-    localStorage.setItem("REDIRECT_URL",REDIRECT_URL);
-    location.href = "/user/login"
-    return false;
-  }
-};

+ 50 - 27
src/modules/user/login/login.page.html

@@ -16,32 +16,55 @@
   </ion-toolbar>
 </ion-header>
 
-<ion-content [fullscreen]="true">
-  <ion-card>
-    <ion-card-header>
-      <ion-card-title>登录/注册</ion-card-title>
-    </ion-card-header>
-  
-    <ion-card-content>
+<body class="主体区" class="page-color" style="background-size: cover;
+background-position: center;">
+  <!-- IonicModule + FormsModule实现,默认好看 -->
+<div class="login-modal">
+    <ion-card>
+        <ion-card-header>
+        <ion-card-title>登录</ion-card-title>
+        <ion-card-subtitle>该页面需登陆可继续使用</ion-card-subtitle>
+        </ion-card-header>
+    
+        <ion-card-content>
+        <ion-input [(ngModel)]="userData.userId"
+            label="QQ号码" 
+            labelPlacement="floating" 
+            [counter]="true" 
+            maxlength="20">
+        </ion-input>
 
-      <ion-list [inset]="true">
-        <ion-item>
-          <ion-input [(ngModel)]="username" label="账号" placeholder="请输入用户名"></ion-input>
-        </ion-item>
-        <ion-item>
-          <ion-input [(ngModel)]="password" label="密码" type="password" placeholder="请输入密码"></ion-input>
-        </ion-item>
-      </ion-list>
-      
-      <ion-row>
-        <ion-col></ion-col>
-        <ion-col><ion-button (click)="login()" fill="clear">登录</ion-button></ion-col>
-        <ion-col><ion-button (click)="register()" fill="clear">注册</ion-button></ion-col>
-        <ion-col></ion-col>
-      </ion-row>
-    </ion-card-content>
-  </ion-card>
+        <ion-input [(ngModel)]="userData.password"
+            label="密码"
+            labelPlacement="floating"
+            [counter]="true"
+            maxlength="20"
+        ></ion-input>
+            
+        <p style="color: red;">{{wrong}}</p>
+
+        </ion-card-content>
+    
+        <ion-button expand="block" (click)="login()">登录</ion-button>
+        <ion-button expand="block" routerLink="/user/register">注册</ion-button>
+        <ion-button expand="block" fill="clear" (click)="goBack()">返回</ion-button>
+    </ion-card>
+</div>
+
+
+  <!-- 纯HTML + FormsModule实现,可任意定制样式 -->
+<!-- <ng-container *ngIf="false">
+
+    请输入用户名:{{userData.userId}} <br/>
+    
+    <input [(ngModel)]="userData.userId" type="text"/><br/>
+    
+    请输入密码:{{userData.password}}<br/>
+    <input [(ngModel)]="userData.password" type="password"/><br/>
+    
+    <button (click)="login()">登录</button>
+    <ion-button expand="block" routerLink="/user/register">注册</ion-button>
+    <p style="color: red;">密码错误请确认后点击登入</p>
 
-  <!-- 新增路由返回逻辑,执行back函数 -->
-  <ion-button expand="block" (click)="back()">返回</ion-button>
-</ion-content>
+</ng-container> -->
+</body>

+ 5 - 0
src/modules/user/login/login.page.scss

@@ -0,0 +1,5 @@
+.page-color{
+    background: linear-gradient(220.55deg, #B7DCFF 0%, #ffffff 100%);
+    height: 100vh;
+    overflow: auto;
+}

+ 30 - 67
src/modules/user/login/login.page.ts

@@ -1,92 +1,55 @@
-import { Component, OnInit } from '@angular/core';
+import { Component } from '@angular/core';
+import { Router } from '@angular/router';
 import { AlertController, NavController } from '@ionic/angular';
-import * as Parse from "parse"
+import { UserService } from '../service-user/user.service';
 // 引用Router服务
 @Component({
   selector: 'app-login',
   templateUrl: './login.page.html',
   styleUrls: ['./login.page.scss'],
 })
-export class LoginPage implements OnInit {
+export class LoginPage {
 
-  username:string = ""
-  password:string = ""
+  wrong:any
   constructor(
-    // 新增:Router服务,用于路由跳转
     private navCtrl:NavController,
-    private alertController:AlertController
-  ) { }
-
-  ngOnInit() {
+    private userServ:UserService,
+    private router:Router,
+    private alertCtrl:AlertController
+    ){}
+  userData:any = {
+    username:"",
+    password:"",
+    userId:""
   }
 
+  goBack(){
+    let path = localStorage.getItem("REDIRECT_URL") || "../"
+    this.router.navigate([path])
+  }
   async login(){
-    let user
-    try {
-      user = await Parse.User.logIn(this.username,this.password)
-    } catch (error:any) {
-      let message:string = ""
-      // 新增提示词详情,根据Parse.User.login方法返回的不同英文提示词,增加对应的中文内容转换
-      if(error?.message.indexOf("is required")>-1){
-        message = "必须输入账号或邮箱"
+    try{
+      let isLogin = await this.userServ.loginUserPassword(this.userData)
+      if(isLogin){
+        this.goBack()
       }
-      if(error?.message.indexOf("Invalid username")>-1){
-        message = "账号或密码错误,请检查"
+      else{
+        this.wrong="密码错误请确认后点击登入"
+        this.alertError()
       }
-      this.presentAlert({
-        header:"登录失败",
-        subHeader:"状态码:"+error.code,
-        message:message || error.message
-      })
-    }
-    console.log(user)
-    if(user?.id){
-      this.navCtrl.back()
+    }catch(err){
+      console.log(err)
     }
   }
-  async register(){
-    let user = new Parse.User()
-    user.set("username",this.username)
-    user.set("password",this.password)
-    try {
-        let result = await user.signUp();
-        console.log(result)
-        if(result?.id){
-          this.navCtrl.back()
-        }
-        // Hooray! Let them use the app now.
-    } catch (error:any) {
-        // 新增提示词详情,根据Parse.User.signUp方法返回的不同英文提示词,增加对应的中文内容转换
-        let message:string = ""
-        if(error?.message.indexOf("already exists")>-1){
-          message = "该账号已存在请修改后重试"
-        }
-        if(error?.message.indexOf("empty")>-1){
-          message = "账号不能为空请输入后重试"
-        }
-        this.presentAlert({
-          header:"注册失败",
-          subHeader:"状态码:"+error.code,
-          message:message || error.message
-        })
-    }
-  }
-
-  async presentAlert(options:{header:string,subHeader:string,message:string}) {
-    const alert = await this.alertController.create({
-      header: options?.header,
-      subHeader: options?.subHeader,
-      message: options?.message,
+  async alertError(){
+    const alert = await this.alertCtrl.create({
+      header: '登陆失败',
+      subHeader: '请检查用户名密码',
       buttons: ['好的'],
     });
 
     await alert.present();
   }
-
-  /**
-   * 返回上级页面函数
-   * @desc
-   */
   back(){
     this.navCtrl.back()
   }

+ 9 - 9
src/modules/user/mine/mine.page.html

@@ -20,13 +20,13 @@
       <ion-card-header>
         <ion-item>
           <ion-avatar slot="start">
-            <img src='{{"https://ionicframework.com/docs/img/demos/avatar.svg"}}' />
+            <img src='{{userImg}}' />
           </ion-avatar>
           <ion-label>
             <ion-card-content>
-              <ion-card-title>{{user?.get("username") || '未登录'}}</ion-card-title>
-              <ion-card-subtitle *ngIf="!user?.id">请您登陆后继续使用</ion-card-subtitle>
-              <ion-card-subtitle *ngIf="user?.id">{{user?.get("name")}}-{{user?.get("gender")}}</ion-card-subtitle>
+              <ion-card-title>{{username || '未登录'}}</ion-card-title>
+              <ion-card-subtitle *ngIf="!username">请您登陆后继续使用</ion-card-subtitle>
+              <ion-card-subtitle *ngIf="username">{{userId}}-{{userId}}</ion-card-subtitle>
           </ion-card-content>
           </ion-label>
         </ion-item>
@@ -36,7 +36,7 @@
     <ion-card>
       <ion-card-header>
         <ion-card-title style="font-size: 20px;">个人资料</ion-card-title>
-        <ion-button *ngIf="user?.id" fill="clear" routerLink="/user/edit/info">编辑资料</ion-button>
+        <ion-button *ngIf="userId" fill="clear" routerLink="/user/edit/info">编辑资料</ion-button>
       </ion-card-header>
     
       <ion-card-content>
@@ -55,7 +55,7 @@
     <ion-card>
       <ion-card-header>
         <ion-card-title style="font-size: 20px;">设置</ion-card-title>
-        <ion-button *ngIf="user?.id" fill="clear" routerLink="/user/edit/info">编辑资料</ion-button>
+        <ion-button *ngIf="userId" fill="clear" routerLink="/user/edit/info">编辑资料</ion-button>
       </ion-card-header>
     
       <ion-card-content>
@@ -74,11 +74,11 @@
       <ion-row>
         <ion-col></ion-col>
         <ion-col size="6">
-          <ion-button style="display: flex; justify-content: center;" *ngIf="!user?.id" routerLink="/user/login">登录</ion-button>
-          <ion-button style="display: flex; justify-content: center;" *ngIf="user?.id" (click)="logout()">登出</ion-button>
+          <ion-button style="display: flex; justify-content: center;" *ngIf="!userId" routerLink="/user/login">登录</ion-button>
+          <ion-button style="display: flex; justify-content: center;" *ngIf="userId" (click)="logout()">登出</ion-button>
         </ion-col>
         <ion-col></ion-col>
       </ion-row>
     </ion-card>
-    <ion-button *ngIf="user?.id" fill="clear" (click)="logout()">登出</ion-button>
+    <ion-button *ngIf="userId" fill="clear" (click)="logout()">登出</ion-button>
 </div>

+ 1 - 0
src/modules/user/mine/mine.page.scss

@@ -1,4 +1,5 @@
 .page-color{
     background: linear-gradient(220.55deg, #B7DCFF 0%, #ffffff 100%);
     height: 100vh;
+    overflow: auto;
 }

+ 15 - 7
src/modules/user/mine/mine.page.ts

@@ -1,4 +1,5 @@
 import { Component, OnInit } from '@angular/core';
+import {SharedService} from 'src/modules/user/service-user/Share.service'
 // 由于Parse本身是js库,在ts中加载需要通过 * as Parse转换一下
 import * as Parse from "parse"
 @Component({
@@ -8,18 +9,25 @@ import * as Parse from "parse"
 })
 export class MinePage implements OnInit {
 
-  constructor() {
-   
+  userImg:any=''
+  public username:any= 'xiaos'
+  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
+  // user:Parse.User|undefined
   async ngOnInit() {
-      this.user = await Parse.User.current()
-      setInterval(async ()=>{
-      this.user = await Parse.User.current()
-    },1000)
+    console.log(this.userImg)
+    console.log(this.username)
+    //   this.user = await Parse.User.current()
+    //   setInterval(async ()=>{
+    //   this.user = await Parse.User.current()
+    // },1000)
   }
   logout(){
     Parse.User.logOut();

+ 0 - 35
src/modules/user/page-info/page-info.component.html

@@ -1,35 +0,0 @@
-
-<ion-header>
-    <ion-toolbar>
-      <ion-title>编辑资料</ion-title>
-    </ion-toolbar>
-  </ion-header>
-  <ion-content color="light">
-    <ion-card>
-        <img alt="User Background" src="https://imgsource.huashi6.com/images/ai/2023/9/27/20_326650.jpg?e=1695819140&token=qFZErZx7WS1v5B4rgQE2KLMHlYHVNaCuXeaA9OLD:XUO7gAGwc99tTXYGsF0R5itDsTg=" />
-      
-        <ion-card-content>
-            <ion-input [(ngModel)]="userInfo.nickname" label="用户昵称" labelPlacement="floating" [counter]="true" maxlength="20">
-            </ion-input>
-            <ion-input [(ngModel)]="userInfo.desc" label="个性签名" labelPlacement="floating" [counter]="true" maxlength="50">
-            </ion-input>
-        </ion-card-content>
-      </ion-card>
-
-      <ion-list [inset]="true">
-        <ion-item>
-            <ion-select [(ngModel)]="userInfo.gender" label="性别" placeholder="您的性别">
-              <ion-select-option value="男">男</ion-select-option>
-              <ion-select-option value="女">女</ion-select-option>
-              <ion-select-option value="未知">未知</ion-select-option>
-            </ion-select>
-          </ion-item>
-      </ion-list>
-
-    <ion-list [inset]="true">
-        <ion-button expand="block" (click)="saveInfo()">保存</ion-button>
-        <ion-button expand="block" fill="clear" routerLink="/project/mine">返回</ion-button>
-    </ion-list>
-  </ion-content>
-
-

+ 0 - 0
src/modules/user/page-info/page-info.component.scss


+ 0 - 21
src/modules/user/page-info/page-info.component.spec.ts

@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { PageInfoComponent } from './page-info.component';
-
-describe('PageInfoComponent', () => {
-  let component: PageInfoComponent;
-  let fixture: ComponentFixture<PageInfoComponent>;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      declarations: [PageInfoComponent]
-    });
-    fixture = TestBed.createComponent(PageInfoComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 31
src/modules/user/page-info/page-info.component.ts

@@ -1,31 +0,0 @@
-import { Component } from '@angular/core';
-import { Router } from '@angular/router';
-import { UserService } from '../service-user/user.service';
-import * as Parse from "parse";
-
-@Component({
-  selector: 'app-page-info',
-  templateUrl: './page-info.component.html',
-  styleUrls: ['./page-info.component.scss']
-})
-export class PageInfoComponent {
-  constructor(
-    public userServ:UserService,
-    private router:Router
-  ){
-    this.userInfo = Parse.User.current()?.toJSON();
-  }
-  userInfo:any = {}
-  async saveInfo(){
-    let user = Parse.User.current();
-    console.log(this.userInfo)
-    delete this.userInfo.objectId
-    delete this.userInfo.username
-    delete this.userInfo.sessionToken
-    delete this.userInfo.updatedAt
- 
-    user?.set(this.userInfo)
-    await user?.save()
-    this.router.navigate(["/project/mine"])
-  }
-}

+ 0 - 52
src/modules/user/page-login/page-login.component.html

@@ -1,52 +0,0 @@
-<body class="主体区" style="background-image: url(assets/register.png);background-size: cover;
-background-position: center;">
-  <!-- IonicModule + FormsModule实现,默认好看 -->
-<div class="login-modal">
-    <ion-card>
-        <ion-card-header>
-        <ion-card-title>登录</ion-card-title>
-        <ion-card-subtitle>该页面需登陆可继续使用</ion-card-subtitle>
-        </ion-card-header>
-    
-        <ion-card-content>
-        <ion-input [(ngModel)]="userData.userId"
-            label="QQ号码" 
-            labelPlacement="floating" 
-            [counter]="true" 
-            maxlength="20">
-        </ion-input>
-
-        <ion-input [(ngModel)]="userData.password"
-            label="密码"
-            labelPlacement="floating"
-            [counter]="true"
-            maxlength="20"
-        ></ion-input>
-            
-        <p style="color: red;">{{wrong}}</p>
-
-        </ion-card-content>
-    
-        <ion-button expand="block" (click)="login()">登录</ion-button>
-        <ion-button expand="block" routerLink="/user/register">注册</ion-button>
-        <ion-button expand="block" fill="clear" (click)="goBack()">返回</ion-button>
-    </ion-card>
-</div>
-
-
-  <!-- 纯HTML + FormsModule实现,可任意定制样式 -->
-<ng-container *ngIf="false">
-
-    请输入用户名:{{userData.userId}} <br/>
-    
-    <input [(ngModel)]="userData.userId" type="text"/><br/>
-    
-    请输入密码:{{userData.password}}<br/>
-    <input [(ngModel)]="userData.password" type="password"/><br/>
-    
-    <button (click)="login()">登录</button>
-    <ion-button expand="block" routerLink="/user/register">注册</ion-button>
-    <p style="color: red;">密码错误请确认后点击登入</p>
-
-</ng-container>
-</body>

+ 0 - 10
src/modules/user/page-login/page-login.component.scss

@@ -1,10 +0,0 @@
-.login-modal{
-    height:100vh;
-    width: 100vw;
-    display: flex;
-    flex-direction: column;
-    vertical-align: middle;
-    justify-content: center;
-}
-
-

+ 0 - 21
src/modules/user/page-login/page-login.component.spec.ts

@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { PageLoginComponent } from './page-login.component';
-
-describe('PageLoginComponent', () => {
-  let component: PageLoginComponent;
-  let fixture: ComponentFixture<PageLoginComponent>;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      declarations: [PageLoginComponent]
-    });
-    fixture = TestBed.createComponent(PageLoginComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 51
src/modules/user/page-login/page-login.component.ts

@@ -1,51 +0,0 @@
-import { Component } from '@angular/core';
-import { Router } from '@angular/router';
-import { AlertController } from '@ionic/angular';
-import { UserService } from '../service-user/user.service';
-
-@Component({
-  selector: 'app-page-login',
-  templateUrl: './page-login.component.html',
-  styleUrls: ['./page-login.component.scss']
-})
-export class PageLoginComponent {
-  wrong:any
-  constructor(
-    private userServ:UserService,
-    private router:Router,
-    private alertCtrl:AlertController
-    ){}
-  userData:any = {
-    username:"",
-    password:"",
-    userId:""
-  }
-
-  goBack(){
-    let path = localStorage.getItem("REDIRECT_URL") || "../"
-    this.router.navigate([path])
-  }
-  async login(){
-    try{
-      let isLogin = await this.userServ.loginUserPassword(this.userData)
-      if(isLogin){
-        this.goBack()
-      }
-      else{
-        this.wrong="密码错误请确认后点击登入"
-        this.alertError()
-      }
-    }catch(err){
-      console.log(err)
-    }
-  }
-  async alertError(){
-    const alert = await this.alertCtrl.create({
-      header: '登陆失败',
-      subHeader: '请检查用户名密码',
-      buttons: ['好的'],
-    });
-
-    await alert.present();
-  }
-}

+ 0 - 36
src/modules/user/page-register/page-register.component.html

@@ -1,36 +0,0 @@
-<body class="主体区" style="background-image: url(assets/register.png);background-size: cover;
-background-position: center;">
-    <div class="注册框">
-        <form action="">
-            <h2>注册</h2>
-            <div>
-                <span>昵称</span>
-                <input type="text" class="text" [(ngModel)]="userData.username" placeholder="请输入昵称" [ngModelOptions]="{standalone: true}">
-            </div>
-            <div>
-                <span>QQ号码</span>
-                <input type="number" class="text" [(ngModel)]="userData.userId" placeholder="(用于用户头像)" [ngModelOptions]="{standalone: true}">
-            </div>
-            <div>
-                <span class="sex">性别</span>
-                <input type="radio" name="sex" [(ngModel)]="userData.sex" [ngModelOptions]="{standalone: true}" value="男">男
-                <input type="radio" name="sex" [(ngModel)]="userData.sex" [ngModelOptions]="{standalone: true}" value="女">女
-            </div>            
-            <div>
-                <span>密码</span>
-                <input type="password" class="text" [(ngModel)]="userData.password" placeholder="请输入密码" [ngModelOptions]="{standalone: true}">
-            </div>
-            <div>
-                <span>再次确认密码</span>
-                <input type="password" class="text" [(ngModel)]="userData.repassword" placeholder="请再次确认密码" [ngModelOptions]="{standalone: true}">
-            </div>
-            <div>
-                <input type="button" (click)="registerUser()" class="提交" value="注册">
-            </div>
-            {{wrong}}
-            <div>
-                <input routerLink="/user/login" type="button" class="提交" value="返回登录">
-            </div>
-        </form>
-    </div>
-</body>

+ 0 - 60
src/modules/user/page-register/page-register.component.scss

@@ -1,60 +0,0 @@
-.主体区 {
-    padding: 30px;
-    display: flex;
-    align-items: center;
-    flex-direction: column;
-}
- 
-.注册框 {
-    width: 360px;
-    height: 500px;
-    padding-top: 50px;
-    padding-bottom: 50px;
- 
-    border-radius: 10px;
-    background-color: rgba(255,255,255,0.7);
-}
- 
-form {
-    height: 100%;
- 
-    display: flex;
-    align-items: center;
-    flex-direction: column;
-    justify-content: space-between;
-}
- 
-h2 {
-    font-size: 20px;
-}
- 
-span {
-    display: inline-block;
-    width: 120px;
-    text-align: left;
-}
-.sex {
-    width: 225px;
-}
- 
-.hobby {
-    width: 125px;
-}
- 
-.提交 {
-    width: 290px;
-    height: 30px;
- 
-    background: rgba(77,132,226);
-    color: white;
-    border: none;
-}
- 
-.text {
-    width: 165px;
-    height: 25px;
-    padding-left: 10px;
- 
-    border-radius: 5px;
-    border: none;
-}

+ 0 - 21
src/modules/user/page-register/page-register.component.spec.ts

@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { PageRegisterComponent } from './page-register.component';
-
-describe('PageRegisterComponent', () => {
-  let component: PageRegisterComponent;
-  let fixture: ComponentFixture<PageRegisterComponent>;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      declarations: [PageRegisterComponent]
-    });
-    fixture = TestBed.createComponent(PageRegisterComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 17 - 0
src/modules/user/register/register-routing.module.ts

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

+ 20 - 0
src/modules/user/register/register.module.ts

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

+ 1 - 1
src/modules/user2/page-register/page-register.component.html → src/modules/user/register/register.page.html

@@ -1,4 +1,4 @@
-<body class="主体区" style="background-image: url(assets/register.png);background-size: cover;
+<body class="主体区" class="page-color" style="background-size: cover;
 background-position: center;">
     <div class="注册框">
         <form action="">

+ 5 - 0
src/modules/user2/page-register/page-register.component.scss → src/modules/user/register/register.page.scss

@@ -57,4 +57,9 @@ span {
  
     border-radius: 5px;
     border: none;
+}
+.page-color{
+    background: linear-gradient(220.55deg, #B7DCFF 0%, #ffffff 100%);
+    height: 100vh;
+    overflow: auto;
 }

+ 17 - 0
src/modules/user/register/register.page.spec.ts

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

+ 7 - 6
src/modules/user/page-register/page-register.component.ts → src/modules/user/register/register.page.ts

@@ -39,6 +39,9 @@ async function registerUser(userData: {
               }
             );
             wrong = '注册成功'
+            let userParse = new Parse.User()
+            userParse.set("username",userData.username)
+            userParse.set("userId",userData.userId)
           }else{
             wrong="两次密码输入不一致"
           }
@@ -48,14 +51,12 @@ async function registerUser(userData: {
     return wrong
   }
   
-
 @Component({
-  selector: 'app-page-register',
-  templateUrl: './page-register.component.html',
-  styleUrls: ['./page-register.component.scss']
+  selector: 'app-register',
+  templateUrl: './register.page.html',
+  styleUrls: ['./register.page.scss'],
 })
-
-export class PageRegisterComponent {
+export class RegisterPage  {
   wrong:any=''
   userData:any = {
     userId:"",

+ 4 - 0
src/modules/user/service-user/user.service.ts

@@ -30,6 +30,10 @@ 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);
         return true; // 匹配成功

+ 4 - 0
src/modules/user/user-routing.module.ts

@@ -5,6 +5,10 @@ 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: 'register',
+    loadChildren: () => import('./register/register.module').then( m => m.RegisterPageModule)
+  },
 ];
 
 @NgModule({

+ 0 - 20
src/modules/user2/guard-auth/auth.guard.ts

@@ -1,20 +0,0 @@
-import { CanActivateFn } from '@angular/router';
-import * as Parse from "parse";
-
-export const authGuard: CanActivateFn = (route, state) => {
-  // 检查当前本地存储中,是否有用户验证信息
-  let userAuth = Parse.User.current();
-  if(userAuth?.id){
-    return true;
-  }else{
-    // 暂时存储登陆前用户所在页面
-    let REDIRECT_URL = location.pathname;
-    localStorage.setItem("REDIRECT_URL",REDIRECT_URL);
-    if (location.pathname?.startsWith("/s1234567")){
-        location.href = "/s1234567/user/login"
-    }else{
-        location.href = "/user/login"
-    }
-    return false;
-  }
-};

+ 0 - 15
src/modules/user2/guard-auth/auth.local.guard.ts

@@ -1,15 +0,0 @@
-import { CanActivateFn } from '@angular/router';
-
-export const authLocalGuard: CanActivateFn = (route, state) => {
-  // 检查当前本地存储中,是否有用户验证信息
-  let userAuth = localStorage.getItem("USER_AUTH")
-  if(userAuth){
-    return true;
-  }else{
-    // 暂时存储登陆前用户所在页面
-    let REDIRECT_URL = location.pathname;
-    localStorage.setItem("REDIRECT_URL",REDIRECT_URL);
-    location.href = "/user/login"
-    return false;
-  }
-};

+ 0 - 35
src/modules/user2/page-info/page-info.component.html

@@ -1,35 +0,0 @@
-
-<ion-header>
-    <ion-toolbar>
-      <ion-title>编辑资料</ion-title>
-    </ion-toolbar>
-  </ion-header>
-  <ion-content color="light">
-    <ion-card>
-        <img alt="User Background" src="https://imgsource.huashi6.com/images/ai/2023/9/27/20_326650.jpg?e=1695819140&token=qFZErZx7WS1v5B4rgQE2KLMHlYHVNaCuXeaA9OLD:XUO7gAGwc99tTXYGsF0R5itDsTg=" />
-      
-        <ion-card-content>
-            <ion-input [(ngModel)]="userInfo.nickname" label="用户昵称" labelPlacement="floating" [counter]="true" maxlength="20">
-            </ion-input>
-            <ion-input [(ngModel)]="userInfo.desc" label="个性签名" labelPlacement="floating" [counter]="true" maxlength="50">
-            </ion-input>
-        </ion-card-content>
-      </ion-card>
-
-      <ion-list [inset]="true">
-        <ion-item>
-            <ion-select [(ngModel)]="userInfo.gender" label="性别" placeholder="您的性别">
-              <ion-select-option value="男">男</ion-select-option>
-              <ion-select-option value="女">女</ion-select-option>
-              <ion-select-option value="未知">未知</ion-select-option>
-            </ion-select>
-          </ion-item>
-      </ion-list>
-
-    <ion-list [inset]="true">
-        <ion-button expand="block" (click)="saveInfo()">保存</ion-button>
-        <ion-button expand="block" fill="clear" routerLink="/project/mine">返回</ion-button>
-    </ion-list>
-  </ion-content>
-
-

+ 0 - 0
src/modules/user2/page-info/page-info.component.scss


+ 0 - 21
src/modules/user2/page-info/page-info.component.spec.ts

@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { PageInfoComponent } from './page-info.component';
-
-describe('PageInfoComponent', () => {
-  let component: PageInfoComponent;
-  let fixture: ComponentFixture<PageInfoComponent>;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      declarations: [PageInfoComponent]
-    });
-    fixture = TestBed.createComponent(PageInfoComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 31
src/modules/user2/page-info/page-info.component.ts

@@ -1,31 +0,0 @@
-import { Component } from '@angular/core';
-import { Router } from '@angular/router';
-import { UserService } from '../service-user/user.service';
-import * as Parse from "parse";
-
-@Component({
-  selector: 'app-page-info',
-  templateUrl: './page-info.component.html',
-  styleUrls: ['./page-info.component.scss']
-})
-export class PageInfoComponent {
-  constructor(
-    public userServ:UserService,
-    private router:Router
-  ){
-    this.userInfo = Parse.User.current()?.toJSON();
-  }
-  userInfo:any = {}
-  async saveInfo(){
-    let user = Parse.User.current();
-    console.log(this.userInfo)
-    delete this.userInfo.objectId
-    delete this.userInfo.username
-    delete this.userInfo.sessionToken
-    delete this.userInfo.updatedAt
- 
-    user?.set(this.userInfo)
-    await user?.save()
-    this.router.navigate(["/project/mine"])
-  }
-}

+ 0 - 52
src/modules/user2/page-login/page-login.component.html

@@ -1,52 +0,0 @@
-<body class="主体区" style="background-image: url(assets/register.png);background-size: cover;
-background-position: center;">
-  <!-- IonicModule + FormsModule实现,默认好看 -->
-<div class="login-modal">
-    <ion-card>
-        <ion-card-header>
-        <ion-card-title>登录</ion-card-title>
-        <ion-card-subtitle>该页面需登陆可继续使用</ion-card-subtitle>
-        </ion-card-header>
-    
-        <ion-card-content>
-        <ion-input [(ngModel)]="userData.userId"
-            label="QQ号码" 
-            labelPlacement="floating" 
-            [counter]="true" 
-            maxlength="20">
-        </ion-input>
-
-        <ion-input [(ngModel)]="userData.password"
-            label="密码"
-            labelPlacement="floating"
-            [counter]="true"
-            maxlength="20"
-        ></ion-input>
-            
-        <p style="color: red;">{{wrong}}</p>
-
-        </ion-card-content>
-    
-        <ion-button expand="block" (click)="login()">登录</ion-button>
-        <ion-button expand="block" routerLink="/user/register">注册</ion-button>
-        <ion-button expand="block" fill="clear" (click)="goBack()">返回</ion-button>
-    </ion-card>
-</div>
-
-
-  <!-- 纯HTML + FormsModule实现,可任意定制样式 -->
-<ng-container *ngIf="false">
-
-    请输入用户名:{{userData.userId}} <br/>
-    
-    <input [(ngModel)]="userData.userId" type="text"/><br/>
-    
-    请输入密码:{{userData.password}}<br/>
-    <input [(ngModel)]="userData.password" type="password"/><br/>
-    
-    <button (click)="login()">登录</button>
-    <ion-button expand="block" routerLink="/user/register">注册</ion-button>
-    <p style="color: red;">密码错误请确认后点击登入</p>
-
-</ng-container>
-</body>

+ 0 - 10
src/modules/user2/page-login/page-login.component.scss

@@ -1,10 +0,0 @@
-.login-modal{
-    height:100vh;
-    width: 100vw;
-    display: flex;
-    flex-direction: column;
-    vertical-align: middle;
-    justify-content: center;
-}
-
-

+ 0 - 21
src/modules/user2/page-login/page-login.component.spec.ts

@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { PageLoginComponent } from './page-login.component';
-
-describe('PageLoginComponent', () => {
-  let component: PageLoginComponent;
-  let fixture: ComponentFixture<PageLoginComponent>;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      declarations: [PageLoginComponent]
-    });
-    fixture = TestBed.createComponent(PageLoginComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 51
src/modules/user2/page-login/page-login.component.ts

@@ -1,51 +0,0 @@
-import { Component } from '@angular/core';
-import { Router } from '@angular/router';
-import { AlertController } from '@ionic/angular';
-import { UserService } from '../service-user/user.service';
-
-@Component({
-  selector: 'app-page-login',
-  templateUrl: './page-login.component.html',
-  styleUrls: ['./page-login.component.scss']
-})
-export class PageLoginComponent {
-  wrong:any
-  constructor(
-    private userServ:UserService,
-    private router:Router,
-    private alertCtrl:AlertController
-    ){}
-  userData:any = {
-    username:"",
-    password:"",
-    userId:""
-  }
-
-  goBack(){
-    let path = localStorage.getItem("REDIRECT_URL") || "../"
-    this.router.navigate([path])
-  }
-  async login(){
-    try{
-      let isLogin = await this.userServ.loginUserPassword(this.userData)
-      if(isLogin){
-        this.goBack()
-      }
-      else{
-        this.wrong="密码错误请确认后点击登入"
-        this.alertError()
-      }
-    }catch(err){
-      console.log(err)
-    }
-  }
-  async alertError(){
-    const alert = await this.alertCtrl.create({
-      header: '登陆失败',
-      subHeader: '请检查用户名密码',
-      buttons: ['好的'],
-    });
-
-    await alert.present();
-  }
-}

+ 0 - 21
src/modules/user2/page-register/page-register.component.spec.ts

@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { PageRegisterComponent } from './page-register.component';
-
-describe('PageRegisterComponent', () => {
-  let component: PageRegisterComponent;
-  let fixture: ComponentFixture<PageRegisterComponent>;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      declarations: [PageRegisterComponent]
-    });
-    fixture = TestBed.createComponent(PageRegisterComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});

+ 0 - 113
src/modules/user2/page-register/page-register.component.ts

@@ -1,113 +0,0 @@
-import { Component } from '@angular/core';
-import * as Parse from "parse";
-
-
-async function registerUser(userData: {
-  username: string;
-  password: string;
-  userId:number;
-  repassword:string
-  sex:string
-},wrong:any){
-  console.log("ok")
-      const query = new Parse.Query('GzpUser');
-      query.equalTo('username', userData.username);
-      const results = await query.find();
-      if ((results).length > 0) {
-        
-        wrong='该账号已经注册了'
-        console.log(wrong)
-      }else{
-        if(userData.userId<=10000){
-          wrong="QQ号码小于五位数,不符合要求。"
-        }
-        else{
-          if(userData.password==userData.repassword){
-            console.log("ok")
-            const Gzpuser = Parse.Object.extend('GzpUser');
-            const user = new Gzpuser();
-            user.set(userData.username,'usernamer')
-            user.set(userData.userId,'userId')
-            user.set(userData.password,'password')
-            user.set(userData.sex,'sex')
-            user.save().then(
-              (result: any) => {
-                console.log('对话消息已保存到数据库:', result);
-              },
-              (error: any) => {
-                console.error('保存对话消息时出错:', error);
-              }
-            );
-            wrong = '注册成功'
-          }else{
-            wrong="两次密码输入不一致"
-          }
-        }
-      }
-      console.log(wrong)
-    return wrong
-  }
-  
-
-@Component({
-  selector: 'app-page-register',
-  templateUrl: './page-register.component.html',
-  styleUrls: ['./page-register.component.scss']
-})
-
-export class PageRegisterComponent {
-  wrong:any=''
-  userData:any = {
-    userId:"",
-    username:"",
-    password:"",
-    repassword:"",
-    sex:'',
-  }
-  constructor() {
-    (Parse as any).serverURL = "https://web2023.fmode.cn/parse";
-    Parse.initialize("dev");
-    registerUser(this.userData,this.wrong)
-  }
-  // sent(){
-  //   console.log("ok")
-  //   registerUser(this.userData,this.wrong)
-  //   console.log(this.wrong)
-  // }
-  async registerUser(){
-    console.log(this.userData)
-        const query = new Parse.Query('GzpUser');
-        query.equalTo('userId', this.userData.userId);
-        const results = await query.find();
-        if ((results).length > 0) {
-          this.wrong='该QQ号码已经注册过了'
-          console.log(this.wrong)
-        }else{
-          if(this.userData.userId<=10000){
-            this.wrong="QQ号码小于五位数,不符合要求。"
-          }
-          else{
-            if(this.userData.password==this.userData.repassword){
-              const Gzpuser = Parse.Object.extend('GzpUser');
-              const user = new Gzpuser();
-              user.set('username',this.userData.username)
-              user.set('userId',this.userData.userId)
-              user.set('password',this.userData.password)
-              user.set('sex',this.userData.sex)
-              user.save().then(
-                (result: any) => {
-                  console.log('对话消息已保存到数据库:', result);
-                },
-                (error: any) => {
-                  console.error('保存对话消息时出错:', error);
-                }
-              );
-              this.wrong='注册成功'
-            }else{
-              this.wrong="两次密码输入不一致"
-            }
-          }
-        }
-        console.log(this.wrong)
-    }
-}

+ 0 - 25
src/modules/user2/service-user/Chat.service.ts

@@ -1,25 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-
-@Injectable({
-  providedIn: 'root'
-})
-export class ChatService {
-  private apiUrl = 'https://web2023.fmode.cn/parse'; // Parse后端API地址
-
-  constructor(private http: HttpClient) {}
-
-  // 获取聊天记录方法
-  async getChatHistory(userId: string): Promise<any> {
-    const url = `${this.apiUrl}/classes/Gzpmessage`; // Message为存储聊天记录的Parse类名
-    const query = { senderId: userId }; // 假设使用senderId字段来表示发送者ID
-    const headers = { 'X-Parse-Application-Id': 'dev' }; // Parse应用ID
-
-    try {
-      const response = await this.http.get(url, { headers, params: query }).toPromise();
-      console.log(response)
-    } catch (error) {
-      throw new Error('Failed to get chat history.');
-    }
-  }
-}

+ 0 - 41
src/modules/user2/service-user/Share.service.ts

@@ -1,41 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-
-@Injectable({
-  providedIn: 'root'
-})
-export class SharedService {
-  private userId: string = '';
-  private username: string = '';
-  private userImgScr: string = '';
-  private islogin: boolean = false;
-
-  setUsername(username: string ,userId:string): void {
-    this.username = username;
-    this.userId=userId
-    if(username!=null){
-      this.userImgScr="http://q1.qlogo.cn/g?b=qq&nk="+userId+"&s=100"
-    }
-  }
-  
-  getUsername(): string {
-    return this.username;
-  }
-  getUserId(): string {
-    return this.userId;
-  }
-  getUserImg(): string {
-    return this.userImgScr;
-  }
-  pdlogin(): boolean {
-    return this.islogin;
-  }
-  isLogin():void{
-    this.islogin=true;
-  }
-  outLogin():void{
-    this.userImgScr='';
-    this.username='';
-    this.islogin=false
-  }
-}

+ 0 - 16
src/modules/user2/service-user/user.service.spec.ts

@@ -1,16 +0,0 @@
-import { TestBed } from '@angular/core/testing';
-
-import { UserService } from './user.service';
-
-describe('UserService', () => {
-  let service: UserService;
-
-  beforeEach(() => {
-    TestBed.configureTestingModule({});
-    service = TestBed.inject(UserService);
-  });
-
-  it('should be created', () => {
-    expect(service).toBeTruthy();
-  });
-});

+ 0 - 48
src/modules/user2/service-user/user.service.ts

@@ -1,48 +0,0 @@
-import { Injectable } from '@angular/core';
-import { SharedService } from './Share.service';
-import * as Parse from "parse";
-
-@Injectable({
-  providedIn: 'root'
-})
-export class UserService {
-
-
-  
-  constructor(private sharedService: SharedService) {
-    (Parse as any).serverURL = "https://web2023.fmode.cn/parse";
-    Parse.initialize("dev");
-  }
-
-  /**
-   * 检查用户密码是否正确
-   */
-  async loginUserPassword(userData: {
-    username: any;
-    password: string;
-    userId:string;
-  }) {
-    try {
-      const query = new Parse.Query('GzpUser');
-      query.equalTo('userId', userData.userId);
-      query.equalTo('password', userData.password);
-
-      const results = await query.find();
-      userData.username = results.map(user => user.get('username'));
-      if (results.length > 0) {
-        this.sharedService.isLogin()
-        this.sharedService.setUsername(userData.username,userData.userId);
-        return true; // 匹配成功
-        
-      }else{
-
-        return false;
-      }
-    } catch (err) {
-      console.error(err);
-      return false;
-    }
-  }
-}
-export { SharedService };
-

+ 0 - 21
src/modules/user2/user-routing.module.ts

@@ -1,21 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-import { authGuard } from './guard-auth/auth.guard';
-import { PageInfoComponent } from './page-info/page-info.component';
-import { PageLoginComponent } from './page-login/page-login.component';
-import { PageRegisterComponent } from './page-register/page-register.component';
-
-const routes: Routes = [
-  {path:"login",component:PageLoginComponent},
-  {path:"register",component:PageRegisterComponent},
-  {
-    path:"info",component:PageInfoComponent,
-    canActivate:[authGuard]
-  },
-];
-
-@NgModule({
-  imports: [RouterModule.forChild(routes)],
-  exports: [RouterModule]
-})
-export class UserRoutingModule { }

+ 0 - 25
src/modules/user2/user.module.ts

@@ -1,25 +0,0 @@
-import { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-
-import { UserRoutingModule } from './user-routing.module';
-import { PageLoginComponent } from './page-login/page-login.component';
-import { PageRegisterComponent } from './page-register/page-register.component';
-import { PageInfoComponent } from './page-info/page-info.component';
-import { FormsModule } from '@angular/forms';
-import { IonicModule } from '@ionic/angular';
-
-
-@NgModule({
-  declarations: [
-    PageLoginComponent,
-    PageRegisterComponent,
-    PageInfoComponent,
-  ],
-  imports: [
-    CommonModule,
-    UserRoutingModule,
-    FormsModule,
-    IonicModule,
-  ]
-})
-export class UserModule { }

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików