添加ping的时候的loss状态
This commit is contained in:
parent
929db9ed6e
commit
b09380bc22
@ -322,19 +322,20 @@ function handleSetSortStatus(groupIndex: number, sortStatus: boolean) {
|
|||||||
}
|
}
|
||||||
async function usePing(params: any, itemGroupIndex: any) {
|
async function usePing(params: any, itemGroupIndex: any) {
|
||||||
const isflag = isLocalUrl(window.location.origin)
|
const isflag = isLocalUrl(window.location.origin)
|
||||||
const promises = params.items.map(async (e: any) => {
|
const promises = params.items.map(async (e: any, i: number) => {
|
||||||
if (isflag && e.lanUrl) {
|
if (isflag && e.lanUrl) {
|
||||||
return ping(e.lanUrl)
|
const time = await ping(e.lanUrl)
|
||||||
|
//@ts-ignore
|
||||||
|
items.value[itemGroupIndex].items[i]['time'] = time && time < 2000 ? time : 'loss'
|
||||||
} else {
|
} else {
|
||||||
return ping(e.url)
|
const time = await ping(e.url)
|
||||||
|
//@ts-ignore
|
||||||
|
|
||||||
|
items.value[itemGroupIndex].items[i]['time'] = time && time < 2000 ? time : 'loss'
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const result = await Promise.all(promises)
|
|
||||||
items.value[itemGroupIndex].items?.forEach((e: any, i) => {
|
|
||||||
e['time'] = result[i]
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
items.value[itemGroupIndex].items?.forEach((e: any) => {
|
items.value[itemGroupIndex].items?.forEach((e: any) => {
|
||||||
delete e['time']
|
delete e['time']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user