Browse Source

Merge branch 'master' of codehub-cn-south-1.devcloud.huaweicloud.com:web3000003/web-0210402

hid_msrpuwgj56ccf29 9 months ago
parent
commit
0c7a4e85d2

+ 9 - 3
app-angular/src/modules/lesson/contact-list/contact-list.component.html

@@ -1,17 +1,23 @@
 <ion-header [translucent]="true">
   <ion-toolbar>
     <ion-title>通讯录</ion-title>
+    <ion-buttons slot="end">
+      <ion-button routerLink="/user/add">
+          <ion-icon slot="start" name="create-outline"></ion-icon>
+      </ion-button>
+    </ion-buttons>
   </ion-toolbar>
+  
 </ion-header>
 
 <ion-content [fullscreen]="true">
-  <ion-header collapse="condense">
+  <!-- <ion-header collapse="condense">
     <ion-toolbar>
       <ion-title size="large">通讯录</ion-title>
     </ion-toolbar>
-  </ion-header>
+  </ion-header> -->
   
-  <ion-searchbar [(ngModel)]="searchName" (ionInput)="search()"></ion-searchbar>
+  <ion-searchbar [(ngModel)]="searchName" (ionInput)="search()" placeholder="搜一搜"></ion-searchbar>
 
   <ion-list>
     <ng-container *ngFor="let contact of contactList;let index = index;">

+ 2 - 2
app-angular/src/modules/lesson/lesson.module.ts

@@ -19,7 +19,7 @@ import { PageLessonComponent } from './page-lesson/page-lesson.component';
 import { PageTestComponent } from './page-test/page-test.component';
 import { ContactListPage } from './contact-list/contact-list.component';
 import { ContactDetailPage } from './contact-detail/contact-detail.component';
