|
@@ -1,77 +1,99 @@
|
|
|
-import { Component } from '@angular/core';
|
|
|
+import { Component, OnInit } from '@angular/core';
|
|
|
import { AlertController } from '@ionic/angular';
|
|
|
import { Router } from '@angular/router';
|
|
|
+import * as Parse from "parse";
|
|
|
+(Parse as any).serverURL = "https://web2023.fmode.cn/parse"
|
|
|
+Parse.initialize("dev")
|
|
|
+
|
|
|
+
|
|
|
@Component({
|
|
|
selector: 'app-tab2',
|
|
|
templateUrl: 'tab2.page.html',
|
|
|
styleUrls: ['tab2.page.scss']
|
|
|
})
|
|
|
-export class Tab2Page {
|
|
|
+export class Tab2Page implements OnInit {
|
|
|
+
|
|
|
+
|
|
|
+ ngOnInit() {
|
|
|
+ this.getLinkman()
|
|
|
+ }
|
|
|
|
|
|
contacts = [
|
|
|
- { name: '小江', phone: '13767975832', email: '1969965415' },
|
|
|
- { name: '小明', phone: '123456789', email: 'xiaoming@example.com' },
|
|
|
- { name: '小红', phone: '987654321', email: 'xiaohong@example.com' }
|
|
|
+ { name: '李华', phone: '13767975832', email: '1969965415' },
|
|
|
+ { name: '李评', phone: '123456789', email: 'xiaoming@example.com' },
|
|
|
+ { name: '王芳', phone: '987654321', email: 'xiaohong@example.com' }
|
|
|
// 其他联系人数据
|
|
|
];
|
|
|
searchText: string = '';
|
|
|
|
|
|
- constructor(private alertController: AlertController,private router: Router) {}
|
|
|
+ constructor(private alertController: AlertController, private router: Router) { }
|
|
|
|
|
|
filterContacts() {
|
|
|
return this.contacts.filter(contact => contact.name.toLowerCase().includes(this.searchText.toLowerCase()));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
openMessages() {
|
|
|
// 在这里编写打开消息页面的逻辑
|
|
|
console.log('打开消息页面');
|
|
|
}
|
|
|
|
|
|
//添加联系人
|
|
|
- async add(){
|
|
|
- const alert = await this.alertController.create({
|
|
|
- header: '添加新继承人',
|
|
|
- inputs: [
|
|
|
- {
|
|
|
- name: 'name',
|
|
|
- type: 'text',
|
|
|
- placeholder: '姓名'
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'phone',
|
|
|
- type: 'tel',
|
|
|
- placeholder: '电话'
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'email',
|
|
|
- type: 'email',
|
|
|
- placeholder: '邮箱'
|
|
|
- }
|
|
|
- ],
|
|
|
- buttons: [
|
|
|
- {
|
|
|
- text: '取消',
|
|
|
- role: 'cancel'
|
|
|
- },
|
|
|
- {
|
|
|
- text: '确定',
|
|
|
- handler: (data) => {
|
|
|
- const newContact = {
|
|
|
- name: data.name,
|
|
|
- phone: data.phone,
|
|
|
- email: data.email
|
|
|
- };
|
|
|
- this.contacts.push(newContact);
|
|
|
+ async add() {
|
|
|
+ const alert = await this.alertController.create({
|
|
|
+ header: '添加新继承人',
|
|
|
+ inputs: [
|
|
|
+ {
|
|
|
+ name: 'name',
|
|
|
+ type: 'text',
|
|
|
+ placeholder: '姓名'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'phone',
|
|
|
+ type: 'tel',
|
|
|
+ placeholder: '电话'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'email',
|
|
|
+ type: 'email',
|
|
|
+ placeholder: '邮箱'
|
|
|
}
|
|
|
- }
|
|
|
- ]
|
|
|
- });
|
|
|
- await alert.present();
|
|
|
-}
|
|
|
-//切换界面
|
|
|
-goContact(){
|
|
|
- console.log(11)
|
|
|
- this.router.navigate(['/contact']);
|
|
|
-}
|
|
|
+ ],
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ text: '取消',
|
|
|
+ role: 'cancel'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '确定',
|
|
|
+ handler: (data) => {
|
|
|
+ const newContact = {
|
|
|
+ name: data.name,
|
|
|
+ phone: data.phone,
|
|
|
+ email: data.email
|
|
|
+ };
|
|
|
+ this.contacts.push(newContact);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ await alert.present();
|
|
|
+ }
|
|
|
+ //切换界面
|
|
|
+ // goContact() {
|
|
|
+ // console.log(11)
|
|
|
+ // this.router.navigate(['/contact']);
|
|
|
+ // }
|
|
|
+ linkman:any[] = []
|
|
|
+ async getLinkman(){
|
|
|
+ let query = new Parse.Query("Linkman");
|
|
|
+ query.include("user")
|
|
|
+ this.linkman = await query.find()
|
|
|
+ console.log(this.linkman);
|
|
|
+ }
|
|
|
+ contactId: string | undefined
|
|
|
+ goContact(contactId: string | undefined) {
|
|
|
+ this.router.navigate(["/contact/"], { queryParams: { contactId: contactId } })
|
|
|
+ console.log(contactId);
|
|
|
+ }
|
|
|
}
|