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
...@@ -39,117 +39,125 @@ ...@@ -39,117 +39,125 @@
</block> </block>
</view> </view>
</view> </view>
<block a:if="{{more}}">
<view a:if="{{!moreLoading}}" onTap="getPagesMore" class="dynamicMore">
加载更多
</view>
<view a:else class="dynamicMore">
<image mode="scaleToFill" src="/assests/loading.gif"/>
</view>
</template>
</view>
</scroll-view>
<view class="noDate" a:else>
<template is="affair-placeholder" data="{{title: '展示安排的所有动态', tip: '实时同步所有事件的最新动态,便于随时处理工作内容'}}"/>
</view>
</block>
<template is="loading" a:else>
</template>
</view>
</view> </view>
</scroll-view> <view hidden="{{$data.tabBarIndex === '0'}}">
<view class="noDate" a:else> <view a:if="{{!loading}}">
<template is="affair-placeholder" data="{{title: '展示安排的所有动态', tip: '实时同步所有事件的最新动态,便于随时处理工作内容'}}"/> <view class="scheduleHeader">
</view> <view onTap="onOpenSiderBar">
</block> <template is="avater" data="{{item: userInfo }}"/></view>
<template is="loading" a:else> <view>{{currentData.split('/')[0]}}年{{currentData.split('/')[1] || '1'}}月</view>
</template> </view>
</view> <scroll-view class="indexScrollView" scroll-y="{{true}}" onScroll="scroll" lower-threshold="{{400}}" onScrollToLower="lower" scroll-into-view="{{todayStr}}">
</view> <block a:for="{{scheduleList}}" key="{{item.dateStr}}">
<view hidden="{{$data.tabBarIndex === '0'}}"> <!-- 年 -->
<view a:if="{{!loading}}"> <block a:if="{{item.type == 'year'}}">
<view class="scheduleHeader"> <view class="year li" id="{{item.dateStr}}">
<view onTap="onOpenSiderBar">
<template is="avater" data="{{item: userInfo }}"/></view>
<view>{{currentData.split('/')[0]}}年{{currentData.split('/')[1] || '1'}}月</view>
</view>
<scroll-view class="indexScrollView" scroll-y="{{true}}" onScroll="scroll" lower-threshold="{{400}}" onScrollToLower="lower" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" key="{{item.dateStr}}">
<!-- 年 -->
<block a:if="{{item.type == 'year'}}">
<view class="year li" id="{{item.dateStr}}">
{{item.value}}年 {{item.value}}年
</view> </view>
</block> </block>
<!-- 月 --> <!-- 月 -->
<block a:elif="{{item.type == 'month'}}"> <block a:elif="{{item.type == 'month'}}">
<view class="month li" id="{{item.dateStr}}"> <view class="month li" id="{{item.dateStr}}">
{{item.value}}月 {{item.value}}月
</view> </view>
</block> </block>
<!-- 周 --> <!-- 周 -->
<block a:elif="{{item.type == 'week'}}"> <block a:elif="{{item.type == 'week'}}">
<view class="week li" id="{{item.dateStr}}"> <view class="week li" id="{{item.dateStr}}">
{{item.value}} {{item.value}}
</view>
</block>
<!-- 天 -->
<block a:elif="{{item.type == 'day' || item.type == 'today'}}">
<view class="date li" id="{{ item.dateStr}}">
<view class="hasDateTitle {{item.value.isBeOverdue ? 'overdueLabel':''}} {{item.type == 'today' && item.hasDateLabel ? 'today' : ''}}">
<view>
{{item.week}}
</view>
<view>{{item.hasDateLabel}}</view>
</view>
<view class="scheduleBox {{item.value.isBeOverdue ? 'overdue' : item.value.confirmAttendance === 0 ? 'cancel' : ''}}" data-item="{{item.value}}" onTap="nextDetail">
<view class="scheduleTitle">
<text>{{item.value.title}}{{item.value.isDaySpan ? `(第${item.value.isFewDays}天,共${item.value.duration}天)` : '' }}</text>
</view>
<view class="scheduleTime">
<text a:if="{{item.value.isDaySpan && item.value.isfirstDayOrEndDay === '0'}}">{{item.value.thisDayStartTime}}</text>
<text a:elif="{{item.value.isDaySpan && item.value.isfirstDayOrEndDay === '1'}}">全天</text>
<text a:elif="{{item.value.isDaySpan && item.value.isfirstDayOrEndDay === '2'}}">{{ item.value.thisDayEndTime == '00:00' ? '全天' : '直到'+item.value.thisDayEndTime }}</text>
<text a:else>{{item.value.thisDayStartTime}} - {{item.value.thisDayEndTime}}</text>
</view>
</view>
</view>
</block>
<!-- 今天有无会议 -->
<block a:elif="{{item.type == 'thisday'}}">
<view class="date li" id="{{item.dateStr}}">
<view class="hasDateTitle today">
<view>
{{item.week}}
</view>
<view>{{item.hasDateLabel}}</view>
</view>
<view class="todayNoData">
<text>暂无会议安排,</text>
<text onTap="createMeeting">创建会议</text>
</view>
</view>
</block>
</block>
</scroll-view>
<popup show="{{show}}" onClose="closePop" position="left">
<related-app/>
</popup>
</view> </view>
<template is="loading" a:else>
</template>
</view>
</block> </block>
<!-- 天 --> <view class="tabBarContent">
<block a:elif="{{item.type == 'day' || item.type == 'today'}}"> <view class="tabBar">
<view class="date li" id="{{ item.dateStr}}"> <view onTap="changeTabBar" data-tabbar='0' data-title='动态'>
<view class="hasDateTitle {{item.value.isBeOverdue ? 'overdueLabel':''}} {{item.type == 'today' && item.hasDateLabel ? 'today' : ''}}"> <view class="tabBarView tabBarView1 {{$data.tabBarIndex === '0' ? 'ischooseTabBar' : ''}}">
<view> <view class="iconfont iconicon_dynamic"></view>
{{item.week}} <view>动态</view>
</view>
<view>{{item.hasDateLabel}}</view>
</view>
<view class="scheduleBox {{item.value.isBeOverdue ? 'overdue' : item.value.confirmAttendance === 0 ? 'cancel' : ''}}" data-item="{{item.value}}" onTap="nextDetail">
<view class="scheduleTitle">
<text>{{item.value.title}}{{item.value.isDaySpan ? `(第${item.value.isFewDays}天,共${item.value.duration}天)` : '' }}</text>
</view>
<view class="scheduleTime">
<text a:if="{{item.value.isDaySpan && item.value.isfirstDayOrEndDay === '0'}}">{{item.value.thisDayStartTime}}</text>
<text a:elif="{{item.value.isDaySpan && item.value.isfirstDayOrEndDay === '1'}}">全天</text>
<text a:elif="{{item.value.isDaySpan && item.value.isfirstDayOrEndDay === '2'}}">{{ item.value.thisDayEndTime == '00:00' ? '全天' : '直到'+item.value.thisDayEndTime }}</text>
<text a:else>{{item.value.thisDayStartTime}} - {{item.value.thisDayEndTime}}</text>
</view> </view>
</view> </view>
</view> <view onTap="changeTabBar" data-tabbar='1' data-title='安排'>
</block> <view class="tabBarView tabBarView2 {{$data.tabBarIndex === '1' ? 'ischooseTabBar' : ''}}">
<!-- 今天有无会议 --> <view class="iconfont iconicon_Calendarbox1">
<block a:elif="{{item.type == 'thisday'}}"> <text a:if="{{offset == 'before'}}" class="iconfont iconicon_days iconicon_open">
<view class="date li" id="{{item.dateStr}}"> </text>
<view class="hasDateTitle today"> <text a:elif="{{offset == 'next'}}" class="iconfont iconicon_days iconicon_Packup">
<view> </text>
{{item.week}} <text a:else class="iconfont iconicon_days iconicon_days{{iconDay}}">
</text>
</view>
<view>安排</view>
</view> </view>
<view>{{item.hasDateLabel}}</view>
</view> </view>
<view class="todayNoData"> <view class="createMeeting" onTap="createMeeting">
<text>暂无会议安排,</text> <text class="iconfont iconicon_add1"></text>
<text onTap="createMeeting">创建会议</text>
</view> </view>
</view> </view>
</block> <template is="fullScreen" data="{{isIPX:isIPX}}" />
</block> </view>
</scroll-view> <popup className="square" position="left" show="{{popupShow}}" mask="true" onClose="closePopup">
<popup show="{{show}}" onClose="closePop" position="left"> <setting onClose="closePopup"/>
<related-app/> </popup>
</popup> \ No newline at end of file
</view>
<template is="loading" a:else>
</template>
</view>
</block>
<view class="tabBarContent">
<view class="tabBar">
<view onTap="changeTabBar" data-tabbar='0' data-title='动态'>
<view class="tabBarView tabBarView1 {{$data.tabBarIndex === '0' ? 'ischooseTabBar' : ''}}">
<view class="iconfont iconicon_dynamic"></view>
<view>动态</view>
</view>
</view>
<view onTap="changeTabBar" data-tabbar='1' data-title='安排'>
<view class="tabBarView tabBarView2 {{$data.tabBarIndex === '1' ? 'ischooseTabBar' : ''}}">
<view class="iconfont iconicon_Calendarbox1">
<text a:if="{{offset == 'before'}}" class="iconfont iconicon_days iconicon_open">
</text>
<text a:elif="{{offset == 'next'}}" class="iconfont iconicon_days iconicon_Packup">
</text>
<text a:else class="iconfont iconicon_days iconicon_days{{iconDay}}">
</text>
</view>
<view>安排</view>
</view>
</view>
<view class="createMeeting" onTap="createMeeting">
<text class="iconfont iconicon_add1"></text>
</view>
</view>
<template is="fullScreen" data="{{isIPX:isIPX}}" />
</view>
<popup className="square" position="left" show="{{popupShow}}" mask="true" onClose="closePopup">
<setting onClose="closePopup"/>
</popup>
\ 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