- import { ExploreContainerComponent } from './explore-container/explore-container.component';
+import { ExploreContainerComponent } from './explore-container/explore-container.component';
 
 @NgModule({
   declarations: [
@@ -38,7 +38,7 @@ import { ContactDetailPage } from './contact-detail/contact-detail.component';
     PageTestComponent,
     ContactListPage,
     ContactDetailPage,
-   ExploreContainerComponent,
+    ExploreContainerComponent,
     
   ],
   imports: [

+ 15 - 17
app-angular/src/modules/lesson/user-follow/user-follow.component.html

@@ -1,18 +1,16 @@
 <ion-header [translucent]="true">
-    <ion-toolbar>
-      <ion-title>
-通讯录
-    </ion-title>
-    </ion-toolbar>
-  </ion-header>
-  
-  <ion-content [fullscreen]="true">
-    <ion-header>
-      <ion-toolbar>
-        <ion-title size="large">User-follow</ion-title>
-      </ion-toolbar>
-    </ion-header>
-  
-    <app-explore-container name="User-follow page"></app-explore-container>
-  </ion-content>
-  
+  <ion-toolbar>
+    <!-- <ion-title>通讯录</ion-title> -->
+    <!-- <ion-buttons slot="end">
+      <ion-button (click)="goToAddPage()">
+        <ion-icon name="add">11</ion-icon> 添加
+      </ion-button>
+    </ion-buttons> -->
+    
+  </ion-toolbar>
+</ion-header>
+
+
+<ion-content [fullscreen]="true">
+  <app-explore-container name="User-follow page"></app-explore-container>
+</ion-content>

+ 3 - 6
app-angular/src/modules/lesson/user-follow/user-follow.component.scss

@@ -1,20 +1,17 @@
 ion-content {
     height: calc(100vh - 121px) !important;
 }
-
 ion-item-divider {
     ion-icon {
         margin-right: 9px;
     }
 }
-
 ion-label p {
     display: block;
     max-width: calc(100% - 60px);
     overflow: hidden;
     text-overflow: ellipsis;
 }
-
 ion-label {
     ion-text {
         font-size: 0.9rem;
@@ -23,9 +20,9 @@ ion-label {
         white-space: nowrap;
     }
 }
-
 ion-button {
     ion-icon {
-        margin-right: 3px;
+        margin-right: 0; /* 将 margin-right 修改为 0 */
     }
-}
+}
+

+ 7 - 1
app-angular/src/modules/lesson/user-follow/user-follow.component.ts

@@ -1,4 +1,5 @@
 import { Component } from '@angular/core';
+import { NavController } from '@ionic/angular';
 
 @Component({
   selector: 'app-user-follow',
@@ -6,7 +7,12 @@ import { Component } from '@angular/core';
   styleUrls: ['./user-follow.component.scss']
 })
 export class UserFollowComponent {
-  constructor() {
+  constructor(private navCtrl: NavController) {
     // 构造函数,用于初始化组件
   }
+
+  goToAddPage() {
+    console.log(1)
+    // this.navCtrl.navigateForward('/add-page'); // 替换/add-page为你要跳转的页面路径
+  }
 }

+ 37 - 0
app-angular/src/modules/user/page-add/page-add.component.html

@@ -0,0 +1,37 @@
+<ion-header>
+  <ion-toolbar>
+    <ion-buttons slot="start">
+      <ion-button routerLink="/lesson/me/userFollow" fill="clear" color="dark">
+        <ion-icon name="chevron-back-outline" size="small"></ion-icon>
+        <ion-note>返回</ion-note>
+      </ion-button>
+    </ion-buttons>
+  </ion-toolbar>
+</ion-header>
+
+<ion-content color="light">
+  <ion-card>
+    <ion-list>
+      <ion-item>
+        <ion-label position="stacked">名字:</ion-label>
+        <ion-input [(ngModel)]="userAdd.name"></ion-input>
+      </ion-item>
+      <ion-item>
+        <ion-label position="stacked">性别:</ion-label>
+        <ion-select [(ngModel)]="userAdd.tag" cancelText="取消" okText="确定">
+          <ion-select-option value="male">男</ion-select-option>
+          <ion-select-option value="female">女</ion-select-option>
+          <ion-select-option value="unknown">未知</ion-select-option>
+        </ion-select>
+      </ion-item>
+      <ion-item>
+        <ion-label position="stacked">手机:</ion-label>
+        <ion-input [(ngModel)]="userAdd.desc"></ion-input>
+      </ion-item>
+    </ion-list>
+  </ion-card>
+
+  <ion-list [inset]="true">
+    <ion-button expand="block" (click)="saveAdd()">保存</ion-button>
+  </ion-list>
+</ion-content>

+ 10 - 0
app-angular/src/modules/user/page-add/page-add.component.scss

@@ -0,0 +1,10 @@
+ion-content {
+    height: calc(100vh - 121px) !important;
+}
+
+ion-item {
+    ion-input {
+        color: rgb(95, 93, 90);
+        font-size: 0.9rem;
+    }
+}

+ 21 - 0
app-angular/src/modules/user/page-add/page-add.component.spec.ts

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

+ 38 - 0
app-angular/src/modules/user/page-add/page-add.component.ts

@@ -0,0 +1,38 @@
+import { Component } from '@angular/core';
+import { Router } from '@angular/router';
+import * as Parse from "parse";
+
+@Component({
+  selector: 'app-page-add',
+  templateUrl: './page-add.component.html',
+  styleUrls: ['./page-add.component.scss']
+})
+export class PageAddComponent {
+  userAdd: any = {
+    name: '',
+    tag: '',
+    desc: ''
+  };
+
+  constructor(
+    private router: Router
+  ) {}
+
+  async saveAdd() {
+    const Contact = Parse.Object.extend('Contact');
+    const newContact = new Contact();
+
+    newContact.set('name', this.userAdd.name);
+    newContact.set('tag', this.userAdd.tag);
+    newContact.set('desc', this.userAdd.desc);
+    // 设置其他联系人信息...
+
+    try {
+      await newContact.save();
+      console.log('New contact saved successfully');
+      this.router.navigate(['/lesson/me/userFollow']); // 导航到联系人列表页面
+    } catch (error) {
+      console.error('Error while saving new contact', error);
+    }
+  }
+}

+ 3 - 1
app-angular/src/modules/user/user-routing.module.ts

@@ -4,6 +4,7 @@ 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';
+import { PageAddComponent } from './page-add/page-add.component';
 
 const routes: Routes = [
   {path:"login",component:PageLoginComponent},
@@ -11,7 +12,8 @@ const routes: Routes = [
   {
     path:"info",component:PageInfoComponent,
     canActivate:[authGuard]
-  }
+  },
+  { path: 'add', component: PageAddComponent },
 ];
 
 @NgModule({

+ 3 - 1
app-angular/src/modules/user/user.module.ts

@@ -7,13 +7,15 @@ 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';
+import { PageAddComponent } from './page-add/page-add.component';
 
 
 @NgModule({
   declarations: [
     PageLoginComponent,
     PageRegisterComponent,
-    PageInfoComponent
+    PageInfoComponent,
+    PageAddComponent
   ],
   imports: [
     CommonModule,