Commit a37b7ffa authored by wangqinghua's avatar wangqinghua

下拉刷新

parent f1ea0484
......@@ -18,7 +18,7 @@
</div>
</div>
<ion-slides (ionSlideDidChange)="slideChange($event)">
<ion-slides (ionSlideDidChange)="slideChange($event)" loop="true">
<ion-slide *ngFor="let item of slideList">
<div class="main-news">
<ng-container *ngFor="let new of item;">
......
......@@ -2,6 +2,7 @@ import {AfterViewInit, Component, ElementRef, NgZone, ViewChild} from '@angular/
import {Content, Slides} from "ionic-angular";
import {TabsService} from "../../pages/tabs/tabs.service";
import {AppGlobal} from "../../service/http.service";
import {CommonService} from "../../provide/common.service";
@Component({
selector: 'slide-list',
......@@ -23,12 +24,14 @@ export class SlideListComponent implements AfterViewInit {
{name: "中央精神", type: 3, index: 2},
{name: "本市部署", type: 4, index: 3}
];
plateType;
index = 0;
slideList = [];
picture: string = AppGlobal.domain + '/wisdomgroup';
constructor(private tabsSer: TabsService,public zone:NgZone) {
constructor(private tabsSer: TabsService,public zone:NgZone,
private commonSer:CommonService) {
this.slideList.length = 4;
}
......@@ -46,11 +49,12 @@ export class SlideListComponent implements AfterViewInit {
this.tips.nativeElement.style.left = itemWidth * (index) + (itemWidth - spanWidth) / 2 + 'px';
this.tips1.nativeElement.style.left = itemWidth * (index) + (itemWidth - spanWidth) / 2 + 'px';
this.index = index;
this.plateType = item.type;
const data = {
pageSize: 1,
pageCount: 100,
obj: {
'plateType': item.type,
'plateType': this.plateType,
'resourceType': 1
}
}
......@@ -69,7 +73,9 @@ export class SlideListComponent implements AfterViewInit {
}
slideChange(e) {
const index = this.slides1.getActiveIndex();
let index = this.slides1.getActiveIndex();
if (index == this.tabsList.length) index = 0;
if (index == this.tabsList.length +1) index = 1;
this.change(this.tabsList[index])
}
......@@ -83,4 +89,29 @@ export class SlideListComponent implements AfterViewInit {
goToDetail(item) {
}
//下拉刷新
refresh(e){
const data = {
pageSize: 1,
pageCount: 100,
obj: {
'plateType': this.plateType,
'resourceType': 1
}
}
this.tabsSer.stuffPage(data).subscribe(
(res) => {
let arr = res.data;
arr.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
}
})
this.commonSer.toastTime('刷新成功!',800)
this.slideList[this.index] = arr;
e.complete();
}
)
}
}
slide {
$slide-height:200px;
$slide-height:220px;
.news-content{
margin-top: 1.2rem;
}
......@@ -26,6 +26,16 @@ slide {
}
}
.slides-title {
color: #333;
width: 100%;
text-align: left;
height: 2rem;
line-height: 2rem;
padding: 0 1rem;
font-size: 1.5rem;
font-weight: 500;
}
//新闻区
.main-news {
padding: 0 1rem;
......
......@@ -48,7 +48,7 @@
</ion-refresher-content>
</ion-refresher>
<ion-slides (ionSlideDidChange)="slideChange($event)">
<ion-slides (ionSlideDidChange)="slideChange($event)" loop="true">
<ion-slide *ngFor="let new of slideList">
<div class="search-content">
<ng-container *ngFor="let item of new">
......
......@@ -271,8 +271,9 @@ export class DiscoverPage {
}
slideChange(e){
const index = this.slides.getActiveIndex();
console.log(this.tabsList[index]);
let index = this.slides.getActiveIndex();
if (index == this.tabsList.length) index = 0;
if (index == this.tabsList.length +1) index = 1;
this.changeParent(this.tabsList[index])
}
}
......@@ -25,7 +25,6 @@
<ion-content>
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content pullingText="下拉刷新"
pullingIcon="arrow-dropdown"
refreshingSpinner="bubbles">
</ion-refresher-content>
</ion-refresher>
......
page-home {
.slides-title {
color: #333;
width: 100%;
text-align: left;
height: 2rem;
line-height: 2rem;
padding: 0 1rem;
font-size: 1.5rem;
font-weight: 500;
}
//头部搜索
.toolbar .searchbar-ios .searchbar-input {
......
......@@ -62,7 +62,7 @@ export class HomePage {
constructor(public navCtrl: NavController, public tts: TextToSpeech, public datePipe: DatePipe,
public commonSer: CommonService, public emitSer: EmitService,
public zone: NgZone,public slideList:SlideListComponent,
public zone: NgZone,public slideListCom:SlideListComponent,
public appService: AppService, public http: Http, public storage: Storage,
public badge: Badge, public tabsSer: TabsService) {
// 接收发射过来的数据
......@@ -94,9 +94,9 @@ export class HomePage {
this.zone.run(()=>{
// this.headerTag.nativeElement.
if(this.content.scrollTop > height){
this.slideList.scroll('true');
this.slideListCom.scroll('true');
}else{
this.slideList.scroll('false');
this.slideListCom.scroll('false');
}
this.content.resize();
})
......@@ -233,7 +233,8 @@ export class HomePage {
}
doRefresh(e){
e.complete();
this.slideListCom.refresh(e)
// e.complete();
}
}
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