Commit d44bd85e authored by wangqinghua's avatar wangqinghua

我的发布 我的收藏 下拉刷新 上滑加载更多

parent 77bba691
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -394,7 +394,7 @@ a[disabled], button[disabled], [ion-button][disabled],
.noData{
text-align: center;
color: #999;
padding-bottom: 5px;
padding-bottom: 20px;
}
//相机的actionsheet
......
......@@ -271,11 +271,32 @@ export class PublishPage {
{
text: '预览',
handler: () => {
let attachmentsArr = [];
let content = this.obj.content;
if(this.fileList.length > 0){
if(this.type == 'image'){ //将第一张图片作为标题图片 ,后面的图片 作为文章里面的图片
const obj = {
resourceType:1,
path: this.fileList[0].path,
name: this.fileList[0].name,
};
attachmentsArr = this.fileList.splice(1,this.fileList.length -1);
attachmentsArr.forEach(e=>{
content += `<br><img src="/wisdomgroup/${e.path} " alt="图片">`;
});
this.fileList = [obj];
}
}
if(this.type == 'video'){
this.fileList.forEach(e=>{
e.resourceType = 3;
})
}
const obj = {
title:this.obj.title,
source: '上海市委组织部',
publishTime:new Date().getTime(),
content:this.obj.content,
content:content,
attachments:this.fileList,
}
this.navCtrl.push('PreviewPage',{
......
<ion-header>
<ion-navbar>
......@@ -9,6 +8,11 @@
<ion-content>
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content pullingText="下拉刷新"
refreshingSpinner="bubbles">
</ion-refresher-content>
</ion-refresher>
<div class="main-news">
<ng-container *ngFor="let new of collectionList;">
<ng-container *ngIf="new.imgUrl">
......@@ -16,10 +20,9 @@
<ion-col col-8 class="news-left">
<p class="news-title">
{{new.title}}
<ion-icon *ngIf="new.topTime" class="icon-fire iconfont"></ion-icon>
</p>
<p class="news-end">
<span>收藏时间:</span><span>{{new.publishTime | date:'yyyy-MM-dd'}}</span>
<!-- <span>收藏时间:</span><span>{{new.publishTime | date:'yyyy-MM-dd'}}</span>-->
</p>
</ion-col>
<ion-col col-4 class="news-right">
......@@ -32,14 +35,25 @@
<ion-col col-12 class="news-left">
<p class="news-title">
{{new.title}}
<ion-icon *ngIf="new.topTime" class="icon-fire iconfont"></ion-icon>
</p>
<p class="news-end">
<span>收藏时间:</span><span>{{new.publishTime | date:'yyyy-MM-dd'}}</span>
<!-- <span>收藏时间:</span><span>{{new.publishTime | date:'yyyy-MM-dd'}}</span>-->
</p>
</ion-col>
</ion-row>
</ng-container>
</ng-container>
<ion-list text-center style="margin-top: 10rem" *ngIf="!isLoad && collectionList.length == 0">
<img style="width: 20%;" src="./assets/imgs/no-info.png" alt="">
<p text-center>
暂无收藏
</p>
</ion-list>
</div>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="加载中"></ion-infinite-scroll-content>
</ion-infinite-scroll>
<p class="noData" *ngIf="!loadMore">你已经看到我的底线了</p>
</ion-content>
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {Component, ViewChild} from '@angular/core';
import {InfiniteScrollContent, IonicPage, NavController, NavParams} from 'ionic-angular';
import {MineService} from "../mine.service";
import {AppGlobal} from "../../../service/http.service";
import {StuffDetailPage} from "../../home-pages/stuff-detail/stuff-detail";
import {CommonService} from "../../../provide/common.service";
@IonicPage()
@Component({
......@@ -10,14 +11,18 @@ import {StuffDetailPage} from "../../home-pages/stuff-detail/stuff-detail";
templateUrl: 'my-collection.html',
})
export class MyCollectionPage {
@ViewChild(InfiniteScrollContent) infiniteScrollContent:InfiniteScrollContent;
pageNum = 1;
pageCount = AppGlobal.pageCount;
pageCount = 10;
collectionList = [];
picture: string = AppGlobal.domain + '/wisdomgroup';
isLoad = true;
loadMore = true;
totalNum; //总条数
constructor(public navCtrl: NavController, public navParams: NavParams,
public mineSer: MineService) {
public mineSer: MineService,public commonSer:CommonService) {
}
ionViewDidEnter() {
......@@ -32,6 +37,53 @@ export class MyCollectionPage {
this.mineSer.myCollection(data).subscribe(
(res) => {
this.collectionList = res.data.list;
this.isLoad = false;
this.totalNum = res.data.total;
}
)
}
//下拉刷新
doRefresh(e){
this.loadMore = true;
this.infiniteScrollContent.inf.enable(true);
const data = {
pageNum: 1,
pageCount: this.pageCount
};
this.mineSer.myCollection(data).subscribe(
(res) => {
this.collectionList = res.data.list;
this.totalNum = res.data.total;
setTimeout(()=>{
this.commonSer.toast('刷新成功')
e.complete()
},800);
}
)
}
//加载更多
doInfinite(e){
if(this.totalNum == this.collectionList.length ){
this.loadMore = false;
e.enable(false);
return false;
}
this.pageNum ++;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount
};
this.mineSer.myCollection(data).subscribe(
(res) => {
this.totalNum = res.data.total;
res.data.list.forEach(e=>{
this.collectionList.push(e);
});
setTimeout(()=>{
e.complete()
},800);
}
)
}
......
......@@ -8,6 +8,11 @@
<ion-content>
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content pullingText="下拉刷新"
refreshingSpinner="bubbles">
</ion-refresher-content>
</ion-refresher>
<div class="main-news">
<ng-container *ngFor="let new of publicList;">
<ng-container *ngIf="new.imgUrl">
......@@ -40,5 +45,17 @@
</ion-row>
</ng-container>
</ng-container>
<ion-list text-center style="margin-top: 10rem" *ngIf=" !isLoad && publicList.length == 0">
<img style="width: 20%;" src="./assets/imgs/no-info.png" alt="">
<p text-center>
暂无发布
</p>
</ion-list>
</div>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="加载中"></ion-infinite-scroll-content>
</ion-infinite-scroll>
<p class="noData" *ngIf="!loadMore">你已经看到我的底线了</p>
</ion-content>
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {Component, ViewChild} from '@angular/core';
import {InfiniteScrollContent, IonicPage, NavController, NavParams} from 'ionic-angular';
import {AppGlobal} from "../../../service/http.service";
import {MineService} from "../mine.service";
import {StuffDetailPage} from "../../home-pages/stuff-detail/stuff-detail";
import {CommonService} from "../../../provide/common.service";
/**
* Generated class for the MyPublishPage page.
......@@ -17,13 +18,18 @@ import {StuffDetailPage} from "../../home-pages/stuff-detail/stuff-detail";
templateUrl: 'my-publish.html',
})
export class MyPublishPage {
@ViewChild(InfiniteScrollContent) infiniteScrollContent:InfiniteScrollContent;
pageNum = 1;
pageCount = AppGlobal.pageCount;
publicList = [];
picture: string = AppGlobal.domain + '/wisdomgroup';
isLoad = true;
totalNum;
loadMore = true;
constructor(public navCtrl: NavController, public navParams: NavParams,
public mineSer:MineService) {
public mineSer:MineService,public commonSer:CommonService) {
}
ionViewDidLoad() {
......@@ -38,6 +44,53 @@ export class MyPublishPage {
this.mineSer.myPublish(data).subscribe(
(res)=>{
this.publicList = res.data.list;
this.isLoad = false;
this.totalNum = res.data.total;
}
)
}
//下拉刷新
doRefresh(e){
this.loadMore = true;
this.infiniteScrollContent.inf.enable(true);
const data = {
pageNum: 1,
pageCount: this.pageCount
};
this.mineSer.myPublish(data).subscribe(
(res) => {
this.publicList = res.data.list;
this.totalNum = res.data.total;
setTimeout(()=>{
this.commonSer.toast('刷新成功')
e.complete()
},800);
}
)
}
//加载更多
doInfinite(e){
if(this.totalNum == this.publicList.length ){
this.loadMore = false;
e.enable(false);
return false;
}
this.pageNum ++;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount
};
this.mineSer.myPublish(data).subscribe(
(res) => {
this.totalNum = res.data.total;
res.data.list.forEach(e=>{
this.publicList.push(e);
});
setTimeout(()=>{
e.complete()
},800);
}
)
}
......
......@@ -15,6 +15,7 @@
<div class="photo-box" (click)="tackePic()">
<img *ngIf="user?.userDetail?.user?.picUrl == ''" src="./assets/imgs/head.png" class="img">
<img *ngIf="user?.userDetail?.user?.picUrl != ''" src="{{picture+user?.userDetail?.user?.picUrl}}" class="img">
<ion-icon name="ios-arrow-forward"></ion-icon>
</div>
</div>
</ion-item>
......
page-personInfo {
.searchToolBar{
.searchToolBar {
display: flex;
flex-direction: row;
align-items: center;
......@@ -7,11 +7,11 @@ page-personInfo {
box-sizing: border-box;
}
.content{
.content {
background-color: #f1f1f1;
}
.info-item{
.info-item {
display: flex;
flex-direction: row;
align-items: center;
......@@ -19,53 +19,59 @@ page-personInfo {
box-sizing: border-box;
}
.img{
width: 40px;
height: 40px;
.img {
width: 50px;
border-radius: 5px;
}
.info{
.info {
font-size: 18px;
color: #272727;
margin-right: 15px;
}
.contact-sex{
.contact-sex {
font-size: 16px;
font-weight: bold;
}
.male{
.male {
color: #72a4fe;
}
.female{
.female {
color: #f09ae5;
}
.photo-box{
.photo-box {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
ion-icon {
margin-left: 10px;
color: #747474;
font-size: 1.4rem;
}
}
.icon-more{
.icon-more {
color: #d1d1d5;
margin-left: 5px;
}
.info-span{
.info-span {
color: #747474;
}
.edit{
.edit {
width: 30px;
height: 30px;
}
.content-title{
.content-title {
background-color: #f5f5f5;
font-size: 14px;
color: #b2b2b2;
......@@ -74,21 +80,22 @@ page-personInfo {
padding-bottom: 5px;
}
.list-ios{
.list-ios {
margin: 0 0;
}
.save{
.save {
margin-top: 30px;
}
.info-item-content{
.info-item-content {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
img{
img {
width: 1.5rem;
height: 1.5rem;
}
......@@ -96,16 +103,16 @@ page-personInfo {
}
.list-md {
margin: -1px 0 0px;
}
.back-btn{
.back-btn {
width: 30px;
height: 30px;
}
.submit{
.submit {
margin-top: 20px;
border: 1px solid #34b4fc;
background-color: #34b4fc;
......
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