Compare commits

..

2 Commits

Author SHA1 Message Date
lingling 1b2f1e6374 增加延迟 2023-04-01 21:55:38 +08:00
lingling 902492defc 加入毫秒显示 2023-04-01 15:48:02 +08:00
3 changed files with 34 additions and 3 deletions

View File

@ -4,8 +4,10 @@
<h6 style="text-align: center;margin: 1rem;">{{ props.serve.tips }} <q-icon v-show="online" title="在线" <h6 style="text-align: center;margin: 1rem;">{{ props.serve.tips }} <q-icon v-show="online" title="在线"
name="check_circle_outline" style="color: green;" /> <q-icon v-show="!online" title="离线" name="highlight_off" name="check_circle_outline" style="color: green;" /> <q-icon v-show="!online" title="离线" name="highlight_off"
style="color: red;" /></h6> 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 /> <q-input v-model="outtext" filled autogrow readonly />
<div style="text-align: center;margin-top: 1rem;display: flex;justify-content: space-around;"> <div style="text-align: center;margin-top: 1rem;">
<q-btn color="white" text-color="black" @click="copy('link')" label="复制" /> <q-btn color="white" text-color="black" @click="copy('link')" label="复制" />
<!-- <q-btn color="white" text-color="black" @click="copy('sub')" label="复制订阅" /> --> <!-- <q-btn color="white" text-color="black" @click="copy('sub')" label="复制订阅" /> -->
</div> </div>
@ -40,10 +42,12 @@ export default defineComponent({
let http = props.serve.istls == 0 ? 'http' : 'https' let http = props.serve.istls == 0 ? 'http' : 'https'
api.text_server(`${http}://${props.serve.ip}:${props.serve.port}/${ip}`).then(res => { api.text_server(`${http}://${props.serve.ip}:${props.serve.port}/${ip}`).then(res => {
online.value = res.data.sataus == 400 online.value = res.data.sataus == 400
time.value = res.data.time
}) })
} }
const api = new getdata; const api = new getdata;
const $q = useQuasar() const $q = useQuasar()
const time = ref(0)
const outtext = computed(() => { const outtext = computed(() => {
let tmp = '' let tmp = ''
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@ -69,6 +73,17 @@ export default defineComponent({
return tmp 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) => { const copy = (type: string) => {
let tmp = '' let tmp = ''
switch (type) { switch (type) {
@ -98,7 +113,7 @@ export default defineComponent({
}) })
}) })
} }
return { props, outtext, copy, online }; return { props, outtext, copy, online, time, signal_style };
}, },
}); });
</script> </script>

View File

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

View File

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