Commit 69aad08e by xiexiaoqin

fix: 刷新时不跳到当前日期

parent 19646474
...@@ -3,7 +3,6 @@ Component({ ...@@ -3,7 +3,6 @@ Component({
data: {}, data: {},
props: {}, props: {},
didMount() { didMount() {
console.log(this.props.centerPopupList)
}, },
didUpdate() { }, didUpdate() { },
didUnmount() { }, didUnmount() { },
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
</view> </view>
<view>{{item.hasDateLabel}}</view> <view>{{item.hasDateLabel}}</view>
</view> </view>
<view class="scheduleBox {{item.value.isBeOverdue ? 'overdue' : item.value.confirmAttendance === 0 ? 'cancel' : ''}}" data-item="{{item.value}}" onTap="nextDetail"> <view class="scheduleBox {{item.value.isBeOverdue ? 'overdue' : item.value.confirmAttendance === 0 ? 'cancel' : ''}}" data-item="{{item.value}}" data-index="{{index}}" onTap="nextDetail">
<view class="scheduleTitle"> <view class="scheduleTitle">
<text>{{item.value.title}}{{item.value.isDaySpan ? `(第${item.value.isFewDays}天,共${item.value.duration}天)` : '' }}</text> <text>{{item.value.title}}{{item.value.isDaySpan ? `(第${item.value.isFewDays}天,共${item.value.duration}天)` : '' }}</text>
</view> </view>
......
...@@ -46,7 +46,8 @@ create.Page({ ...@@ -46,7 +46,8 @@ create.Page({
current: 1, current: 1,
pages: 1, pages: 1,
listLoading: true, listLoading: true,
isIPX: checkFullScren() isIPX: checkFullScren(),
scheduleListIndex: ''
}, },
scrollTop: 0, scrollTop: 0,
pageSize: 10, pageSize: 10,
...@@ -63,23 +64,16 @@ create.Page({ ...@@ -63,23 +64,16 @@ create.Page({
todayIndex: 0, todayIndex: 0,
onShow() { onShow() {
//如果是重复会议重新算 //单次会议往DateMap中添加
if (this.$store.data.indexNeedUpdate) { if (this.$store.data.onceMeetingContent) {
dd.setNavigationBar({ dd.setNavigationBar({
title: "日程" title: "日程"
}); });
DateMap = getDateMap(this.minYear, this.maxYear);
this.getData();
this.isFirstLoad = true;
this.$store.data.indexNeedUpdate = false;
this.update();
}
//单次会议往DateMap中添加
if (this.$store.data.onceMeetingContent) {
this.getScheduleList(this.$store.data.onceMeetingContent, "once"); this.getScheduleList(this.$store.data.onceMeetingContent, "once");
this.$store.data.onceMeetingContent = null; this.$store.data.onceMeetingContent = null;
this.update(); this.update();
} }
//刷新动态列表 //刷新动态列表
if (this.$store.data.isIndexAffairListNeedUpdate) { if (this.$store.data.isIndexAffairListNeedUpdate) {
this.getPages(1); this.getPages(1);
...@@ -91,6 +85,31 @@ create.Page({ ...@@ -91,6 +85,31 @@ create.Page({
this.getData() this.getData()
}, 30000) }, 30000)
}, },
//修改重复会议
modifyErpeatMeeting() {
this.getData();
},
//修改会议,除单次会议修改成重复会议
modifyOnceMeetingContent(content) {
this.getData(true);
const scheduleListIndex = `scheduleList[${this.data.scheduleListIndex}].value`;
const item = this.data.scheduleList[this.data.scheduleListIndex].value
this.setData({
[scheduleListIndex]: {
...item,
...content
}
});
for (let i = 0; i < this.scheduleList.length; i++) {
if (typeof this.scheduleList[i].value !== 'string') {
if (this.scheduleList[i].value.id === item.id) {
this.scheduleList[i].value = { ...this.scheduleList[i].value, ...content };
break;
}
}
}
},
onHide() { onHide() {
clearInterval(this.timer); clearInterval(this.timer);
this.timer = null; this.timer = null;
...@@ -114,11 +133,19 @@ create.Page({ ...@@ -114,11 +133,19 @@ create.Page({
dd.setNavigationBar({ dd.setNavigationBar({
title: "动态" title: "动态"
}); });
this.isFirstLoad = true;
//获取动态列表 //获取动态列表
this.getPages(1); this.getPages(1);
//获取日程列表 //获取日程列表
this.getData(); this.getData();
this.isFirstLoad = true;
this.$store.modifyOnceMeetingContent = (content) => {
this.modifyOnceMeetingContent(content);
}
this.$store.modifyErpeatMeeting = () => {
this.modifyErpeatMeeting()
}
this.update();
}, },
//动态列表侧滑的时候禁止页面上下滑动 //动态列表侧滑的时候禁止页面上下滑动
setBodyDisableScroll(isStopBodyScroll) { setBodyDisableScroll(isStopBodyScroll) {
...@@ -298,19 +325,50 @@ create.Page({ ...@@ -298,19 +325,50 @@ create.Page({
} }
} }
}, },
getData() { getData(onlyChangeSign) {
getHomeUserSchedule1({ getHomeUserSchedule1({
startTime: "2020-01-01 00:00:00", startTime: "2020-01-01 00:00:00",
endTime: "2025-12-30 23:59:59" endTime: "2025-12-30 23:59:59"
}).then(res => { }).then(res => {
//是否刷新页面
if (this.data.sign && res.data.data.sign !== this.data.sign) { //只修改sign, 防止30S后刷新页面
DateMap = getDateMap(this.minYear, this.maxYear); if (onlyChangeSign) {
console.log('只修改sign')
this.setData({
sign: res.data.data.sign
})
return
} }
if (res.data.data.sign !== this.data.sign) { //第一次加载
if (this.isFirstLoad) {
console.log('第一次加载')
this.getScheduleList(res.data.data); this.getScheduleList(res.data.data);
this.getPagination(this.scheduleList);
this.setData({
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
),
loading: false
});
this.backToToday("first");
} }
//定时任务是否刷新页面
if (this.data.sign && res.data.data.sign !== this.data.sign) {
console.log('刷新页面')
DateMap = getDateMap(this.minYear, this.maxYear);
this.getScheduleList(res.data.data);
this.setData({
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
),
loading: false
});
}
this.setData({ this.setData({
sign: res.data.data.sign sign: res.data.data.sign
}) })
...@@ -452,7 +510,7 @@ create.Page({ ...@@ -452,7 +510,7 @@ create.Page({
} }
}, },
//日程数据 //日程数据
getScheduleList(response, type) { getScheduleList(response, type, changePagination) {
if (type == "once") { if (type == "once") {
this.setDateMapValue(response.startTime, response.endTime, response); this.setDateMapValue(response.startTime, response.endTime, response);
} else { } else {
...@@ -534,17 +592,28 @@ create.Page({ ...@@ -534,17 +592,28 @@ create.Page({
}); });
this.scheduleList = DateList; this.scheduleList = DateList;
this.getPagination(this.scheduleList); // if (changePagination) {
// 第一次加载 // this.setData({
this.setData({ // scheduleList: this.scheduleList.slice(
scheduleList: this.scheduleList.slice( // this.firstPage * this.pageSize,
this.firstPage * this.pageSize, // this.currentPage * this.pageSize
this.currentPage * this.pageSize // ),
), // loading: false
loading: false // });
}); // return
//定位到当前日期 // }
this.backToToday("first");
// this.getPagination(this.scheduleList);
// // 第一次加载
// this.setData({
// scheduleList: this.scheduleList.slice(
// this.firstPage * this.pageSize,
// this.currentPage * this.pageSize
// ),
// loading: false
// });
// //定位到当前日期
// this.backToToday("first");
}, },
//日程上拉加载 //日程上拉加载
lower() { lower() {
...@@ -728,9 +797,15 @@ create.Page({ ...@@ -728,9 +797,15 @@ create.Page({
dd.navigateTo({ url: "./../createMeeting/createMeeting" }); dd.navigateTo({ url: "./../createMeeting/createMeeting" });
}, },
nextDetail: throttle(function (e) { nextDetail: throttle(function (e) {
const { item, index } = e.target.dataset;
if (index) {
this.setData({
scheduleListIndex: index
})
}
dd.navigateTo({ dd.navigateTo({
url: `./../meetingDetail/meetingDetail?scheduleItem=${encodeURIComponent( url: `./../meetingDetail/meetingDetail?scheduleItem=${encodeURIComponent(
JSON.stringify(e.target.dataset.item) JSON.stringify(item)
)}` )}`
}); });
}, 1000), }, 1000),
......
...@@ -651,8 +651,14 @@ create.Page({ ...@@ -651,8 +651,14 @@ create.Page({
return new Promise((resolve, rejects) => { return new Promise((resolve, rejects) => {
modifySchedule(Object.assign(data, obj)).then(res => { modifySchedule(Object.assign(data, obj)).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
that.$store.data.indexNeedUpdate = true // that.$store.data.indexNeedUpdate = true
that.update() // that.update()
if (data.modifyContent !== 'title') {
if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
}
if (this.$store.data.originalData.repeatable === 1 && !!res.data.data) { if (this.$store.data.originalData.repeatable === 1 && !!res.data.data) {
observer.notice(res.data.data) observer.notice(res.data.data)
} }
...@@ -748,12 +754,21 @@ create.Page({ ...@@ -748,12 +754,21 @@ create.Page({
} }
isParticipate(data1).then(res => { isParticipate(data1).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$store.data.indexNeedUpdate = true // this.$store.data.indexNeedUpdate = true
this.update() // this.update()
this.setData({ this.setData({
confirmAttendance: 0 confirmAttendance: 0
}) })
this.conflictPeople() this.conflictPeople()
if (data1.type === 'only') {
if (this.$store.modifyOnceMeetingContent) {
this.$store.modifyOnceMeetingContent({ confirmAttendance: 0 })
}
} else {
if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
}
} }
}) })
break break
...@@ -767,14 +782,23 @@ create.Page({ ...@@ -767,14 +782,23 @@ create.Page({
} }
isParticipate(data).then(res => { isParticipate(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$store.data.indexNeedUpdate = true // this.$store.data.indexNeedUpdate = true
this.update() // this.update()
this.setData({ this.setData({
aheadTimes: [15], aheadTimes: [15],
'comListData.aheadTimesListId': [15], 'comListData.aheadTimesListId': [15],
confirmAttendance: 1 confirmAttendance: 1
}) })
this.conflictPeople() this.conflictPeople()
if (data.type === 'only') {
if (this.$store.modifyOnceMeetingContent) {
this.$store.modifyOnceMeetingContent({ confirmAttendance: 1 })
}
} else {
if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
}
} }
}) })
break break
...@@ -794,7 +818,10 @@ create.Page({ ...@@ -794,7 +818,10 @@ create.Page({
planDate: this.data.scheduleItem.planDate planDate: this.data.scheduleItem.planDate
} }
deleteSchedule(data).then(res => { deleteSchedule(data).then(res => {
_that.$store.data.indexNeedUpdate = true; if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
// _that.$store.data.indexNeedUpdate = true;
_that.$store.data.isIndexAffairListNeedUpdate = true; _that.$store.data.isIndexAffairListNeedUpdate = true;
_that.update() _that.update()
dd.navigateBack({ dd.navigateBack({
...@@ -903,8 +930,21 @@ create.Page({ ...@@ -903,8 +930,21 @@ create.Page({
modifyContent: 'title' modifyContent: 'title'
} }
this.modifySchedule(dataTitle).then(res => { this.modifySchedule(dataTitle).then(res => {
this.$store.data.isIndexAffairListNeedUpdate = true this.$store.data.isIndexAffairListNeedUpdate = true;
this.$store.data.originalData.title = this.data.title this.$store.data.originalData.title = this.data.title
if (this.data.repeatable == 0) {
if (this.$store.modifyOnceMeetingContent) {
this.$store.modifyOnceMeetingContent({
title: this.data.title
})
}
} else {
if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
}
this.update() this.update()
}).catch(err => { }).catch(err => {
this.setData({ this.setData({
...@@ -1214,7 +1254,11 @@ create.Page({ ...@@ -1214,7 +1254,11 @@ create.Page({
deleteModel: 'only' deleteModel: 'only'
} }
deleteSchedule(data).then(res => { deleteSchedule(data).then(res => {
_that.$store.data.indexNeedUpdate = true;
// _that.$store.data.indexNeedUpdate = true;
if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
_that.$store.data.isIndexAffairListNeedUpdate = true; _that.$store.data.isIndexAffairListNeedUpdate = true;
_that.update() _that.update()
dd.navigateBack({ dd.navigateBack({
...@@ -1241,14 +1285,20 @@ create.Page({ ...@@ -1241,14 +1285,20 @@ create.Page({
} else { } else {
isParticipate(data).then(res => { isParticipate(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$store.data.indexNeedUpdate = true // this.$store.data.indexNeedUpdate = true
this.update()
// this.update()
this.setData({ this.setData({
aheadTimes: [15], aheadTimes: [15],
'comListData.aheadTimesListId': [15], 'comListData.aheadTimesListId': [15],
confirmAttendance: 1 confirmAttendance: 1
}) })
this.conflictPeople() this.conflictPeople()
if (this.$store.modifyOnceMeetingContent) {
this.$store.modifyOnceMeetingContent({ confirmAttendance: 1 })
}
} }
}) })
} }
...@@ -1268,12 +1318,15 @@ create.Page({ ...@@ -1268,12 +1318,15 @@ create.Page({
} else { } else {
isParticipate(data).then(res => { isParticipate(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$store.data.indexNeedUpdate = true // this.$store.data.indexNeedUpdate = true
this.update() // this.update()
this.setData({ this.setData({
confirmAttendance: 0 confirmAttendance: 0
}) })
this.conflictPeople() this.conflictPeople()
if (this.$store.modifyOnceMeetingContent) {
this.$store.modifyOnceMeetingContent({ confirmAttendance: 0 })
}
} }
}) })
} }
...@@ -1294,12 +1347,22 @@ create.Page({ ...@@ -1294,12 +1347,22 @@ create.Page({
} }
isParticipate(data).then(res => { isParticipate(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
this.$store.data.indexNeedUpdate = true // this.$store.data.indexNeedUpdate = true
this.update() // this.update()
this.setData({ this.setData({
confirmAttendance: -9 confirmAttendance: -9
}) })
this.conflictPeople() this.conflictPeople()
if (this.data.repeatable === 1) {
if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
} else {
if (this.$store.modifyOnceMeetingContent) {
this.$store.modifyOnceMeetingContent({ confirmAttendance: -9 })
}
}
} }
}) })
}, },
......
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