Commit 8cd54638 by xiexiaoqin

feat: 首页定时刷新30s

parent b2dfa931
...@@ -29,6 +29,7 @@ import create from "dd-store"; ...@@ -29,6 +29,7 @@ import create from "dd-store";
let maxClickCount = 5; let maxClickCount = 5;
create.Page({ create.Page({
data: { data: {
sign: '',
refresh: false, refresh: false,
$data: null, $data: null,
iconDay: currentDate.getDate(), iconDay: currentDate.getDate(),
...@@ -61,6 +62,7 @@ create.Page({ ...@@ -61,6 +62,7 @@ create.Page({
maxYear: maxYear, maxYear: maxYear,
todayIndex: 0, todayIndex: 0,
onShow() { onShow() {
//如果是重复会议重新算 //如果是重复会议重新算
if (this.$store.data.indexNeedUpdate) { if (this.$store.data.indexNeedUpdate) {
dd.setNavigationBar({ dd.setNavigationBar({
...@@ -84,6 +86,14 @@ create.Page({ ...@@ -84,6 +86,14 @@ create.Page({
this.$store.data.isIndexAffairListNeedUpdate = false; this.$store.data.isIndexAffairListNeedUpdate = false;
this.update(); this.update();
} }
//开启一个定时器
this.timer = setInterval(() => {
this.getData()
}, 30000)
},
onHide() {
clearInterval(this.timer);
this.timer = null;
}, },
refresh() { refresh() {
this.onLoad() this.onLoad()
...@@ -293,7 +303,17 @@ create.Page({ ...@@ -293,7 +303,17 @@ create.Page({
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 => {
this.getScheduleList(res.data.data); //是否刷新页面
if (this.data.sign && res.data.data.sign !== this.data.sign) {
DateMap = getDateMap(this.minYear, this.maxYear);
}
if (res.data.data.sign !== this.data.sign) {
this.getScheduleList(res.data.data);
}
this.setData({
sign: res.data.data.sign
})
}).catch(err => { }).catch(err => {
if (err && err.refresh) { if (err && err.refresh) {
this.setData({ this.setData({
......
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