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>
</ng-container>
<ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon>
</div>
<div *ngIf="edit.room" class="info-item-content">
<input type="text" [(ngModel)]="abbreviation"> <input type="text" [(ngModel)]="abbreviation">
<ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon>
</label>
</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>
</div>
<div *ngIf="edit.telephone" class="info-item-content">
<input type="text" [(ngModel)]="telephone"> <input type="text" [(ngModel)]="telephone">
<ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon>
</label>
</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>
</div>
<div *ngIf="edit.email" class="info-item-content">
<input type="text" [(ngModel)]="email"> <input type="text" [(ngModel)]="email">
<ion-icon ios="ios-create-outline" md="md-create-outline"></ion-icon>
</label>
</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()
...@@ -14,31 +14,25 @@ import {MyBlockPage} from "../my-block/my-block"; ...@@ -14,31 +14,25 @@ import {MyBlockPage} from "../my-block/my-block";
export class ContractPersoninfoPage { export class ContractPersoninfoPage {
contactPersonInfo = { contactPersonInfo = {
gender:'', gender: '',
telephone:'', telephone: '',
email:'', email: '',
abbreviation:'' abbreviation: ''
}; };
id; id;
userRelEntity = { userRelEntity = {
relUserId:'', relUserId: '',
moduleName:'appcontact', moduleName: 'appcontact',
};
edit = {
email:false,
telephone:false,
room:false
}; };
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() { ionViewDidLoad() {
...@@ -46,11 +40,11 @@ export class ContractPersoninfoPage { ...@@ -46,11 +40,11 @@ export class ContractPersoninfoPage {
this.getPersonInfo(); this.getPersonInfo();
} }
getPersonInfo(){ getPersonInfo() {
const data = { const data = {
'userId':this.id 'userId': this.id
}; };
this.appService.ObserverHttpGet("/wisdomgroup/modules/telpBookPerson",data) this.appService.ObserverHttpGet("/wisdomgroup/modules/telpBookPerson", data)
.subscribe((res: Response) => { .subscribe((res: Response) => {
this.contactPersonInfo = res.json().data; this.contactPersonInfo = res.json().data;
this.email = this.contactPersonInfo.email; this.email = this.contactPersonInfo.email;
...@@ -63,20 +57,20 @@ export class ContractPersoninfoPage { ...@@ -63,20 +57,20 @@ export class ContractPersoninfoPage {
} }
//添加常用联系人 //添加常用联系人
addcontactPersons(){ addcontactPersons() {
const data = { const data = {
'relUserId':this.id, 'relUserId': this.id,
'moduleName':'appcontact' 'moduleName': 'appcontact'
} }
this.appService.ObserverHttpPostOption("/wisdomgroup/app/contact/addGeneralContactPersons",data) 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); console.log("data:" + data);
if(data["result"] == '2'){ if (data["result"] == '2') {
this.appService.popToastView('该联系人已在常用联系人中!','top',2000); this.appService.popToastView('该联系人已在常用联系人中!', 'top', 2000);
}else if(data["result"] == '3'){ } else if (data["result"] == '3') {
this.appService.popToastView('添加常用联系人失败!','top',2000); this.appService.popToastView('添加常用联系人失败!', 'top', 2000);
}else{ } else {
//this.appService.popToastView('添加常用联系人成功!','top',2000); //this.appService.popToastView('添加常用联系人成功!','top',2000);
this.navCtrl.push("ContactListPage"); this.navCtrl.push("ContactListPage");
} }
...@@ -89,8 +83,8 @@ export class ContractPersoninfoPage { ...@@ -89,8 +83,8 @@ export class ContractPersoninfoPage {
//移除常用联系人 //移除常用联系人
cancelGenaralPersons(){ cancelGenaralPersons() {
this.appService.ObserverHttpPost("/wisdomgroup/app/contact/deleteGeneralContactPersons",this.userRelEntity) 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"); this.navCtrl.push("ContactListPage");
...@@ -100,72 +94,42 @@ export class ContractPersoninfoPage { ...@@ -100,72 +94,42 @@ export class ContractPersoninfoPage {
); );
} }
call(number){ call(number) {
console.log("拨打:" + number); console.log("拨打:" + number);
window.location.href = "tel:" + number; window.location.href = "tel:" + number;
} }
editFun(type){ editFun() {
switch (type){ this.edit = true;
case 'email':{
this.edit.email = true;
break;
};
case 'telephone':{
this.edit.telephone = true;
break;
};
case 'room':{
this.edit.room = true;
break;
}
}
} }
//跳转设置分组 //跳转设置分组
usualContactSet(){ usualContactSet() {
this.navCtrl.push('MyBlockPage',{'item':this.contactPersonInfo}); this.navCtrl.push('MyBlockPage', {'item': this.contactPersonInfo});
} }
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)
.subscribe((res: Response) => {
let data = res.json();
}, error => {
this.appService.alert('网络异常!');
}
);
this.appService.ObserverHttpPut("/wisdomgroup//modules/telpBookPerson/telephone/",paramsTelePhone,this.id) //取消编辑
.subscribe((res: Response) => { editCancel() {
let data = res.json(); this.getPersonInfo();
}, error => { this.edit = false;
this.appService.alert('网络异常!');
} }
);
this.appService.ObserverHttpPut("/wisdomgroup//modules/telpBookPerson/abbreviation/",paramsAbbreviation,this.id) //完成
editDone() {
const data = {
email: this.email,
telephone: this.telephone,
abbreviation: this.abbreviation
};
this.appService.ObserverHttpPut("/wisdomgroup/modules/telpBookPerson/", this.id, data)
.subscribe((res: Response) => { .subscribe((res: Response) => {
let data = res.json(); let data = res.json();
}, error => { }, error => {
this.appService.alert('网络异常!'); this.appService.alert('网络异常!');
} }
); );
this.edit = false;
this.edit = {
email:false,
telephone:false,
room: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