Commit 31734c66 by xiexiaoqin

fix: 创建会议刷新页面

parent 33dd6440
...@@ -24,7 +24,6 @@ Component({ ...@@ -24,7 +24,6 @@ Component({
didUnmount() { }, didUnmount() { },
methods: { methods: {
comSelectList(event) { comSelectList(event) {
console.log(event, 2222)
if (this.props.multiple && event.currentTarget.dataset.item.id != -1) { if (this.props.multiple && event.currentTarget.dataset.item.id != -1) {
if (this.data.comSelectList.includes(-1)) { if (this.data.comSelectList.includes(-1)) {
this.setData({ this.setData({
......
...@@ -343,17 +343,29 @@ create.Page({ ...@@ -343,17 +343,29 @@ create.Page({
if (res.data.code === 0) { if (res.data.code === 0) {
this.$store.data.tabBarIndex = '1' this.$store.data.tabBarIndex = '1'
if (this.data.repeatable === 0) { if (this.data.repeatable === 0) {
this.$store.data.onceMeetingContent = { // this.$store.data.onceMeetingContent = {
startTime: new Date(this.$store.data.startTime), // startTime: new Date(this.$store.data.startTime),
endTime: new Date(this.$store.data.endTime), // endTime: new Date(this.$store.data.endTime),
confirmAttendance: res.data.data.confirmAttendance, // confirmAttendance: res.data.data.confirmAttendance,
title: res.data.data.title, // title: res.data.data.title,
id: res.data.data.id // 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 { } 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() this.update()
dd.navigateBack({ dd.navigateBack({
......
...@@ -57,30 +57,13 @@ create.Page({ ...@@ -57,30 +57,13 @@ create.Page({
scheduleList: [], scheduleList: [],
timer: null, timer: null,
isFirstLoad: true, isFirstLoad: true,
isLoaded: false,
blankDataLength: 0, blankDataLength: 0,
blankDataLengthAfter: 0, blankDataLengthAfter: 0,
minYear: minYear, minYear: minYear,
maxYear: maxYear, maxYear: maxYear,
todayIndex: 0, todayIndex: 0,
onShow() { onShow() {
//单次会议往DateMap中添加
if (this.$store.data.onceMeetingContent) {
dd.setNavigationBar({
title: "日程"
});
this.getScheduleList(this.$store.data.onceMeetingContent, "once");
this.setData({
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
),
loading: false
});
this.$store.data.onceMeetingContent = null;
this.update();
}
//刷新动态列表 //刷新动态列表
if (this.$store.data.isIndexAffairListNeedUpdate) { if (this.$store.data.isIndexAffairListNeedUpdate) {
this.getPages(1); this.getPages(1);
...@@ -92,6 +75,54 @@ create.Page({ ...@@ -92,6 +75,54 @@ create.Page({
this.getData(); this.getData();
}, 30000); }, 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();
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(content, "once");
this.setData({
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
),
loading: false
});
},
//修改重复会议 //修改重复会议
modifyErpeatMeeting() { modifyErpeatMeeting() {
this.getData(); this.getData();
...@@ -117,6 +148,61 @@ create.Page({ ...@@ -117,6 +148,61 @@ 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 && !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.isLoaded = true;
return;
}
//是否刷新页面
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
});
}
}).catch(err => {
if (err && err.refresh) {
this.setData({
refresh: true
});
}
});
},
onHide() { onHide() {
clearInterval(this.timer); clearInterval(this.timer);
this.timer = null; this.timer = null;
...@@ -124,36 +210,6 @@ create.Page({ ...@@ -124,36 +210,6 @@ create.Page({
refresh() { refresh() {
this.onLoad(); this.onLoad();
}, },
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();
this.$store.modifyOnceMeetingContent = (content) => {
this.modifyOnceMeetingContent(content);
}
this.$store.modifyErpeatMeeting = () => {
this.modifyErpeatMeeting()
}
this.update();
},
//动态列表侧滑的时候禁止页面上下滑动 //动态列表侧滑的时候禁止页面上下滑动
setBodyDisableScroll(isStopBodyScroll) { setBodyDisableScroll(isStopBodyScroll) {
this.setData({ this.setData({
...@@ -334,61 +390,7 @@ create.Page({ ...@@ -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值 //生成DateMap值
setDateMapValue(startTime, endTime, item, type) { setDateMapValue(startTime, endTime, item, type) {
const pushItem = { const pushItem = {
...@@ -602,29 +604,6 @@ create.Page({ ...@@ -602,29 +604,6 @@ create.Page({
} }
}); });
this.scheduleList = DateList; 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() { lower() {
...@@ -722,7 +701,7 @@ create.Page({ ...@@ -722,7 +701,7 @@ create.Page({
} }
if (offset == "next") { if (offset == "next") {
for (let i = this.data.currentDataIndex; i < rect[0].length; i++) { 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 ( if (
this.data.scheduleList[i].dateStr.split("/")[1] !== this.data.scheduleList[i].dateStr.split("/")[1] !==
this.data.currentData.split("/")[1] this.data.currentData.split("/")[1]
...@@ -741,7 +720,7 @@ create.Page({ ...@@ -741,7 +720,7 @@ create.Page({
this.data.scheduleList.length - 1 this.data.scheduleList.length - 1
); );
for (; i > 0; i--) { for (; i > 0; i--) {
if (rect[0][i].top < 50) { if (rect[0][i] && rect[0][i].top < 50) {
if ( if (
this.data.scheduleList[i].dateStr.split("/")[1] !== this.data.scheduleList[i].dateStr.split("/")[1] !==
this.data.currentData.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