mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 12:02:51 +00:00
perf: 优化时间组件
This commit is contained in:
parent
33cd9358c0
commit
dcd41b4be2
@ -49,7 +49,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
routePath: null,
|
routePath: null,
|
||||||
appInter: null,
|
appInter: null,
|
||||||
countDown: Math.min(30, 60 - $A.dayjs().second()),
|
countDown: Math.min(30, 60 - $A.daytz().second()),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ export default {
|
|||||||
//
|
//
|
||||||
this.countDown--
|
this.countDown--
|
||||||
if (this.countDown <= 0) {
|
if (this.countDown <= 0) {
|
||||||
this.countDown = Math.min(30, 60 - $A.dayjs().second())
|
this.countDown = Math.min(30, 60 - $A.daytz().second())
|
||||||
this.$store.dispatch("todayAndOverdue")
|
this.$store.dispatch("todayAndOverdue")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -134,9 +134,9 @@ export default {
|
|||||||
return function(index) {
|
return function(index) {
|
||||||
let mouseDay = mouseWidth == 0 ? 0 : mouseWidth / dateWidth;
|
let mouseDay = mouseWidth == 0 ? 0 : mouseWidth / dateWidth;
|
||||||
//今天00:00:00
|
//今天00:00:00
|
||||||
let nowDay = $A.dayjs().startOf('day');
|
let nowDay = $A.daytz().startOf('day');
|
||||||
//当前时间
|
//当前时间
|
||||||
let curDay = nowDay.clone().add(mouseDay, 'day');
|
let curDay = nowDay.clone().add(mouseDay * 86400, 'second');
|
||||||
//当月最后一天
|
//当月最后一天
|
||||||
let lastDay = curDay.clone().endOf('month');
|
let lastDay = curDay.clone().endOf('month');
|
||||||
//相差天数
|
//相差天数
|
||||||
@ -157,7 +157,7 @@ export default {
|
|||||||
return function(index) {
|
return function(index) {
|
||||||
let mouseDay = mouseWidth == 0 ? 0 : mouseWidth / dateWidth;
|
let mouseDay = mouseWidth == 0 ? 0 : mouseWidth / dateWidth;
|
||||||
//开始位置时间(今天00:00:00)
|
//开始位置时间(今天00:00:00)
|
||||||
let nowDay = $A.dayjs().startOf('day');
|
let nowDay = $A.daytz().startOf('day');
|
||||||
//当前时间
|
//当前时间
|
||||||
let curDay = nowDay.clone().add(mouseDay, 'day');
|
let curDay = nowDay.clone().add(mouseDay, 'day');
|
||||||
//
|
//
|
||||||
@ -182,7 +182,7 @@ export default {
|
|||||||
mouseData--;
|
mouseData--;
|
||||||
}
|
}
|
||||||
let j = mouseWidth == 0 ? index - 1 : mouseData;
|
let j = mouseWidth == 0 ? index - 1 : mouseData;
|
||||||
let date = $A.dayjs().add(j, 'day');
|
let date = $A.daytz().add(j, 'day');
|
||||||
if ([0, 6].indexOf(date.day()) !== -1) {
|
if ([0, 6].indexOf(date.day()) !== -1) {
|
||||||
style.backgroundColor = '#f9fafb';
|
style.backgroundColor = '#f9fafb';
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ export default {
|
|||||||
mouseData--;
|
mouseData--;
|
||||||
}
|
}
|
||||||
let j = mouseWidth == 0 ? index - 1 : mouseData;
|
let j = mouseWidth == 0 ? index - 1 : mouseData;
|
||||||
let date = $A.dayjs().add(j, 'day');
|
let date = $A.daytz().add(j, 'day');
|
||||||
if (type == 'day') {
|
if (type == 'day') {
|
||||||
return date.date();
|
return date.date();
|
||||||
} else if (type == 'week') {
|
} else if (type == 'week') {
|
||||||
@ -220,13 +220,13 @@ export default {
|
|||||||
const {start, end} = item.time;
|
const {start, end} = item.time;
|
||||||
const {style, moveX, moveW} = item;
|
const {style, moveX, moveW} = item;
|
||||||
//开始位置时间戳(今天00:00:00时间戳)
|
//开始位置时间戳(今天00:00:00时间戳)
|
||||||
let nowTime = $A.dayjs().startOf('day').valueOf();
|
let nowTime = $A.daytz().startOf('day').valueOf();
|
||||||
//距离开始位置多少天
|
//距离开始位置多少天
|
||||||
let diffStartDay = (start - nowTime) / 1000 / 60 / 60 / 24;
|
let diffStartDay = (start - nowTime) / 1000 / 60 / 60 / 24;
|
||||||
let diffEndDay = (end - nowTime) / 1000 / 60 / 60 / 24;
|
let diffEndDay = (end - nowTime) / 1000 / 60 / 60 / 24;
|
||||||
//
|
//
|
||||||
let left = dateWidth * diffStartDay + (mouseWidth * -1);
|
let left = dateWidth * diffStartDay + (mouseWidth * -1);
|
||||||
let width = dateWidth * (diffEndDay - diffStartDay);
|
let width = Math.max(10, dateWidth * (diffEndDay - diffStartDay));
|
||||||
if (typeof moveX === "number") {
|
if (typeof moveX === "number") {
|
||||||
left+= moveX;
|
left+= moveX;
|
||||||
}
|
}
|
||||||
@ -419,7 +419,7 @@ export default {
|
|||||||
},
|
},
|
||||||
scrollPosition(pos) {
|
scrollPosition(pos) {
|
||||||
//今天00:00:00
|
//今天00:00:00
|
||||||
let nowDay = $A.dayjs().startOf('day').valueOf();
|
let nowDay = $A.daytz().startOf('day').valueOf();
|
||||||
//一个宽度的时间
|
//一个宽度的时间
|
||||||
let oneWidthTime = 86400000 / this.dateWidth;
|
let oneWidthTime = 86400000 / this.dateWidth;
|
||||||
//
|
//
|
||||||
|
|||||||
@ -109,7 +109,7 @@ export default {
|
|||||||
if (this.user.online || this.$store.state.userId === this.userid) {
|
if (this.user.online || this.$store.state.userId === this.userid) {
|
||||||
this.$emit('update:online', true)
|
this.$emit('update:online', true)
|
||||||
} else {
|
} else {
|
||||||
const now = $A.dayjs()
|
const now = $A.daytz()
|
||||||
const line = $A.dayjs(this.user.line_at)
|
const line = $A.dayjs(this.user.line_at)
|
||||||
const seconds = now.unix() - line.unix()
|
const seconds = now.unix() - line.unix()
|
||||||
let stats = '最后在线于很久以前';
|
let stats = '最后在线于很久以前';
|
||||||
|
|||||||
2
resources/assets/js/functions/common.js
vendored
2
resources/assets/js/functions/common.js
vendored
@ -1912,7 +1912,7 @@ const timezone = require("dayjs/plugin/timezone");
|
|||||||
if (!$A.timezoneName) {
|
if (!$A.timezoneName) {
|
||||||
return $A.timezoneDifference = 0;
|
return $A.timezoneDifference = 0;
|
||||||
}
|
}
|
||||||
const local = $A.dayjs().startOf('hour');
|
const local = $A.daytz().startOf('hour');
|
||||||
const server = local.tz($A.timezoneName);
|
const server = local.tz($A.timezoneName);
|
||||||
return $A.timezoneDifference = local.startOf('hour').diff(server.format("YYYY-MM-DD HH:mm:ss"), 'hour')
|
return $A.timezoneDifference = local.startOf('hour').diff(server.format("YYYY-MM-DD HH:mm:ss"), 'hour')
|
||||||
},
|
},
|
||||||
|
|||||||
16
resources/assets/js/functions/web.js
vendored
16
resources/assets/js/functions/web.js
vendored
@ -119,41 +119,41 @@ import {MarkdownPreview} from "../store/markdown";
|
|||||||
* @returns {(*)[]|[{text, value(): [Date,*]},{text, value(): [Date,*]},{text, value(): [*,*]},{text, value(): [*,*]},{text, value(): [Date,*]},null,null]|(Date|*)[]}
|
* @returns {(*)[]|[{text, value(): [Date,*]},{text, value(): [Date,*]},{text, value(): [*,*]},{text, value(): [*,*]},{text, value(): [Date,*]},null,null]|(Date|*)[]}
|
||||||
*/
|
*/
|
||||||
timeOptionShortcuts() {
|
timeOptionShortcuts() {
|
||||||
const startSecond = $A.dayjs().startOf('day').toDate();
|
const startSecond = $A.daytz().startOf('day').toDate();
|
||||||
return [{
|
return [{
|
||||||
text: $A.L('今天'),
|
text: $A.L('今天'),
|
||||||
value() {
|
value() {
|
||||||
return [startSecond, $A.dayjs().endOf('day').toDate()];
|
return [startSecond, $A.daytz().endOf('day').toDate()];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('明天'),
|
text: $A.L('明天'),
|
||||||
value() {
|
value() {
|
||||||
return [startSecond, $A.dayjs().add(1, 'day').endOf('day').toDate()];
|
return [startSecond, $A.daytz().add(1, 'day').endOf('day').toDate()];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('本周'),
|
text: $A.L('本周'),
|
||||||
value() {
|
value() {
|
||||||
return [startSecond, $A.dayjs().endOf('week').toDate()];
|
return [startSecond, $A.daytz().endOf('week').toDate()];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('本月'),
|
text: $A.L('本月'),
|
||||||
value() {
|
value() {
|
||||||
return [startSecond, $A.dayjs().endOf('month').toDate()];
|
return [startSecond, $A.daytz().endOf('month').toDate()];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('3天'),
|
text: $A.L('3天'),
|
||||||
value() {
|
value() {
|
||||||
return [startSecond, $A.dayjs().add(2, 'day').endOf('day').toDate()];
|
return [startSecond, $A.daytz().add(2, 'day').endOf('day').toDate()];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('5天'),
|
text: $A.L('5天'),
|
||||||
value() {
|
value() {
|
||||||
return [startSecond, $A.dayjs().add(4, 'day').endOf('day').toDate()];
|
return [startSecond, $A.daytz().add(4, 'day').endOf('day').toDate()];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
text: $A.L('7天'),
|
text: $A.L('7天'),
|
||||||
value() {
|
value() {
|
||||||
return [startSecond, $A.dayjs().add(6, 'day').endOf('day').toDate()];
|
return [startSecond, $A.daytz().add(6, 'day').endOf('day').toDate()];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|||||||
@ -404,7 +404,7 @@ export default {
|
|||||||
this.getUnreadList();
|
this.getUnreadList();
|
||||||
}
|
}
|
||||||
this.addData.department_id = this.userInfo.department[0] || 0;
|
this.addData.department_id = this.userInfo.department[0] || 0;
|
||||||
this.addData.startTime = this.addData.endTime = $A.dayjs().format('YYYY-MM-DD');
|
this.addData.startTime = this.addData.endTime = $A.daytz().format('YYYY-MM-DD');
|
||||||
this.isShowIcon = this.windowWidth < 515
|
this.isShowIcon = this.windowWidth < 515
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -87,13 +87,13 @@ export default {
|
|||||||
dateShortcuts(act) {
|
dateShortcuts(act) {
|
||||||
if (act === 'prev') {
|
if (act === 'prev') {
|
||||||
return [
|
return [
|
||||||
$A.dayjs().subtract(1, 'month').startOf('month').format('YYYY-MM-DD'),
|
$A.daytz().subtract(1, 'month').startOf('month').format('YYYY-MM-DD'),
|
||||||
$A.dayjs().subtract(1, 'month').endOf('month').format('YYYY-MM-DD'),
|
$A.daytz().subtract(1, 'month').endOf('month').format('YYYY-MM-DD'),
|
||||||
];
|
];
|
||||||
} else if (act === 'this') {
|
} else if (act === 'this') {
|
||||||
return [
|
return [
|
||||||
$A.dayjs().startOf('month').format('YYYY-MM-DD'),
|
$A.daytz().startOf('month').format('YYYY-MM-DD'),
|
||||||
$A.dayjs().endOf('month').format('YYYY-MM-DD'),
|
$A.daytz().endOf('month').format('YYYY-MM-DD'),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -75,7 +75,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const today = $A.dayjs()
|
const today = $A.daytz()
|
||||||
this.year = today.year();
|
this.year = today.year();
|
||||||
this.month = today.month() + 1;
|
this.month = today.month() + 1;
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
hasNextMonth() {
|
hasNextMonth() {
|
||||||
const {year, month} = this;
|
const {year, month} = this;
|
||||||
const today = $A.dayjs()
|
const today = $A.daytz()
|
||||||
return parseInt(year) != today.year() || parseInt(month) < today.month() + 1;
|
return parseInt(year) != today.year() || parseInt(month) < today.month() + 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -121,7 +121,7 @@ export default {
|
|||||||
}).join('<br/>')
|
}).join('<br/>')
|
||||||
},
|
},
|
||||||
generateCalendar() {
|
generateCalendar() {
|
||||||
let today = $A.dayjs().startOf('day')
|
let today = $A.daytz().startOf('day')
|
||||||
let one = $A.dayjs([this.year, this.month, 1])
|
let one = $A.dayjs([this.year, this.month, 1])
|
||||||
let calcTime = one.valueOf() - one.day() * 86400 * 1000
|
let calcTime = one.valueOf() - one.day() * 86400 * 1000
|
||||||
let array = []
|
let array = []
|
||||||
@ -166,7 +166,7 @@ export default {
|
|||||||
this.$emit('changeMonth', this.ym())
|
this.$emit('changeMonth', this.ym())
|
||||||
},
|
},
|
||||||
nowMonth() {
|
nowMonth() {
|
||||||
const today = $A.dayjs()
|
const today = $A.daytz()
|
||||||
this.year = today.year();
|
this.year = today.year();
|
||||||
this.month = today.month() + 1;
|
this.month = today.month() + 1;
|
||||||
this.generateCalendar();
|
this.generateCalendar();
|
||||||
|
|||||||
@ -95,13 +95,13 @@ export default {
|
|||||||
dateShortcuts(act) {
|
dateShortcuts(act) {
|
||||||
if (act === 'prev') {
|
if (act === 'prev') {
|
||||||
return [
|
return [
|
||||||
$A.dayjs().subtract(1, 'month').startOf('day').format('YYYY-MM-DD'),
|
$A.daytz().subtract(1, 'month').startOf('day').format('YYYY-MM-DD'),
|
||||||
$A.dayjs().subtract(1, 'month').endOf('day').format('YYYY-MM-DD'),
|
$A.daytz().subtract(1, 'month').endOf('day').format('YYYY-MM-DD'),
|
||||||
];
|
];
|
||||||
} else if (act === 'this') {
|
} else if (act === 'this') {
|
||||||
return [
|
return [
|
||||||
$A.dayjs().startOf('day').format('YYYY-MM-DD'),
|
$A.daytz().startOf('day').format('YYYY-MM-DD'),
|
||||||
$A.dayjs().endOf('day').format('YYYY-MM-DD'),
|
$A.daytz().endOf('day').format('YYYY-MM-DD'),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1962,7 +1962,7 @@ export default {
|
|||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.$store.dispatch("saveDialogTodo", {
|
this.$store.dispatch("saveDialogTodo", {
|
||||||
id: this.todoViewId,
|
id: this.todoViewId,
|
||||||
done_at: $A.dayjs().format("YYYY-MM-DD HH:mm:ss")
|
done_at: $A.daytz().format("YYYY-MM-DD HH:mm:ss")
|
||||||
})
|
})
|
||||||
this.$store.dispatch("saveDialog", {
|
this.$store.dispatch("saveDialog", {
|
||||||
id: this.dialogId,
|
id: this.dialogId,
|
||||||
|
|||||||
@ -93,7 +93,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
logDate(itemA) {
|
logDate(itemA) {
|
||||||
let md = $A.dayjs().format("MM-DD");
|
let md = $A.daytz().format("MM-DD");
|
||||||
return md == itemA.ymd ? (itemA.ymd + ' ' + this.$L('今天')) : itemA.key;
|
return md == itemA.ymd ? (itemA.ymd + ' ' + this.$L('今天')) : itemA.key;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -428,7 +428,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async choosePriority(item) {
|
async choosePriority(item) {
|
||||||
const start = $A.dayjs();
|
const start = $A.daytz();
|
||||||
const days = $A.runNum(item.days);
|
const days = $A.runNum(item.days);
|
||||||
if (days > 0) {
|
if (days > 0) {
|
||||||
const end = start.clone().add(days, 'day');
|
const end = start.clone().add(days, 'day');
|
||||||
|
|||||||
@ -240,7 +240,7 @@ export default {
|
|||||||
|
|
||||||
choosePriority(item) {
|
choosePriority(item) {
|
||||||
if ($A.runNum(item.days) > 0) {
|
if ($A.runNum(item.days) > 0) {
|
||||||
let start = $A.dayjs();
|
let start = $A.daytz();
|
||||||
let end = start.clone().add($A.runNum(item.days), 'day');
|
let end = start.clone().add($A.runNum(item.days), 'day');
|
||||||
this.$set(this.addData, 'times', $A.newDateString([start, end]))
|
this.$set(this.addData, 'times', $A.newDateString([start, end]))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -87,13 +87,13 @@ export default {
|
|||||||
dateShortcuts(act) {
|
dateShortcuts(act) {
|
||||||
if (act === 'prev') {
|
if (act === 'prev') {
|
||||||
return [
|
return [
|
||||||
$A.dayjs().subtract(1, 'month').startOf('day').format('YYYY-MM-DD'),
|
$A.daytz().subtract(1, 'month').startOf('day').format('YYYY-MM-DD'),
|
||||||
$A.dayjs().subtract(1, 'month').endOf('day').format('YYYY-MM-DD'),
|
$A.daytz().subtract(1, 'month').endOf('day').format('YYYY-MM-DD'),
|
||||||
];
|
];
|
||||||
} else if (act === 'this') {
|
} else if (act === 'this') {
|
||||||
return [
|
return [
|
||||||
$A.dayjs().startOf('day').format('YYYY-MM-DD'),
|
$A.daytz().startOf('day').format('YYYY-MM-DD'),
|
||||||
$A.dayjs().endOf('day').format('YYYY-MM-DD'),
|
$A.daytz().endOf('day').format('YYYY-MM-DD'),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -257,7 +257,7 @@ export default {
|
|||||||
completeTemp(true)
|
completeTemp(true)
|
||||||
}
|
}
|
||||||
this.updateTask({
|
this.updateTask({
|
||||||
complete_at: $A.dayjs().format('YYYY-MM-DD HH:mm:ss')
|
complete_at: $A.daytz().format('YYYY-MM-DD HH:mm:ss')
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
completeTemp(true)
|
completeTemp(true)
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|||||||
@ -268,7 +268,7 @@ export default {
|
|||||||
|
|
||||||
completeAtFormat(date) {
|
completeAtFormat(date) {
|
||||||
let time = $A.dayjs(date);
|
let time = $A.dayjs(date);
|
||||||
if ($A.dayjs().year() === time.year()) {
|
if ($A.daytz().year() === time.year()) {
|
||||||
return time.format('MM-DD HH:mm')
|
return time.format('MM-DD HH:mm')
|
||||||
} else {
|
} else {
|
||||||
return time.format('YYYY-MM-DD')
|
return time.format('YYYY-MM-DD')
|
||||||
|
|||||||
@ -679,7 +679,7 @@ export default {
|
|||||||
{
|
{
|
||||||
text: '12:00',
|
text: '12:00',
|
||||||
value () {
|
value () {
|
||||||
return $A.dayjs().startOf('day').add(12, 'hour').toDate();
|
return $A.daytz().startOf('day').add(12, 'hour').toDate();
|
||||||
},
|
},
|
||||||
onClick: (picker) => {
|
onClick: (picker) => {
|
||||||
picker.handlePickSuccess();
|
picker.handlePickSuccess();
|
||||||
@ -688,7 +688,7 @@ export default {
|
|||||||
{
|
{
|
||||||
text: '17:00',
|
text: '17:00',
|
||||||
value () {
|
value () {
|
||||||
return $A.dayjs().startOf('day').add(17, 'hour').toDate();
|
return $A.daytz().startOf('day').add(17, 'hour').toDate();
|
||||||
},
|
},
|
||||||
onClick: (picker) => {
|
onClick: (picker) => {
|
||||||
picker.handlePickSuccess();
|
picker.handlePickSuccess();
|
||||||
@ -697,7 +697,7 @@ export default {
|
|||||||
{
|
{
|
||||||
text: '18:00',
|
text: '18:00',
|
||||||
value () {
|
value () {
|
||||||
return $A.dayjs().startOf('day').add(18, 'hour').toDate();
|
return $A.daytz().startOf('day').add(18, 'hour').toDate();
|
||||||
},
|
},
|
||||||
onClick: (picker) => {
|
onClick: (picker) => {
|
||||||
picker.handlePickSuccess();
|
picker.handlePickSuccess();
|
||||||
@ -706,7 +706,7 @@ export default {
|
|||||||
{
|
{
|
||||||
text: '19:00',
|
text: '19:00',
|
||||||
value () {
|
value () {
|
||||||
return $A.dayjs().startOf('day').add(19, 'hour').toDate();
|
return $A.daytz().startOf('day').add(19, 'hour').toDate();
|
||||||
},
|
},
|
||||||
onClick: (picker) => {
|
onClick: (picker) => {
|
||||||
picker.handlePickSuccess();
|
picker.handlePickSuccess();
|
||||||
@ -715,7 +715,7 @@ export default {
|
|||||||
{
|
{
|
||||||
text: this.$L('现在'),
|
text: this.$L('现在'),
|
||||||
value () {
|
value () {
|
||||||
return $A.dayjs().toDate();
|
return $A.daytz().toDate();
|
||||||
},
|
},
|
||||||
onClick: (picker) => {
|
onClick: (picker) => {
|
||||||
picker.handlePickSuccess();
|
picker.handlePickSuccess();
|
||||||
|
|||||||
@ -795,25 +795,26 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (dialog.type == 'group') {
|
if (dialog.type == 'group') {
|
||||||
|
const timestamp = $A.dayjs().unix()
|
||||||
if (['project', 'task'].includes(dialog.group_type) && $A.isJson(dialog.group_info)) {
|
if (['project', 'task'].includes(dialog.group_type) && $A.isJson(dialog.group_info)) {
|
||||||
if (dialog.group_type == 'task' && dialog.group_info.complete_at) {
|
if (dialog.group_type == 'task' && dialog.group_info.complete_at) {
|
||||||
// 已完成5天后隐藏对话
|
// 已完成5天后隐藏对话
|
||||||
let time = Math.max($A.dayjs(dialog.last_at).unix(), $A.dayjs(dialog.group_info.complete_at).unix())
|
let time = Math.max($A.dayjs(dialog.last_at).unix(), $A.dayjs(dialog.group_info.complete_at).unix())
|
||||||
if (5 * 86400 + time < $A.dayjs().unix()) {
|
if (5 * 86400 + time < timestamp) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dialog.group_info.deleted_at) {
|
if (dialog.group_info.deleted_at) {
|
||||||
// 已删除2天后隐藏对话
|
// 已删除2天后隐藏对话
|
||||||
let time = Math.max($A.dayjs(dialog.last_at).unix(), $A.dayjs(dialog.group_info.deleted_at).unix())
|
let time = Math.max($A.dayjs(dialog.last_at).unix(), $A.dayjs(dialog.group_info.deleted_at).unix())
|
||||||
if (2 * 86400 + time < $A.dayjs().unix()) {
|
if (2 * 86400 + time < timestamp) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dialog.group_info.archived_at) {
|
if (dialog.group_info.archived_at) {
|
||||||
// 已归档3天后隐藏对话
|
// 已归档3天后隐藏对话
|
||||||
let time = Math.max($A.dayjs(dialog.last_at).unix(), $A.dayjs(dialog.group_info.archived_at).unix())
|
let time = Math.max($A.dayjs(dialog.last_at).unix(), $A.dayjs(dialog.group_info.archived_at).unix())
|
||||||
if (3 * 86400 + time < $A.dayjs().unix()) {
|
if (3 * 86400 + time < timestamp) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,7 +163,7 @@ export default {
|
|||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'users/checkin/list',
|
url: 'users/checkin/list',
|
||||||
data: {
|
data: {
|
||||||
ym: $A.dayjs().format("YYYY-MM"),
|
ym: $A.daytz().format("YYYY-MM"),
|
||||||
before: 1
|
before: 1
|
||||||
}
|
}
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
@ -176,7 +176,7 @@ export default {
|
|||||||
latelyFormat(data) {
|
latelyFormat(data) {
|
||||||
this.latelyData = [];
|
this.latelyData = [];
|
||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
const ymd = $A.dayjs().subtract(i, 'day').format("YYYY-MM-DD")
|
const ymd = $A.daytz().subtract(i, 'day').format("YYYY-MM-DD")
|
||||||
const item = data.find(({date}) => date == ymd) || {date: ymd, section: []}
|
const item = data.find(({date}) => date == ymd) || {date: ymd, section: []}
|
||||||
this.latelyData.push(item)
|
this.latelyData.push(item)
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.calendarData = data;
|
this.calendarData = data;
|
||||||
//
|
//
|
||||||
if (ym == $A.dayjs().format("YYYY-MM")) {
|
if (ym == $A.daytz().format("YYYY-MM")) {
|
||||||
this.latelyFormat(data)
|
this.latelyFormat(data)
|
||||||
}
|
}
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
|
|||||||
18
resources/assets/js/store/actions.js
vendored
18
resources/assets/js/store/actions.js
vendored
@ -1618,7 +1618,7 @@ export default {
|
|||||||
* @param dispatch
|
* @param dispatch
|
||||||
*/
|
*/
|
||||||
todayAndOverdue({state, dispatch}) {
|
todayAndOverdue({state, dispatch}) {
|
||||||
const now = $A.dayjs();
|
const now = $A.daytz();
|
||||||
const today = now.format("YYYY-MM-DD");
|
const today = now.format("YYYY-MM-DD");
|
||||||
state.cacheTasks.some(task => {
|
state.cacheTasks.some(task => {
|
||||||
if (!task.end_at) {
|
if (!task.end_at) {
|
||||||
@ -2516,7 +2516,7 @@ export default {
|
|||||||
const updateData = {
|
const updateData = {
|
||||||
id: data.dialog_id,
|
id: data.dialog_id,
|
||||||
last_msg: data,
|
last_msg: data,
|
||||||
last_at: data.created_at || $A.dayjs().format("YYYY-MM-DD HH:mm:ss")
|
last_at: data.created_at || $A.daytz().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
if (data.mtype == 'tag') {
|
if (data.mtype == 'tag') {
|
||||||
updateData.has_tag = true;
|
updateData.has_tag = true;
|
||||||
@ -2625,7 +2625,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
async getDialogBeyonds({state, dispatch}) {
|
async getDialogBeyonds({state, dispatch}) {
|
||||||
const key = await $A.IDBString("dialogBeyond")
|
const key = await $A.IDBString("dialogBeyond")
|
||||||
const val = $A.dayjs().format("YYYY-MM-DD HH")
|
const val = $A.daytz().format("YYYY-MM-DD HH")
|
||||||
if (key == val) {
|
if (key == val) {
|
||||||
return // 一小时取一次
|
return // 一小时取一次
|
||||||
}
|
}
|
||||||
@ -3233,7 +3233,7 @@ export default {
|
|||||||
if ($A.isJson(data)) {
|
if ($A.isJson(data)) {
|
||||||
if (data.userid == state.userId) return;
|
if (data.userid == state.userId) return;
|
||||||
if (data.read_at) return;
|
if (data.read_at) return;
|
||||||
data.read_at = $A.dayjs().format("YYYY-MM-DD HH:mm:ss");
|
data.read_at = $A.daytz().format("YYYY-MM-DD HH:mm:ss");
|
||||||
state.readWaitData[data.id] = state.readWaitData[data.id] || 0
|
state.readWaitData[data.id] = state.readWaitData[data.id] || 0
|
||||||
//
|
//
|
||||||
const dialog = state.cacheDialogs.find(({id}) => id == data.dialog_id);
|
const dialog = state.cacheDialogs.find(({id}) => id == data.dialog_id);
|
||||||
@ -3280,7 +3280,7 @@ export default {
|
|||||||
if (ids.hasOwnProperty(id) && /^\d+$/.test(ids[id])) {
|
if (ids.hasOwnProperty(id) && /^\d+$/.test(ids[id])) {
|
||||||
state.dialogMsgs.some(item => {
|
state.dialogMsgs.some(item => {
|
||||||
if (item.dialog_id == ids[id] && item.id >= id) {
|
if (item.dialog_id == ids[id] && item.id >= id) {
|
||||||
item.read_at = $A.dayjs().format("YYYY-MM-DD HH:mm:ss")
|
item.read_at = $A.daytz().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -3335,7 +3335,7 @@ export default {
|
|||||||
if (typeof data.after_msg_id !== "undefined") {
|
if (typeof data.after_msg_id !== "undefined") {
|
||||||
state.dialogMsgs.some(item => {
|
state.dialogMsgs.some(item => {
|
||||||
if (item.dialog_id == data.dialog_id && item.id >= data.after_msg_id) {
|
if (item.dialog_id == data.dialog_id && item.id >= data.after_msg_id) {
|
||||||
item.read_at = $A.dayjs().format("YYYY-MM-DD HH:mm:ss")
|
item.read_at = $A.daytz().format("YYYY-MM-DD HH:mm:ss")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -3556,7 +3556,7 @@ export default {
|
|||||||
//
|
//
|
||||||
state.ws = new WebSocket(url);
|
state.ws = new WebSocket(url);
|
||||||
state.ws.onopen = async (e) => {
|
state.ws.onopen = async (e) => {
|
||||||
wgLog && console.log("[WS] Open", e, $A.dayjs().format("YYYY-MM-DD HH:mm:ss"))
|
wgLog && console.log("[WS] Open", e, $A.daytz().format("YYYY-MM-DD HH:mm:ss"))
|
||||||
state.wsOpenNum++;
|
state.wsOpenNum++;
|
||||||
//
|
//
|
||||||
if (window.systemInfo.debug === "yes" || state.systemConfig.e2e_message !== 'open') {
|
if (window.systemInfo.debug === "yes" || state.systemConfig.e2e_message !== 'open') {
|
||||||
@ -3571,7 +3571,7 @@ export default {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
state.ws.onclose = async (e) => {
|
state.ws.onclose = async (e) => {
|
||||||
wgLog && console.log("[WS] Close", e, $A.dayjs().format("YYYY-MM-DD HH:mm:ss"))
|
wgLog && console.log("[WS] Close", e, $A.daytz().format("YYYY-MM-DD HH:mm:ss"))
|
||||||
state.ws = null;
|
state.ws = null;
|
||||||
//
|
//
|
||||||
clearTimeout(state.wsTimeout);
|
clearTimeout(state.wsTimeout);
|
||||||
@ -3580,7 +3580,7 @@ export default {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
};
|
};
|
||||||
state.ws.onerror = async (e) => {
|
state.ws.onerror = async (e) => {
|
||||||
wgLog && console.log("[WS] Error", e, $A.dayjs().format("YYYY-MM-DD HH:mm:ss"))
|
wgLog && console.log("[WS] Error", e, $A.daytz().format("YYYY-MM-DD HH:mm:ss"))
|
||||||
state.ws = null;
|
state.ws = null;
|
||||||
//
|
//
|
||||||
clearTimeout(state.wsTimeout);
|
clearTimeout(state.wsTimeout);
|
||||||
|
|||||||
6
resources/assets/js/store/getters.js
vendored
6
resources/assets/js/store/getters.js
vendored
@ -114,9 +114,9 @@ export default {
|
|||||||
* @returns {{overdue: *, today: *,all:*}}
|
* @returns {{overdue: *, today: *,all:*}}
|
||||||
*/
|
*/
|
||||||
dashboardTask(state) {
|
dashboardTask(state) {
|
||||||
const todayStart = $A.dayjs().startOf('day'),
|
const todayStart = $A.daytz().startOf('day'),
|
||||||
todayEnd = $A.dayjs().endOf('day'),
|
todayEnd = $A.daytz().endOf('day'),
|
||||||
todayNow = $A.dayjs();
|
todayNow = $A.daytz();
|
||||||
const filterTask = (task, chackCompleted = true) => {
|
const filterTask = (task, chackCompleted = true) => {
|
||||||
if (task.archived_at) {
|
if (task.archived_at) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user