Newer
Older
import {NavController, IonicPage, Slides} from 'ionic-angular';
import {ActivityListPage} from "../../home/activity/activityList/activityList";
import {Http, Response} from '@angular/http';
import {AppService, AppGlobal} from '../../../service/http.service';
import {Calendar} from '@ionic-native/calendar';
import {ActivityApplyPage} from "../../home/activity/activityApply/activityApply";
import {ActivityDetailPage} from "../../home/activity/activityDetail/activityDetail";
import {OutGoingReportPage} from "../../home/report/outGoingReport/outGoingReport";
import {AnnouncementPage} from '../../home/announcement/announcementList/announcement';
import {Storage} from '@ionic/storage';
import {OutGoingReportEditPage} from "../../home/report/outGoingReportEdit/outGoingReportEdit";
import {AnnouncementViewPage} from '../../home/announcement/announcementView/announcementView';
import {CalendarComponentOptions, DayConfig} from "ion2-calendar";
import {NoticePage} from "../notice/notice";
import {Badge} from '@ionic-native/badge';
import {TabsService} from "../tabs.service";
import {TextToSpeech} from "@ionic-native/text-to-speech";
import {CommonService} from "../../../provide/common.service";
import {SearchNewPage} from "../../home-pages/search-new/search-new";
import {StuffDetailPage} from "../../home-pages/stuff-detail/stuff-detail";
declare var Swiper;
@IonicPage()
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild(Slides) slides: Slides;
tabsList = [{name: "党规党章",}, {name: "系列讲话",}, {name: "中央精神",}, {name: "本市部署"}];
move_h = 33; //移动高度
scorllStep = 1;
scrollTime = 60 ;
stopTime = 1000;
tmpH = 0;
constructor(public navCtrl: NavController, public tts: TextToSpeech,
public commonSer: CommonService, public emitSer: EmitService,
public appService: AppService, public http: Http, private calendar: Calendar, public storage: Storage,
public badge: Badge, public tabsSer: TabsService) {
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
}
lineChange(){
let child_div = this.lineChangeEle.nativeElement.children;
setTimeout( ()=> {
if(child_div.length > 0){
this.start();
}
},10);
}
start(){
if(this.tmpH < this.move_h){// tmpH = 0 ; move_h = 33
this.tmpH += this.scorllStep;//scorllStep = 1
if(this.tmpH >this.move_h){
this.tmpH = this.move_h;
}
this.lineChangeEle.nativeElement.scrollTop = this.tmpH;
setTimeout( ()=>{
this.start()
},this.scrollTime);//stopTime = 3000 ; scrollTime = 30 每移动一个单位延时30ms
}else{
this.tmpH = 0;
this.lineChangeEle.nativeElement.appendChild(this.lineChangeEle.nativeElement.children[0]);
// this.lineChangeEle.nativeElement.scrollTop = 0;
setTimeout( ()=>{
this.start()
},this.stopTime);//stopTime = 3000 ; scrollTime = 30 每移动一个单位延时30ms
}
(res) => {
this.slidersItems = res.data;
this.slidersItems.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
}
})
console.log(this.slidersItems);
//slideChange
slideChange(e) {
let index = this.slides.getActiveIndex();
if (index == this.slidersItems.length + 1) index = 1
this.slideTitle = this.slidersItems[index - 1].title;
}
//获取党员生日
getInfo() {
this.storage.get("userLoginInfo").then((value) => {
let userid = value.userid;
this.tabsSer.getInfo(userid).subscribe(
(res) => {
this.partyObj = res.apiResult.data;
}
);
})
}
//所属板块类型(1党规党章,2系列讲话,3中央精神,4本市部署,5通知公告,6党建动态,7工作提示,
// * 8党务参考,9廉政格言,10纪检提示,11风险排查,12警示教育,13支部活动,14党建联建,15结对帮扶)
change(index) {
let itemWidth = window.screen.width / 4;
let spanWidth = this.tabSpan.nativeElement.offsetWidth; //文字宽度
this.tips.nativeElement.style.width = this.tabSpan.nativeElement.offsetWidth + 'px';
this.tips.nativeElement.style.left = itemWidth * (index) + (itemWidth - spanWidth) / 2 + 'px';
pageSize: 1,
pageCount: 100,
obj: {
'plateType': index + 1,
resourceType: 1
this.newList.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
}
})
if (totalTime < 0) {
this.signText = '';
window.clearInterval(clock);
this.disabledClick = false;
}
}, 1000)
}
goToDetail(item) {
this.navCtrl.push(StuffDetailPage, {
id: item.id