Commit b3c644a7 by zhouweifeng

feat 动态列表 接口

parent 5627f248
...@@ -426,4 +426,16 @@ ...@@ -426,4 +426,16 @@
.tabBarView .iconicon_days { .tabBarView .iconicon_days {
color: #FFFFFF !important; color: #FFFFFF !important;
}
.dynamicMore {
text-align: center;
margin-top: 32rpx;
color: rgba(27, 38, 61, .3);
font-size: 28rpx;
}
.dynamicMore image {
width: 50rpx;
height: 50rpx;
} }
\ No newline at end of file
...@@ -67,6 +67,8 @@ create.Page({ ...@@ -67,6 +67,8 @@ create.Page({
pages: 1, pages: 1,
listLoading: true, listLoading: true,
isIPX: checkFullScren(), isIPX: checkFullScren(),
more: false,
moreLoading: false
}, },
scrollTop: 0, scrollTop: 0,
pageSize: 10, pageSize: 10,
...@@ -84,6 +86,7 @@ create.Page({ ...@@ -84,6 +86,7 @@ create.Page({
todayIndex: 0, todayIndex: 0,
onShow() { onShow() {
//刷新动态列表 //刷新动态列表
console.log(this.$store.data.isIndexAffairListNeedUpdate)
if (this.$store.data.isIndexAffairListNeedUpdate) { if (this.$store.data.isIndexAffairListNeedUpdate) {
this.getPages(1); this.getPages(1);
this.$store.data.isIndexAffairListNeedUpdate = false; this.$store.data.isIndexAffairListNeedUpdate = false;
...@@ -320,13 +323,40 @@ create.Page({ ...@@ -320,13 +323,40 @@ create.Page({
this.onLoad(); this.onLoad();
}, },
getPages(current, callBack) { getPages(current, callBack) {
getDynamicList() getDynamicList({ before: 'yes' })
.then(res => { .then(res => {
if (!res.data.data) { if ((!res.data.data || res.data.data.length === 0) && res.data.msg === 'yes') {
this.setData({ getDynamicList({ before: 'no' }).then(res => {
listLoading: false, if (!res.data.data || res.data.data.length === 0) {
dynamicList: [] this.setData({
}); listLoading: false,
more: false,
dynamicList: []
});
} else {
const dynamicList = res.data.data.map((item, index) => {
for (let i = 0; i < item.commentListDataModelList.length; i++) {
let itemData = item.commentListDataModelList[i];
if (itemData.updateTime) {
itemData.updateTime = getCreateShowTime(itemData.updateTime);
}
if (itemData.notes) {
itemData.notes = removeHtml(itemData.notes)
}
}
return item;
});
this.setData({
dynamicList,
listLoading: false,
more: false,
});
if (callBack) {
callBack();
}
}
})
return; return;
} }
const dynamicList = res.data.data.map((item, index) => { const dynamicList = res.data.data.map((item, index) => {
...@@ -338,13 +368,58 @@ create.Page({ ...@@ -338,13 +368,58 @@ create.Page({
if (itemData.notes) { if (itemData.notes) {
itemData.notes = removeHtml(itemData.notes) itemData.notes = removeHtml(itemData.notes)
} }
}
return item;
});
const more = res.data.msg === 'yes'
this.setData({
dynamicList,
listLoading: false,
more,
});
if (callBack) {
callBack();
}
})
.catch(err => {
if (err && err.refresh) {
this.setData({
refresh: true
});
}
});
},
getPagesMore(current, callBack) {
this.setData({
moreLoading: true,
});
getDynamicList({ before: 'no' })
.then(res => {
if (!res.data.data || res.data.data.length === 0) {
return
}
let dynamicList = this.data.dynamicList.concat(res.data.data.map((item, index) => {
for (let i = 0; i < item.commentListDataModelList.length; i++) {
let itemData = item.commentListDataModelList[i];
if (itemData.updateTime) {
itemData.updateTime = getCreateShowTime(itemData.updateTime);
}
if (itemData.notes) {
itemData.notes = removeHtml(itemData.notes)
}
} }
return item; return item;
}))
dynamicList = dynamicList.filter((el, index) => {
if (dynamicList.findIndex(ele => ele.meetingId === el.meetingId) === index) {
return true;
}
}); });
this.setData({ this.setData({
dynamicList, dynamicList,
listLoading: false moreLoading: false,
more: false
}); });
if (callBack) { if (callBack) {
callBack(); callBack();
......
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