feat(消息面板): 添加dayjs依赖并优化消息撤回时间计算
使用dayjs替换原有的日期处理逻辑,提高代码可读性并延长消息撤回时间至5分钟
This commit is contained in:
parent
8bba2d64af
commit
e4354d42cd
@ -26,6 +26,7 @@
|
|||||||
"@vueuse/core": "^10.7.0",
|
"@vueuse/core": "^10.7.0",
|
||||||
"ant-design-vue": "^4.2.6",
|
"ant-design-vue": "^4.2.6",
|
||||||
"axios": "^1.6.2",
|
"axios": "^1.6.2",
|
||||||
|
"dayjs": "^1.11.13",
|
||||||
"highlight.js": "^11.5.0",
|
"highlight.js": "^11.5.0",
|
||||||
"js-audio-recorder": "^1.0.7",
|
"js-audio-recorder": "^1.0.7",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
|
@ -44,6 +44,9 @@ importers:
|
|||||||
axios:
|
axios:
|
||||||
specifier: ^1.6.2
|
specifier: ^1.6.2
|
||||||
version: 1.9.0
|
version: 1.9.0
|
||||||
|
dayjs:
|
||||||
|
specifier: ^1.11.13
|
||||||
|
version: 1.11.13
|
||||||
highlight.js:
|
highlight.js:
|
||||||
specifier: ^11.5.0
|
specifier: ^11.5.0
|
||||||
version: 11.11.1
|
version: 11.11.1
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
import { useDialogueStore } from '@/store/modules/dialogue.js'
|
import { useDialogueStore } from '@/store/modules/dialogue.js'
|
||||||
|
|
||||||
interface IDropdown {
|
interface IDropdown {
|
||||||
@ -14,11 +15,10 @@ const isRevoke = (uid: any, item: any): boolean => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const datetime = item.created_at.replace(/-/g, '/')
|
const messageTime = dayjs(item.created_at)
|
||||||
|
const now = dayjs()
|
||||||
const time = new Date().getTime() - Date.parse(datetime)
|
const diffInMinutes = now.diff(messageTime, 'minute')
|
||||||
|
return diffInMinutes <= 5
|
||||||
return Math.floor(time / 1000 / 60) <= 2
|
|
||||||
}
|
}
|
||||||
const dialogueStore = useDialogueStore()
|
const dialogueStore = useDialogueStore()
|
||||||
export function useMenu() {
|
export function useMenu() {
|
||||||
|
Loading…
Reference in New Issue
Block a user