增加延迟

This commit is contained in:
lingling 2023-04-01 21:55:38 +08:00
parent 902492defc
commit 1b2f1e6374
2 changed files with 17 additions and 1 deletions

View File

@ -3,6 +3,8 @@
<div class="col-12">
<h6 style="text-align: center;margin: 1rem;">直连<q-icon v-show="online" title="在线" name="check_circle_outline"
style="color: green;" /> <q-icon v-show="!online" title="离线" name="highlight_off" style="color: red;" /></h6>
<div v-show="online" style="text-align: center;"><q-icon title="在线" name="signal_cellular_alt"
:style="{ color: signal_style }" /><span>{{ time }}ms</span></div>
<q-input v-model="outtext" filled autogrow readonly />
<div style="text-align: center;margin-top: 1rem;display: flex;justify-content: space-around;">
<q-btn color="white" text-color="black" @click="copy('link')" label="复制" />
@ -30,11 +32,13 @@ export default defineComponent({
}
},
setup(props) {
const time = ref(0);
const online = ref(false);
const isonline = (ip: string) => {
let http = 'http'
api.text_server(`${http}://${ip}:9000/`).then(res => {
online.value = res.data.sataus == 400
time.value = res.data.time
})
}
const def_link = 'ew0KICAidiI6ICIyIiwNCiAgInBzIjogIjAiLA0KICAiYWRkIjogIjE4NS4yMTguNi4xMDgiLA0KICAicG9ydCI6ICI5MDAwIiwNCiAgImlkIjogIjJlZTU3ODA2LWY2ZTQtNDgyYS1lZjA4LTczNjBjMDRjZDNlNSIsDQogICJhaWQiOiAiMCIsDQogICJzY3kiOiAiYXV0byIsDQogICJuZXQiOiAid3MiLA0KICAidHlwZSI6ICJub25lIiwNCiAgImhvc3QiOiAiIiwNCiAgInBhdGgiOiAiLyIsDQogICJ0bHMiOiAiIiwNCiAgInNuaSI6ICIiLA0KICAiYWxwbiI6ICIiDQp9'
@ -67,6 +71,17 @@ export default defineComponent({
return tmp
})
const signal_style = computed(() => {
let tmp = ''
if (time.value >= 0 && time.value <= 700) {
tmp = 'green'
} else if (time.value > 700 && time.value < 1400) {
tmp = '#FF9800'
} else {
tmp = 'red'
}
return tmp
})
const copy = (type: string) => {
let tmp = ''
switch (type) {
@ -96,7 +111,7 @@ export default defineComponent({
})
})
}
return { props, outtext, copy, online };
return { props, outtext, copy, online, signal_style, time };
},
});
</script>

View File

@ -1,6 +1,7 @@
<template>
<div class="row ">
节点旁边的图标表示节点状态 在其他加速器上面的状态
下面的ms代表延迟 延迟的数据来自江苏宿迁检测站点
</div>
</template>