feat(web): Token 列显示掩码并支持一键复制

- Token 列显示前4位+****+后4位掩码格式
- 添加复制按钮,点击复制完整 Token 到剪贴板
- 列宽从 120 调整为 200 以容纳掩码和按钮
This commit is contained in:
2026-02-23 21:06:59 +08:00
parent 08b2ba4c25
commit 710659350d
2 changed files with 21 additions and 6 deletions
+5 -4
View File
@@ -12,10 +12,11 @@ import (
func main() { func main() {
// create config // create config
cfg := &client.Config{ cfg := &client.Config{
BaseURL: "http://localhost:8080", BaseURL: "http://localhost:8080",
AppName: "kenaito-springboot-demo", AppName: "kenaito-springboot-demo",
Env: "daily", Env: "daily",
Version: "latest", Version: "latest",
//Token: "6f6966fe196572954b176c0e2a97bc399b050c6be31454b8d6b0f7f622b5d6f1",
SyncInterval: 30, // sync every 30 seconds SyncInterval: 30, // sync every 30 seconds
CacheDir: ".", CacheDir: ".",
} }
+16 -2
View File
@@ -10,9 +10,12 @@
<el-table-column prop="code" label="应用编码"></el-table-column> <el-table-column prop="code" label="应用编码"></el-table-column>
<el-table-column prop="groupName" label="所属业务组" width="120"></el-table-column> <el-table-column prop="groupName" label="所属业务组" width="120"></el-table-column>
<el-table-column prop="ownerName" label="负责人" width="100"></el-table-column> <el-table-column prop="ownerName" label="负责人" width="100"></el-table-column>
<el-table-column prop="token" label="Token" width="120"> <el-table-column prop="token" label="Token" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.token" style="color: #67C23A">已设置</span> <template v-if="scope.row.token">
<span style="font-family: monospace; color: #606266">{{ maskToken(scope.row.token) }}</span>
<el-button type="text" size="mini" style="margin-left: 8px" @click="copyToken(scope.row.token)">复制</el-button>
</template>
<span v-else style="color: #909399">未设置</span> <span v-else style="color: #909399">未设置</span>
</template> </template>
</el-table-column> </el-table-column>
@@ -177,6 +180,17 @@ export default {
handlePageChange(page) { handlePageChange(page) {
this.query.pageNo = page this.query.pageNo = page
this.loadData() this.loadData()
},
maskToken(token) {
if (!token || token.length <= 8) return '****'
return token.substring(0, 4) + '****' + token.substring(token.length - 4)
},
copyToken(token) {
navigator.clipboard.writeText(token).then(() => {
this.$message.success('Token 已复制到剪贴板')
}).catch(() => {
this.$message.error('复制失败')
})
} }
} }
} }