Commit 4517159b authored by wangqinghua's avatar wangqinghua

下拉刷新

parent 3d6d1f82
...@@ -19,29 +19,34 @@ ...@@ -19,29 +19,34 @@
</button> </button>
</ion-buttons> </ion-buttons>
</ion-navbar> </ion-navbar>
</ion-header> <div class="tabs-fixed">
<div class="tabs-fixed"> <div class="scroll-tab">
<div class="scroll-tab"> <div class="news-content">
<div class="news-content"> <div #tabsParent class="tabs-parent">
<div #tabsParent class="tabs-parent"> <div #tabsChildren *ngFor="let item of tabsList;" (click)="changeParent(item)" class="tabs-children">
<div #tabsChildren *ngFor="let item of tabsList;" (click)="changeParent(item)" class="tabs-children"> <span #tabSpan [style.color]="indexParent == item.indexParent ? '#e12724':''">{{item.name}}</span>
<span #tabSpan [style.color]="indexParent == item.indexParent ? '#e12724':''">{{item.name}}</span> </div>
<span #tips id="tips"></span>
</div>
</div> </div>
<span #tips id="tips"></span>
</div> </div>
</div> <div class="scroll-tab">
</div> <div class="news-content" #newsContent>
<div class="scroll-tab"> <div class="tabs-parent">
<div class="news-content" #newsContent> <div class="tabs-child">
<div class="tabs-parent"> <span *ngFor="let ch of childrenList" [ngClass]="{'select':indexChildren == ch.indexChildren}" (click)="changeChildren(ch)">{{ch.name}}</span>
<div class="tabs-child"> </div>
<span *ngFor="let ch of childrenList" [ngClass]="{'select':indexChildren == ch.indexChildren}" (click)="changeChildren(ch)">{{ch.name}}</span> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </ion-header>
</div>
<ion-content> <ion-content>
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content pullingText="下拉刷新"
refreshingSpinner="bubbles">
</ion-refresher-content>
</ion-refresher>
<div class="search-content"> <div class="search-content">
<ng-container *ngFor="let item of newList"> <ng-container *ngFor="let item of newList">
<div class="search-item" (click)="goToDetail(item)"> <div class="search-item" (click)="goToDetail(item)">
...@@ -89,4 +94,8 @@ ...@@ -89,4 +94,8 @@
</div> </div>
</ng-container> </ng-container>
</div> </div>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content> </ion-content>
page-discover { page-discover {
background-color: #fff;
ion-content{
top: 100px;
}
.toolbar .searchbar-ios .searchbar-input { .toolbar .searchbar-ios .searchbar-input {
background-color: #e12724; background-color: #e12724;
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
...@@ -57,7 +62,6 @@ page-discover { ...@@ -57,7 +62,6 @@ page-discover {
//新闻区 //新闻区
.search-content{ .search-content{
padding: 0 1rem; padding: 0 1rem;
margin-top: 88px;
.search-item{ .search-item{
padding: .8rem 0; padding: .8rem 0;
.item-info{ .item-info{
...@@ -124,7 +128,7 @@ page-discover { ...@@ -124,7 +128,7 @@ page-discover {
.tabs-fixed{ .tabs-fixed{
position: fixed; position: fixed;
top: 52px; top: 44px;
left: 0px; left: 0px;
width: 100%; width: 100%;
z-index: 99999; z-index: 99999;
......
...@@ -7,6 +7,7 @@ import {PublishPage} from "../../discover-pages/publish/publish"; ...@@ -7,6 +7,7 @@ import {PublishPage} from "../../discover-pages/publish/publish";
import {EmitService} from "../../../provide/emit.service"; import {EmitService} from "../../../provide/emit.service";
import {NoticePage} from "../notice/notice"; import {NoticePage} from "../notice/notice";
import {AppGlobal} from "../../../service/http.service"; import {AppGlobal} from "../../../service/http.service";
import {CommonService} from "../../../provide/common.service";
@IonicPage() @IonicPage()
...@@ -133,6 +134,7 @@ export class DiscoverPage { ...@@ -133,6 +134,7 @@ export class DiscoverPage {
{"name": "知识拓展", "type": -1, "indexParent": 4, "children": []} {"name": "知识拓展", "type": -1, "indexParent": 4, "children": []}
]; ];
childrenList = []; childrenList = [];
plateType; //分类
indexParent = 1; indexParent = 1;
indexChildren = 0; indexChildren = 0;
...@@ -141,6 +143,7 @@ export class DiscoverPage { ...@@ -141,6 +143,7 @@ export class DiscoverPage {
picture: string = AppGlobal.domain + '/wisdomgroup'; picture: string = AppGlobal.domain + '/wisdomgroup';
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
public commonSer:CommonService,
public tabsSer: TabsService, public emitSer: EmitService) { public tabsSer: TabsService, public emitSer: EmitService) {
// 接收发射过来的数据 // 接收发射过来的数据
this.emitSer.eventEmit.subscribe((value: any) => { this.emitSer.eventEmit.subscribe((value: any) => {
...@@ -159,6 +162,7 @@ export class DiscoverPage { ...@@ -159,6 +162,7 @@ export class DiscoverPage {
this.newsContent.nativeElement.scrollLeft = 0; //二级菜单滑动重置 this.newsContent.nativeElement.scrollLeft = 0; //二级菜单滑动重置
const index = item.indexParent; const index = item.indexParent;
this.indexParent = index; this.indexParent = index;
this.plateType = item.type;
this.childrenList = item.children; this.childrenList = item.children;
if(this.childrenList.length > 0) this.indexChildren = this.childrenList[0].indexChildren; if(this.childrenList.length > 0) this.indexChildren = this.childrenList[0].indexChildren;
let itemWidth = window.screen.width / 4; let itemWidth = window.screen.width / 4;
...@@ -170,7 +174,7 @@ export class DiscoverPage { ...@@ -170,7 +174,7 @@ export class DiscoverPage {
pageSize: 1, pageSize: 1,
pageCount: 100, pageCount: 100,
obj: { obj: {
'plateType': item.type, 'plateType': this.plateType,
'resourceType': 1 'resourceType': 1
} }
}; };
...@@ -232,4 +236,31 @@ export class DiscoverPage { ...@@ -232,4 +236,31 @@ export class DiscoverPage {
this.navCtrl.push(NoticePage); this.navCtrl.push(NoticePage);
} }
doRefresh(e){
const data = {
pageSize: 1,
pageCount: 100,
obj: {
'plateType': this.plateType,
'resourceType': 1
}
};
this.tabsSer.stuffPage(data).subscribe(
(res) => {
this.newList = res.data;
this.newList.forEach(e => {
if (e.attachments.length > 0) {
e.imgUrl = e.attachments[0].path;
}
})
this.commonSer.toastTime('刷新成功!',800)
e.complete();
}
)
}
doInfinite(e){
e.complete();
}
} }
...@@ -70,6 +70,12 @@ ...@@ -70,6 +70,12 @@
</div> </div>
<div class="main-news"> <div class="main-news">
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content pullingText="下拉刷新"
pullingIcon="arrow-dropdown"
refreshingSpinner="bubbles">
</ion-refresher-content>
</ion-refresher>
<ng-container *ngFor="let new of newList;"> <ng-container *ngFor="let new of newList;">
<ng-container *ngIf="new.imgUrl"> <ng-container *ngIf="new.imgUrl">
<ion-row class="news-item" (click)="goToDetail(new)"> <ion-row class="news-item" (click)="goToDetail(new)">
...@@ -97,6 +103,9 @@ ...@@ -97,6 +103,9 @@
</ion-row> </ion-row>
</ng-container> </ng-container>
</ng-container> </ng-container>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</div> </div>
</ion-content> </ion-content>
<!--政治生日--> <!--政治生日-->
......
...@@ -155,8 +155,6 @@ export class HomePage { ...@@ -155,8 +155,6 @@ export class HomePage {
}) })
} }
//关闭弹窗 开启跑马灯 //关闭弹窗 开启跑马灯
start() { start() {
const nowDay = this.datePipe.transform( new Date(),'yyyy-MM-dd' ); const nowDay = this.datePipe.transform( new Date(),'yyyy-MM-dd' );
...@@ -258,4 +256,12 @@ export class HomePage { ...@@ -258,4 +256,12 @@ export class HomePage {
this.navCtrl.push(NoticePage); this.navCtrl.push(NoticePage);
} }
doInfinite(e){
e.complete();
}
doRefresh(e){
e.complete();
}
} }
...@@ -60,6 +60,16 @@ export class CommonService{ ...@@ -60,6 +60,16 @@ export class CommonService{
} }
} }
//短暂提示提示
toastTime(message,duration) {
let toast = this.toastCtrl.create({
message: message,
duration: duration,
position:'middle',
dismissOnPageChange: true,
});
toast.present();
}
/** /**
* alert弹窗 * alert弹窗
* @param message 弹窗内的文字 * @param message 弹窗内的文字
......
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