fix: 重构虚拟机内网外网参数设置选择网络
This commit is contained in:
@@ -45,9 +45,17 @@
|
||||
<div class="profile-stats">
|
||||
<div class="stat-item">
|
||||
<div class="stat-label">认证Token</div>
|
||||
<div class="stat-value">
|
||||
<el-tag v-if="serviceInfo.Token || serviceInfo.token" type="success" size="small">已设置</el-tag>
|
||||
<el-tag v-else type="info" size="small">未设置</el-tag>
|
||||
<div class="stat-value" v-if="serviceInfo.Token || serviceInfo.token">
|
||||
<code class="token-text">{{ tokenVisible ? (serviceInfo.Token || serviceInfo.token) : '••••••••••••' }}</code>
|
||||
<el-button link size="small" @click="tokenVisible = !tokenVisible" style="margin-left: 4px">
|
||||
<el-icon><View v-if="!tokenVisible" /><Hide v-else /></el-icon>
|
||||
</el-button>
|
||||
<el-button link size="small" @click="copyToken" style="margin-left: 2px">
|
||||
<el-icon><CopyDocument /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="stat-value" v-else>
|
||||
<el-tag type="info" size="small">未设置</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
@@ -134,7 +142,7 @@
|
||||
import { ref, reactive, computed, provide, onMounted, onActivated, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ArrowLeft, Refresh, Edit, Delete, Monitor } from '@element-plus/icons-vue'
|
||||
import { ArrowLeft, Refresh, Edit, Delete, Monitor, View, Hide, CopyDocument } from '@element-plus/icons-vue'
|
||||
import {
|
||||
getKvmServiceDetail, updateKvmService, deleteKvmService
|
||||
} from '@/api/admin/kvmService'
|
||||
@@ -241,6 +249,29 @@ const goBack = () => {
|
||||
router.push('/virtualization/kvm-service')
|
||||
}
|
||||
|
||||
// Token 显示/复制
|
||||
const tokenVisible = ref(false)
|
||||
const copyToken = () => {
|
||||
const token = serviceInfo.value.Token || serviceInfo.value.token
|
||||
if (!token) return
|
||||
const textarea = document.createElement('textarea')
|
||||
textarea.value = token
|
||||
textarea.style.position = 'fixed'
|
||||
textarea.style.opacity = '0'
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
try {
|
||||
document.execCommand('copy')
|
||||
ElMessage.success('Token 已复制到剪贴板')
|
||||
} catch {
|
||||
ElMessage.error('复制失败')
|
||||
} finally {
|
||||
document.body.removeChild(textarea)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 编辑服务
|
||||
const editDialogVisible = ref(false)
|
||||
const formRef = ref(null)
|
||||
@@ -482,6 +513,23 @@ onMounted(() => {
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.token-text {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
background: #f5f7fa;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
user-select: all;
|
||||
word-break: break-all;
|
||||
max-width: 180px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.note-value {
|
||||
font-weight: 400;
|
||||
font-size: 13px;
|
||||
|
||||
Reference in New Issue
Block a user