Skip to content

Commit

Permalink
[+] 节点标签
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Oct 10, 2024
1 parent b520ef8 commit bac2377
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const routes = [
path: '/',
name: 'MainPage',
meta: {
title: '首页',
title: '首页'
},
component: () => import('@views/MainView.vue')
},
Expand Down Expand Up @@ -290,7 +290,7 @@ const router = createRouter({
top: 0,
behavior: 'smooth'
}
},
}
})

// // 检查本地存储是否存在token,若存在则直接使用
Expand Down
7 changes: 6 additions & 1 deletion src/views/auth/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
</n-space>
<n-space justify="end">
<n-button type="primary" @click="login"> 登录</n-button>
<n-button ghost style="--n-border: none" type="primary" @click="() => router.push({ name: 'Register' })">
<n-button
ghost
style="--n-border: none"
type="primary"
@click="() => router.push({ name: 'Register' })"
>
没有账户?去注册
</n-button>
</n-space>
Expand Down
7 changes: 6 additions & 1 deletion src/views/auth/RegisterView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@
<div style="display: flex; margin-bottom: 20px; justify-content: flex-end">
<n-space>
<n-button type="primary" @click="register" style="margin-right: 10px"> 注册 </n-button>
<n-button ghost type="primary" style="--n-border: none" @click="() => router.push({ name: 'Login' })">
<n-button
ghost
type="primary"
style="--n-border: none"
@click="() => router.push({ name: 'Login' })"
>
已有账户?去登录
</n-button>
</n-space>
Expand Down
4 changes: 3 additions & 1 deletion src/views/auth/ResetPasswordView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
<n-button type="primary" @click="sendResetMail" style="margin-right: 10px">
发送邮件
</n-button>
<n-button ghost type="primary" @click="() => router.push({ name: 'Login' })"> 登录</n-button>
<n-button ghost type="primary" @click="() => router.push({ name: 'Login' })">
登录
</n-button>
</n-space>
</div>
</n-form>
Expand Down
86 changes: 82 additions & 4 deletions src/views/proxies/AddView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,58 @@
<n-select v-model:value="proxyInfo.nodeId" :options="serverList" size="medium" />
</n-form-item>
</n-space>
<div>
<n-tag class="tip-tag" style="transform: translateY(-0.3rem)" type="info">
<span v-if="serverValue[proxyInfo.nodeId].attribute.verificationLevel === 0">
二级认证
</span>
<span v-else-if="serverValue[proxyInfo.nodeId].attribute.verificationLevel === 1">
一级认证
</span>
<span v-else>其他认证</span>
</n-tag>
<n-tag
class="tip-tag"
:type="serverValue[proxyInfo.nodeId].attribute.allowBigTraffic ? 'success' : 'error'"
>
<span>大流量</span>
<template #icon>
<n-icon
v-if="serverValue[proxyInfo.nodeId].attribute.allowBigTraffic"
:component="CheckmarkCircle"
/>
<n-icon v-else :component="CloseCircle" />
</template>
</n-tag>
<n-tag
class="tip-tag"
:type="serverValue[proxyInfo.nodeId].attribute.allowUdp ? 'success' : 'error'"
>
<span>UDP</span>
<template #icon>
<n-icon
v-if="serverValue[proxyInfo.nodeId].attribute.allowUdp"
:component="CheckmarkCircle"
/>
<n-icon v-else :component="CloseCircle" />
</template>
</n-tag>
<n-tag
class="tip-tag"
:type="serverValue[proxyInfo.nodeId].attribute.allowWebsite ? 'success' : 'error'"
>
<span>建站</span>
<template #icon>
<n-icon
v-if="serverValue[proxyInfo.nodeId].attribute.allowWebsite"
:component="CheckmarkCircle"
/>
<n-icon v-else :component="CloseCircle" />
</template>
</n-tag>
</div>
<div id="item">
<p>服务器信息</p>
<p>服务器信息</p>
<p>服务器名:{{ serverValue[proxyInfo.nodeId].name }}</p>
<p>服务器介绍:{{ serverValue[proxyInfo.nodeId].description }}</p>
<p>服务器IP:{{ serverValue[proxyInfo.nodeId].ip }}</p>
Expand Down Expand Up @@ -93,6 +143,7 @@ import { sendErrorMessage } from '@/utils/message'
import { sendErrorDialog, sendSuccessDialog } from '@/utils/dialog'
import api from '@/api'
import logger from '@/utils/logger'
import { CheckmarkCircle, CloseCircle } from '@vicons/ionicons5'
localStorage.setItem('ViewPage', 'add_proxy')
// 选择框数据
Expand All @@ -105,7 +156,14 @@ const serverValue = ref([
description: '',
ip: '',
hostname: '',
status: 0
status: 0,
attribute: {
verificationLevel: -1,
china: false,
allowBigTraffic: false,
allowUdp: false,
allowWebsite: false
}
}
])
// 表格数据
Expand Down Expand Up @@ -294,7 +352,7 @@ onMounted(async () => {
sendErrorMessage('请求节点列表失败: ' + e)
}
if (!rs) return
var i = 0
let i = 0
rs.data.list.forEach((s) => {
// 默认选择第一个节点
if (i === 0) {
Expand All @@ -304,9 +362,29 @@ onMounted(async () => {
label: s.name,
value: s.id
}
serverValue.value[s.id] = s
serverValue.value[s.id] = {
id: s.id,
name: s.name,
description: s.description,
ip: s.ip,
hostname: s.hostname,
status: s.status,
attribute: {
verificationLevel: s.attribute.verification_level,
china: s.attribute.china,
allowBigTraffic: s.attribute.allow_big_traffic,
allowUdp: s.attribute.allow_udp,
allowWebsite: s.attribute.allow_website
}
}
serverList.value[i] = tmpdict
i = i + 1
})
})
</script>

<style scoped>
.tip-tag {
margin: 0 0.5rem 1rem 0;
}
</style>

0 comments on commit bac2377

Please sign in to comment.