Commit 1d8a2caf authored by wangqinghua's avatar wangqinghua

color

parent 248312f9
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 { AppService } from "../../../service/appHttpService"; import {AppService} from "../../../service/appHttpService";
import { Geolocation } from "@ionic-native/geolocation"; import {Geolocation} from "@ionic-native/geolocation";
import * as moment from "moment"; import * as moment from "moment";
declare let AMap;
@IonicPage() @IonicPage()
@Component({ @Component({
selector: 'page-duty-sign-up', selector: 'page-duty-sign-up',
templateUrl: 'duty-sign-up.html', templateUrl: 'duty-sign-up.html',
}) })
export class DutySignUpPage { export class DutySignUpPage {
...@@ -22,64 +21,61 @@ export class DutySignUpPage { ...@@ -22,64 +21,61 @@ export class DutySignUpPage {
mainLng = 121.444888; //经度 mainLng = 121.444888; //经度
// mainLng = 121.393319; //经度test // mainLng = 121.393319; //经度test
nowDay; nowDay;
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService, public geolocation: Geolocation) {
}
ionViewDidLoad() { constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService, public geolocation: Geolocation) {
}
this.nowDay = moment().format('l'); ionViewDidLoad() {
console.log(this.nowDay);
this.id = this.navParams.get('id'); this.nowDay = moment().format('l');
const data = { console.log(this.nowDay);
'id':this.id
};
this.appService.ObserverHttpGetOption('/wisdomgroup/schedule/hasSignIn',data)
.subscribe((res)=>{
this.signState = res.json();
})
}
//签到 this.appService.ObserverHttpGet('/wisdomgroup/schedule/mySchedleOfToday', null)
signIn(){ .subscribe((res) => {
const data = { this.signState = res.json();
id:this.id, //值班记录id, })
address:'上海市委组织部' //签到地址 }
};
this.appService.ObserverHttpGet('/wisdomgroup/schedule/signIn',data)
.subscribe((res)=>{
console.log(res);
})
}
//签退 //签到
signBack(){ signIn() {
this.calcuDistance(); const data = {
// const data = { id: this.id, //值班记录id,
// id:this.id, //值班记录id, address: '上海市委组织部' //签到地址
// address:'上海市委组织部' //签到地址 };
// }; this.appService.ObserverHttpGet('/wisdomgroup/schedule/signIn', data)
// this.appService.ObserverHttpGet('/wisdomgroup/schedule/signIn',data) .subscribe((res) => {
// .subscribe((res)=>{ console.log(res);
// console.log(res); })
// })
} }
//计算距离 //签退
calcuDistance(){ signBack() {
this.geolocation.getCurrentPosition().then((resp) => { this.calcuDistance();
console.log(resp.coords.latitude); const data = {
console.log(resp.coords.longitude); id:this.id, //值班记录id,
const distance = this.getDisance(this.mainLat,this.mainLng,resp.coords.latitude,resp.coords.longitude); address:'上海市委组织部' //签到地址
console.log(distance); };
alert('距离:'+distance); this.appService.ObserverHttpGet('/wisdomgroup/schedule/signOut',data)
}).catch((error) => { .subscribe((res)=>{
console.log(error); console.log(res);
}); })
} }
//计算距离
calcuDistance() {
this.geolocation.getCurrentPosition().then((resp) => {
console.log(resp.coords.latitude);
console.log(resp.coords.longitude);
const distance = this.getDisance(this.mainLat, this.mainLng, resp.coords.latitude, resp.coords.longitude);
console.log(distance);
alert('距离:' + distance);
}).catch((error) => {
console.log(error);
});
}
getDisance(lat1, lng1, lat2, lng2){ getDisance(lat1, lng1, lat2, lng2) {
let radLat1 = this.toRad(lat1); let radLat1 = this.toRad(lat1);
let radLat2 = this.toRad(lat2); let radLat2 = this.toRad(lat2);
let deltaLat = radLat1 - radLat2; let deltaLat = radLat1 - radLat2;
...@@ -91,7 +87,7 @@ export class DutySignUpPage { ...@@ -91,7 +87,7 @@ export class DutySignUpPage {
} }
toRad(d) { toRad(d) {
return d * Math.PI / 180; return d * Math.PI / 180;
} }
} }
import {Component, ViewChild} from '@angular/core'; import {Component, ViewChild} from '@angular/core';
import {IonicPage, NavController, NavParams, Slides} from 'ionic-angular'; import {AlertController, IonicPage, NavController, NavParams, Slides} from 'ionic-angular';
import {ResultPage} from "../result/result"; import {ResultPage} from "../result/result";
import {DesicrPage} from "../item/desicr/desicr"; import {DesicrPage} from "../item/desicr/desicr";
import {AppService} from "../../../service/appHttpService"; import {AppService} from "../../../service/appHttpService";
...@@ -33,7 +33,7 @@ export class ListPage { ...@@ -33,7 +33,7 @@ export class ListPage {
temp; //选中的item temp; //选中的item
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService) { public appService: AppService,public alertCtrl:AlertController) {
} }
ionViewDidEnter() { ionViewDidEnter() {
...@@ -138,18 +138,36 @@ export class ListPage { ...@@ -138,18 +138,36 @@ export class ListPage {
//取消发布 //取消发布
cancel(){ cancel(){
// 0 清除 1 不清除 // 0 清除 1 不清除
const data = {
'isdelete':'1' let alert = this.alertCtrl.create();
}; alert.setTitle('确定取消发布该问卷吗?');
this.appService.alert('确定取消发布该问卷吗',
(res) => { alert.addInput({
this.appService.ObserverHttpForm('/wisdomgroup/modules/question/cancel/', this.temp.id,data) type: 'checkbox',
.subscribe((res) => { label: '清空该问卷答题数据',
this.appService.popToastView('取消发布成功','middle',1000); value: '0',
this.selectPageMenu(this.swiperIndex); checked: false
}) });
alert.addButton('取消');
alert.addButton({
text: '确定',
handler: res => {
let data = {isdelete:''};
if(res.length == 0 ){
data.isdelete = '1';
}else{
data.isdelete = '0';
} }
) this.appService.ObserverHttpForm('/wisdomgroup/modules/question/cancel/', this.temp.id,data)
.subscribe((res) => {
this.appService.popToastView('取消发布成功','middle',1000);
this.selectPageMenu(this.swiperIndex);
})
}
});
alert.present();
} }
......
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