mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
fix: 任务到期时间不变颜色
This commit is contained in:
parent
ccc60dfd77
commit
34305a1285
@ -48,7 +48,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
routePath: null,
|
||||
searchInter: null,
|
||||
appInter: null,
|
||||
countDown: Math.min(30, 60 - $A.Date().getSeconds()),
|
||||
}
|
||||
},
|
||||
|
||||
@ -62,7 +63,7 @@ export default {
|
||||
window.addEventListener('resize', this.windowSizeListener)
|
||||
window.addEventListener('scroll', this.windowScrollListener)
|
||||
window.addEventListener('message', this.windowHandleMessage)
|
||||
this.searchInter = setInterval(this.searchEnter, 1000)
|
||||
this.appInter = setInterval(this.appTimerHandler, 1000)
|
||||
$A.loadVConsole()
|
||||
},
|
||||
|
||||
@ -70,7 +71,7 @@ export default {
|
||||
window.removeEventListener('resize', this.windowSizeListener)
|
||||
window.removeEventListener('scroll', this.windowScrollListener)
|
||||
window.removeEventListener('message', this.windowHandleMessage)
|
||||
this.searchInter && clearInterval(this.searchInter)
|
||||
this.appInter && clearInterval(this.appInter)
|
||||
},
|
||||
|
||||
computed: {
|
||||
@ -161,6 +162,15 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
appTimerHandler() {
|
||||
this.searchEnter()
|
||||
//
|
||||
this.countDown--
|
||||
if (this.countDown <= 0) {
|
||||
this.countDown = Math.min(30, 60 - $A.Date().getSeconds())
|
||||
this.$store.dispatch("todayAndOverdue")
|
||||
}
|
||||
},
|
||||
searchEnter() {
|
||||
let row = $A(".sreachBox");
|
||||
if (row.length === 0) {
|
||||
|
||||
13
resources/assets/js/functions/common.js
vendored
13
resources/assets/js/functions/common.js
vendored
@ -289,19 +289,20 @@ const localforage = require("localforage");
|
||||
|
||||
/**
|
||||
* 返回 时间对象|时间戳
|
||||
* @param v
|
||||
* @param stamp 是否返回时间戳
|
||||
* @param v 支持时间戳|时间格式字符串|时间对象|空
|
||||
* @param timestamp 是否返回时间戳
|
||||
* @returns {Date|number}
|
||||
* @constructor
|
||||
*/
|
||||
Date(v, stamp = false) {
|
||||
Date(v = undefined, timestamp = false) {
|
||||
if (typeof v === "string" && this.strExists(v, "-")) {
|
||||
v = v.replace(/-/g, '/');
|
||||
}
|
||||
if (stamp === true) {
|
||||
return Math.round(new Date(v).getTime() / 1000)
|
||||
const d = v === undefined || v === null ? new Date() : new Date(v);
|
||||
if (timestamp === true) {
|
||||
return Math.round(d.getTime() / 1000)
|
||||
}
|
||||
return new Date(v);
|
||||
return d;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
24
resources/assets/js/store/actions.js
vendored
24
resources/assets/js/store/actions.js
vendored
@ -1611,6 +1611,30 @@ export default {
|
||||
$A.IDBSave("cacheTasks", state.cacheTasks);
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新任务“今日任务”、“过期任务”
|
||||
* @param state
|
||||
* @param dispatch
|
||||
*/
|
||||
todayAndOverdue({state, dispatch}) {
|
||||
state.cacheTasks.some(task => {
|
||||
if (!task.end_at) {
|
||||
return false;
|
||||
}
|
||||
const data = {today: false, overdue: false};
|
||||
const endAt = $A.Date(task.end_at, true)
|
||||
if (!task.today) {
|
||||
data.today = $A.formatDate('Y-m-d', endAt) == $A.formatDate('Y-m-d')
|
||||
}
|
||||
if (!task.overdue) {
|
||||
data.overdue = endAt < $A.Time();
|
||||
}
|
||||
if (data.today || data.overdue) {
|
||||
dispatch("saveTask", Object.assign(task, data));
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 增加任务消息数量
|
||||
* @param state
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user