Commit 190c2050 authored by wangqinghua's avatar wangqinghua

通讯录

parent cb6d2c9a
<ion-header> <ion-header>
<ion-navbar> <ion-navbar>
<ion-title>个人信息</ion-title> <ion-title>个人信息</ion-title>
<span *ngIf="edit.room || edit.telephone || edit.email" (click)="editDone()" float-right class="margin-right-10 color-999">完成</span>
<ion-buttons start>
<button ion-button (click)="editCancel()">
<span start *ngIf="edit" class="margin-right-10 color-999">取消</span>
</button>
</ion-buttons>
<ion-buttons end>
<button ion-button (click)="editDone()">
<span end *ngIf="edit" class="margin-right-10 color-999">完成</span>
</button>
</ion-buttons>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
...@@ -50,26 +60,22 @@ ...@@ -50,26 +60,22 @@
<ion-item> <ion-item>
<div class="info-item"> <div class="info-item">
<span class="info-span">房间号</span> <span class="info-span">房间号</span>
<div *ngIf="!edit.room" class="info-item-content" (click)="editFun('room')"> <div class="info-item-content" (click)="editFun()">
<ng-container *ngIf="contactPersonInfo.abbreviation"> <label>
<span class="info">{{contactPersonInfo.abbreviation}}</span> <input type="text" [(ngModel)]="abbreviation">
</ng-container> <ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon>
<ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon> </label>
</div>
<div *ngIf="edit.room" class="info-item-content">
<input type="text" [(ngModel)]="abbreviation">
</div> </div>
</div> </div>
</ion-item> </ion-item>
<ion-item> <ion-item>
<div class="info-item"> <div class="info-item">
<span class="info-span">座机</span> <span class="info-span">座机</span>
<div *ngIf="!edit.telephone" class="info-item-content" (click)="editFun('telephone')"> <div class="info-item-content" (click)="editFun()">
<span class="info">{{contactPersonInfo.telephone}}</span> <label>
<ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon> <input type="text" [(ngModel)]="telephone">
</div> <ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon>
<div *ngIf="edit.telephone" class="info-item-content"> </label>
<input type="text" [(ngModel)]="telephone">
</div> </div>
</div> </div>
</ion-item> </ion-item>
...@@ -78,12 +84,11 @@ ...@@ -78,12 +84,11 @@
<ion-item> <ion-item>
<div class="info-item"> <div class="info-item">
<span class="info-span">邮箱</span> <span class="info-span">邮箱</span>
<div *ngIf="!edit.email" class="info-item-content" (click)="editFun('email')"> <div class="info-item-content" (click)="editFun()">
<span class="info">{{contactPersonInfo.email}}</span> <label>
<ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon> <input type="text" [(ngModel)]="email">
</div> <ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon>
<div *ngIf="edit.email" class="info-item-content"> </label>
<input type="text" [(ngModel)]="email">
</div> </div>
</div> </div>
</ion-item> </ion-item>
......
import { Component } from '@angular/core'; import {Component} from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular'; import {IonicPage, NavController, NavParams} from 'ionic-angular';
import { Response } from '@angular/http'; import {Response} from '@angular/http';
import { AppService } from '../../../service/appHttpService'; import {AppService} from '../../../service/appHttpService';
import { ContactListPage } from '../contactList/contactList'; import {ContactListPage} from '../contactList/contactList';
import {MyBlockPage} from "../my-block/my-block"; import {MyBlockPage} from "../my-block/my-block";
@IonicPage() @IonicPage()
@Component({ @Component({
selector: 'page-contract-personinfo', selector: 'page-contract-personinfo',
templateUrl: 'contract-personinfo.html', templateUrl: 'contract-personinfo.html',
}) })
export class ContractPersoninfoPage { export class ContractPersoninfoPage {
contactPersonInfo = { contactPersonInfo = {
gender:'', gender: '',
telephone:'', telephone: '',
email:'', email: '',
abbreviation:'' abbreviation: ''
};
id;
userRelEntity = {
relUserId:'',
moduleName:'appcontact',
};
edit = {
email:false,
telephone:false,
room:false
}; };
id;
userRelEntity = {
relUserId: '',
moduleName: 'appcontact',
};
edit = false;
email; email;
abbreviation; abbreviation;
telephone; telephone;
constructor( constructor(public navCtrl: NavController,
public navCtrl: NavController, public navParams: NavParams,
public navParams: NavParams, public appService: AppService) {
public appService:AppService
) {
}
ionViewDidLoad() {
this.id = this.navParams.get("id");
this.getPersonInfo();
}
getPersonInfo(){
const data = {
'userId':this.id
};
this.appService.ObserverHttpGet("/wisdomgroup/modules/telpBookPerson",data)
.subscribe((res: Response) => {
this.contactPersonInfo = res.json().data;
this.email = this.contactPersonInfo.email;
this.abbreviation = this.contactPersonInfo.abbreviation;
this.telephone = this.contactPersonInfo.telephone;
}, error => {
this.appService.alert('网络异常!');
}
);
}
//添加常用联系人
addcontactPersons(){
const data = {
'relUserId':this.id,
'moduleName':'appcontact'
} }
this.appService.ObserverHttpPostOption("/wisdomgroup/app/contact/addGeneralContactPersons",data)
.subscribe((res: Response) => { ionViewDidLoad() {
let data = res.json(); this.id = this.navParams.get("id");
console.log("data:"+data); this.getPersonInfo();
if(data["result"] == '2'){
this.appService.popToastView('该联系人已在常用联系人中!','top',2000);
}else if(data["result"] == '3'){
this.appService.popToastView('添加常用联系人失败!','top',2000);
}else{
//this.appService.popToastView('添加常用联系人成功!','top',2000);
this.navCtrl.push("ContactListPage");
}
//this.navCtrl.pop();
}, error => {
this.appService.alert('网络异常!');
}
);
}
//移除常用联系人
cancelGenaralPersons(){
this.appService.ObserverHttpPost("/wisdomgroup/app/contact/deleteGeneralContactPersons",this.userRelEntity)
.subscribe((res: Response) => {
let data = res.json();
this.navCtrl.push("ContactListPage");
}, error => {
this.appService.alert('网络异常!');
}
);
}
call(number){
console.log("拨打:" + number);
window.location.href = "tel:" + number;
}
editFun(type){
switch (type){
case 'email':{
this.edit.email = true;
break;
};
case 'telephone':{
this.edit.telephone = true;
break;
};
case 'room':{
this.edit.room = true;
break;
}
}
} }
//跳转设置分组 getPersonInfo() {
usualContactSet(){ const data = {
this.navCtrl.push('MyBlockPage',{'item':this.contactPersonInfo}); 'userId': this.id
}
editDone(){
const paramsEmail = {
email:this.email
};
const paramsTelePhone = {
telephone:this.telephone
};
const paramsAbbreviation = {
abbreviation:this.abbreviation
}; };
this.appService.ObserverHttpPut("/wisdomgroup/modules/telpBookPerson/email/",paramsEmail,this.id) this.appService.ObserverHttpGet("/wisdomgroup/modules/telpBookPerson", data)
.subscribe((res: Response) => { .subscribe((res: Response) => {
let data = res.json(); this.contactPersonInfo = res.json().data;
this.email = this.contactPersonInfo.email;
this.abbreviation = this.contactPersonInfo.abbreviation;
this.telephone = this.contactPersonInfo.telephone;
}, error => { }, error => {
this.appService.alert('网络异常!'); this.appService.alert('网络异常!');
} }
); );
}
this.appService.ObserverHttpPut("/wisdomgroup//modules/telpBookPerson/telephone/",paramsTelePhone,this.id) //添加常用联系人
addcontactPersons() {
const data = {
'relUserId': this.id,
'moduleName': 'appcontact'
}
this.appService.ObserverHttpPostOption("/wisdomgroup/app/contact/addGeneralContactPersons", data)
.subscribe((res: Response) => { .subscribe((res: Response) => {
let data = res.json(); let data = res.json();
console.log("data:" + data);
if (data["result"] == '2') {
this.appService.popToastView('该联系人已在常用联系人中!', 'top', 2000);
} else if (data["result"] == '3') {
this.appService.popToastView('添加常用联系人失败!', 'top', 2000);
} else {
//this.appService.popToastView('添加常用联系人成功!','top',2000);
this.navCtrl.push("ContactListPage");
}
//this.navCtrl.pop();
}, error => { }, error => {
this.appService.alert('网络异常!'); this.appService.alert('网络异常!');
} }
); );
}
this.appService.ObserverHttpPut("/wisdomgroup//modules/telpBookPerson/abbreviation/",paramsAbbreviation,this.id) //移除常用联系人
cancelGenaralPersons() {
this.appService.ObserverHttpPost("/wisdomgroup/app/contact/deleteGeneralContactPersons", this.userRelEntity)
.subscribe((res: Response) => { .subscribe((res: Response) => {
let data = res.json(); let data = res.json();
this.navCtrl.push("ContactListPage");
}, error => { }, error => {
this.appService.alert('网络异常!'); this.appService.alert('网络异常!');
} }
); );
}
call(number) {
console.log("拨打:" + number);
window.location.href = "tel:" + number;
}
this.edit = { editFun() {
email:false, this.edit = true;
telephone:false, }
room:false
//跳转设置分组
usualContactSet() {
this.navCtrl.push('MyBlockPage', {'item': this.contactPersonInfo});
}
//取消编辑
editCancel() {
this.getPersonInfo();
this.edit = false;
}
//完成
editDone() {
const data = {
email: this.email,
telephone: this.telephone,
abbreviation: this.abbreviation
}; };
this.appService.ObserverHttpPut("/wisdomgroup/modules/telpBookPerson/", this.id, data)
.subscribe((res: Response) => {
let data = res.json();
}, error => {
this.appService.alert('网络异常!');
}
);
this.edit = false;
this.getPersonInfo(); this.getPersonInfo();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment