-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
237 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { get } from './request' | ||
|
||
export const getAllNotificationCount = async(fn: () => void): Promise<boolean> => { | ||
let total: number = 0 | ||
await get('/system/getNotificationCount') | ||
.then((res: any) => { | ||
total = res.total | ||
fn() | ||
console.log('total=', total); | ||
}) | ||
return total > 0 | ||
} | ||
export const getTypeNotificationCount = async(type: number, fn: () => {}): Promise<number> => { | ||
let total: number = 0 | ||
const url = `/system/getNotificationCount?type=${type}` | ||
await get(url) | ||
.then((res: any) => { | ||
total = res | ||
fn() | ||
}) | ||
return total | ||
} | ||
|
||
export const turnTime = (time: number) => { | ||
const date = new Date(time); | ||
const year = date.getFullYear(); | ||
const month = (date.getMonth() + 1).toString().padStart(2, '0'); | ||
const day = date.getDate().toString().padStart(2, '0'); | ||
const hours = date.getHours().toString().padStart(2, '0'); | ||
const minutes = date.getMinutes().toString().padStart(2, '0'); | ||
return `${year}-${month}-${day} ${hours}:${minutes}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.