Newer
Older
import {Component, ElementRef, ViewChild, NgZone, Renderer2, Input} from '@angular/core';
import {NavController, IonicPage, Slides, Content, InfiniteScrollContent} from 'ionic-angular';
import {Http, Response} from '@angular/http';
import {AppService, AppGlobal} from '../../../service/http.service';
import {Storage} from '@ionic/storage';
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";
import {SlideListComponent} from "../../../components/slide-list/slide-list";
@IonicPage()
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild('infiniteScrollContentEle') infiniteScrollContentEle: ElementRef;
// @ViewChild(InfiniteScrollContent) infiniteScrollContent: InfiniteScrollContent;
//所属板块类型:
//1党章党规,2系列讲话,3中央精神,4本市部署,5通知公告,6党建动态,7工作提示,8党务参考
//9廉政格言,10纪检提示,11风险排查,12警示教育,13支部活动,14党建联建,15结对帮扶
// tabsList = [
// {name: "党章党规", type: 1, index: 0},
// {name: "系列讲话", type: 2, index: 1},
// {name: "中央精神", type: 3, index: 2},
// {name: "本市部署", type: 4, index: 3}
// ];
{name: "中央精神", type: 3, index: 2},
{name: "本市部署", type: 4, index: 3}
];
constructor(public navCtrl: NavController, public tts: TextToSpeech, public datePipe: DatePipe,
public appService: AppService, public http: Http, public storage: Storage,
this.itemWidth = window.screen.width / 4;
this.spanWidth = this.tabSpan.nativeElement.offsetWidth; //文字宽度
this.tips.nativeElement.style.width = this.tabSpan.nativeElement.offsetWidth + 'px';
this.tips1.nativeElement.style.width = this.tabSpan.nativeElement.offsetWidth + 'px';
this.content.ionScroll.subscribe(($event) => {
this.zone.run(() => {
if (this.content.scrollTop > height) {
this.tips.nativeElement.style.left = this.itemWidth * (this.index) + (this.itemWidth - this.spanWidth) / 2 + 'px';
this.tips1.nativeElement.style.left = this.itemWidth * (this.index) + (this.itemWidth - this.spanWidth) / 2 + 'px';
obj: {
'plateType': this.plateType,
'resourceType': 1
}
}
this.tabsSer.stuffPage(data).subscribe(
(res) => {
arr.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
}
});
let index = this.slides1.getActiveIndex();
if (index == this.tabsList.length) index = 0;
//获取党员生日
getInfo() {
this.storage.get("userLoginInfo").then((value) => {
let userid = value.userid;
this.tabsSer.getInfo(userid).subscribe(
(res) => {
this.partyObj = res.apiResult.data;
setTimeout(()=>{
this.start();
this.isBir = false;
},500)
const nowDay = this.datePipe.transform(new Date(), 'yyyy-MM-dd');
localStorage.setItem('partyBir', nowDay);
let child_div = this.verticaLamp.nativeElement.children;
const scrollWidth = this.verticaLamp.nativeElement.offsetWidth;
const textWidth = child_div[0].offsetWidth;
i = scrollWidth;
}
child_div[0].style.left = i + 'px';
if (totalTime < 0) {
this.signText = '';
window.clearInterval(clock);
this.disabledClick = false;
}
}, 1000)
}
//查看文章详情
goToDetail(item) {
this.navCtrl.push(StuffDetailPage, {
id: item.id
})
}
if (this.totalNum < this.slideList[this.index].length + 1) {
console.log('没有数据了');
this.loadMore = false;
e.enable(false);
return false;
pageCount: this.pageCount,
obj: {
'plateType': this.plateType,
'resourceType': 1
}
// this.renderer.setStyle(this.infiniteScrollContentEle.nativeElement, 'height', '60px');
this.tabsSer.stuffPage(data).subscribe(
(res) => {
let arr = res.data.list;
arr.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
}
this.slideList[this.index].push(e);
});
}
// this.renderer.setStyle(this.infiniteScrollContentEle.nativeElement, 'height', '0px');
obj: {
'plateType': this.plateType,
'resourceType': 1
}
}
this.tabsSer.stuffPage(data).subscribe(
(res) => {
arr.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
}
});
}
this.isSign = false;
}
stop(e) {
e.stopPropagation();
}