Commit 31734c66 by xiexiaoqin

fix: 创建会议刷新页面

parent 33dd6440
......@@ -24,7 +24,6 @@ Component({
didUnmount() { },
methods: {
comSelectList(event) {
console.log(event, 2222)
if (this.props.multiple && event.currentTarget.dataset.item.id != -1) {
if (this.data.comSelectList.includes(-1)) {
this.setData({
......
......@@ -343,17 +343,29 @@ create.Page({
if (res.data.code === 0) {
this.$store.data.tabBarIndex = '1'
if (this.data.repeatable === 0) {
this.$store.data.onceMeetingContent = {
// this.$store.data.onceMeetingContent = {
// startTime: new Date(this.$store.data.startTime),
// endTime: new Date(this.$store.data.endTime),
// confirmAttendance: res.data.data.confirmAttendance,
// title: res.data.data.title,
// id: res.data.data.id
// }
if (this.$store.addOnceMeeting) {
this.$store.addOnceMeeting({
startTime: new Date(this.$store.data.startTime),
endTime: new Date(this.$store.data.endTime),
confirmAttendance: res.data.data.confirmAttendance,
title: res.data.data.title,
id: res.data.data.id
})
}
} else {
this.$store.data.indexNeedUpdate = true
if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
// this.$store.data.indexNeedUpdate = true
}
console.log(this.$store.data.onceMeetingContent)
this.update()
dd.navigateBack({
......
......@@ -57,19 +57,64 @@ create.Page({
scheduleList: [],
timer: null,
isFirstLoad: true,
isLoaded: false,
blankDataLength: 0,
blankDataLengthAfter: 0,
minYear: minYear,
maxYear: maxYear,
todayIndex: 0,
onShow() {
//刷新动态列表
if (this.$store.data.isIndexAffairListNeedUpdate) {
this.getPages(1);
this.$store.data.isIndexAffairListNeedUpdate = false;
this.update();
}
//开启一个定时器
this.timer = setInterval(() => {
this.getData();
}, 30000);
},
onLoad(query) {
console.log(query);
if (query && JSON.stringify(query) !== "{}") {
this.setData({
listLoading: false
});
const scheduleItem = JSON.parse(Object.keys(query)[0].split("=")[1]);
dd.navigateTo({
url: `./../meetingDetail/meetingDetail?scheduleItem=${encodeURIComponent(
JSON.stringify(scheduleItem)
)}`
});
}
dd.setNavigationBar({
title: "动态"
});
this.isFirstLoad = true;
//获取动态列表
this.getPages(1);
//获取日程列表
this.getData();
//单次会议往DateMap中添加
if (this.$store.data.onceMeetingContent) {
this.$store.modifyOnceMeetingContent = (content) => {
this.modifyOnceMeetingContent(content);
}
this.$store.modifyErpeatMeeting = () => {
this.modifyErpeatMeeting()
}
this.$store.addOnceMeeting = (content) => {
this.addOnceMeeting(content)
}
this.update();
},
//添加单次会议
addOnceMeeting(content) {
this.getData(true);
dd.setNavigationBar({
title: "日程"
});
this.getScheduleList(this.$store.data.onceMeetingContent, "once");
this.getScheduleList(content, "once");
this.setData({
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
......@@ -77,20 +122,6 @@ create.Page({
),
loading: false
});
this.$store.data.onceMeetingContent = null;
this.update();
}
//刷新动态列表
if (this.$store.data.isIndexAffairListNeedUpdate) {
this.getPages(1);
this.$store.data.isIndexAffairListNeedUpdate = false;
this.update();
}
//开启一个定时器
this.timer = setInterval(() => {
this.getData();
}, 30000);
},
//修改重复会议
modifyErpeatMeeting() {
......@@ -117,42 +148,67 @@ create.Page({
}
}
},
onHide() {
clearInterval(this.timer);
this.timer = null;
},
refresh() {
this.onLoad();
},
onLoad(query) {
console.log(query);
if (query && JSON.stringify(query) !== "{}") {
getData(onlyChangeSign) {
getHomeUserSchedule1({
startTime: "2020-01-01 00:00:00",
endTime: "2025-12-30 23:59:59"
}).then(res => {
//只修改sign, 防止30S后刷新页面
if (onlyChangeSign) {
console.log('只修改sign')
this.setData({
listLoading: false
});
const scheduleItem = JSON.parse(Object.keys(query)[0].split("=")[1]);
dd.navigateTo({
url: `./../meetingDetail/meetingDetail?scheduleItem=${encodeURIComponent(
JSON.stringify(scheduleItem)
)}`
});
sign: res.data.data.sign
})
return
}
dd.setNavigationBar({
title: "动态"
//第一次加载
if (this.isFirstLoad && !this.isLoaded) {
console.log('第一次加载')
this.getScheduleList(res.data.data);
this.getPagination(this.scheduleList);
this.setData({
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
),
sign: res.data.data.sign,
loading: false
});
this.isFirstLoad = true;
//获取动态列表
this.getPages(1);
//获取日程列表
this.getData();
this.isLoaded = true;
return;
}
this.$store.modifyOnceMeetingContent = (content) => {
this.modifyOnceMeetingContent(content);
//是否刷新页面
if (res.data.data.sign !== this.data.sign) {
console.log('刷新页面')
DateMap = getDateMap(this.minYear, this.maxYear);
this.getScheduleList(res.data.data);
this.totalPages = Math.ceil(this.scheduleList.length / this.pageSize);
this.setData({
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
),
sign: res.data.data.sign
});
}
this.$store.modifyErpeatMeeting = () => {
this.modifyErpeatMeeting()
}).catch(err => {
if (err && err.refresh) {
this.setData({
refresh: true
});
}
this.update();
});
},
onHide() {
clearInterval(this.timer);
this.timer = null;
},
refresh() {
this.onLoad();
},
//动态列表侧滑的时候禁止页面上下滑动
setBodyDisableScroll(isStopBodyScroll) {
......@@ -334,61 +390,7 @@ create.Page({
}
}
},
getData(onlyChangeSign) {
getHomeUserSchedule1({
startTime: "2020-01-01 00:00:00",
endTime: "2025-12-30 23:59:59"
}).then(res => {
//只修改sign, 防止30S后刷新页面
if (onlyChangeSign) {
console.log('只修改sign')
this.setData({
sign: res.data.data.sign
})
return
}
//第一次加载
if (this.isFirstLoad) {
console.log('第一次加载')
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({
sign: res.data.data.sign
})
}).catch(err => {
if (err && err.refresh) {
this.setData({
refresh: true
});
}
});
},
//生成DateMap值
setDateMapValue(startTime, endTime, item, type) {
const pushItem = {
......@@ -602,29 +604,6 @@ create.Page({
}
});
this.scheduleList = DateList;
// if (changePagination) {
// this.setData({
// scheduleList: this.scheduleList.slice(
// this.firstPage * this.pageSize,
// this.currentPage * this.pageSize
// ),
// loading: false
// });
// return
// }
// this.getPagination(this.scheduleList);
// // 第一次加载
// this.setData({
// scheduleList: this.scheduleList.slice(
// this.firstPage * this.pageSize,
// this.currentPage * this.pageSize
// ),
// loading: false
// });
// //定位到当前日期
// this.backToToday("first");
},
//日程上拉加载
lower() {
......@@ -722,7 +701,7 @@ create.Page({
}
if (offset == "next") {
for (let i = this.data.currentDataIndex; i < rect[0].length; i++) {
if (rect[0][i].top > 0) {
if (rect[0][i] && rect[0][i].top > 0) {
if (
this.data.scheduleList[i].dateStr.split("/")[1] !==
this.data.currentData.split("/")[1]
......@@ -741,7 +720,7 @@ create.Page({
this.data.scheduleList.length - 1
);
for (; i > 0; i--) {
if (rect[0][i].top < 50) {
if (rect[0][i] && rect[0][i].top < 50) {
if (
this.data.scheduleList[i].dateStr.split("/")[1] !==
this.data.currentData.split("/")[1]
......
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