feat:完成多token分发
This commit is contained in:
@@ -162,7 +162,7 @@ async function handleFormSubmit(data: TokenFormData) {
|
|||||||
id: data.id,
|
id: data.id,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
expireTime: data.expireTime || null,
|
expireTime: data.expireTime || null,
|
||||||
premiumQuotaLimit: data.premiumQuotaLimit || 0,
|
premiumQuotaLimit: data.premiumQuotaLimit || null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (formMode.value === 'create') {
|
if (formMode.value === 'create') {
|
||||||
@@ -418,7 +418,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="API 密钥"
|
label="API 密钥"
|
||||||
min-width="300"
|
min-width="200"
|
||||||
align="left"
|
align="left"
|
||||||
header-align="left"
|
header-align="left"
|
||||||
resizable
|
resizable
|
||||||
@@ -426,11 +426,8 @@ onMounted(async () => {
|
|||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="key-cell">
|
<div class="key-cell">
|
||||||
<div class="key-content">
|
<div class="key-content">
|
||||||
<el-icon class="key-icon">
|
|
||||||
<i-ep-key />
|
|
||||||
</el-icon>
|
|
||||||
<span class="key-text">
|
<span class="key-text">
|
||||||
{{ row.showKey ? row.apiKey : '••••••••••••••••••••••••••••••••' }}
|
{{ row.showKey ? row.apiKey : '•••••••••••••••••••••' }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="key-actions">
|
<div class="key-actions">
|
||||||
@@ -534,7 +531,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="创建时间"
|
label="创建时间"
|
||||||
min-width="180"
|
min-width="160"
|
||||||
prop="creationTime"
|
prop="creationTime"
|
||||||
sortable
|
sortable
|
||||||
align="center"
|
align="center"
|
||||||
@@ -543,9 +540,6 @@ onMounted(async () => {
|
|||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="time-cell">
|
<div class="time-cell">
|
||||||
<el-icon class="time-icon">
|
|
||||||
<i-ep-clock />
|
|
||||||
</el-icon>
|
|
||||||
<span>{{ formatDateTime(row.creationTime) }}</span>
|
<span>{{ formatDateTime(row.creationTime) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -553,7 +547,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="操作"
|
label="操作"
|
||||||
width="300"
|
width="80"
|
||||||
fixed="right"
|
fixed="right"
|
||||||
align="center"
|
align="center"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
@@ -568,6 +562,7 @@ onMounted(async () => {
|
|||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
style="margin-left: 0px"
|
||||||
size="small"
|
size="small"
|
||||||
:type="row.isDisabled ? 'success' : 'warning'"
|
:type="row.isDisabled ? 'success' : 'warning'"
|
||||||
:icon="row.isDisabled ? Check : Close"
|
:icon="row.isDisabled ? Check : Close"
|
||||||
@@ -577,6 +572,7 @@ onMounted(async () => {
|
|||||||
{{ row.isDisabled ? '启用' : '禁用' }}
|
{{ row.isDisabled ? '启用' : '禁用' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
style="margin-left: 0px"
|
||||||
size="small"
|
size="small"
|
||||||
type="danger"
|
type="danger"
|
||||||
:icon="Delete"
|
:icon="Delete"
|
||||||
@@ -668,7 +664,8 @@ onMounted(async () => {
|
|||||||
border: 1px solid #e8e8e8;
|
border: 1px solid #e8e8e8;
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.04);
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.04);
|
||||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
margin-bottom: 24px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -682,7 +679,7 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-card__body) {
|
:deep(.el-card__body) {
|
||||||
padding: 28px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -829,10 +826,9 @@ onMounted(async () => {
|
|||||||
|
|
||||||
.key-cell {
|
.key-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
padding: 0 8px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.key-content {
|
.key-content {
|
||||||
@@ -864,8 +860,8 @@ onMounted(async () => {
|
|||||||
|
|
||||||
.key-actions {
|
.key-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 4px;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quota-cell {
|
.quota-cell {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ interface TokenFormData {
|
|||||||
id?: string;
|
id?: string;
|
||||||
name: string;
|
name: string;
|
||||||
expireTime: string;
|
expireTime: string;
|
||||||
premiumQuotaLimit: number;
|
premiumQuotaLimit: number | null;
|
||||||
quotaUnit: string;
|
quotaUnit: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,12 +154,11 @@ async function handleConfirm() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// 将展示值转换为实际值
|
// 将展示值转换为实际值
|
||||||
let actualQuota = 0;
|
let actualQuota = null;
|
||||||
if (!unlimitedQuota.value) {
|
if (!unlimitedQuota.value) {
|
||||||
const unit = quotaUnitOptions.find(u => u.value === localFormData.value.quotaUnit);
|
const unit = quotaUnitOptions.find(u => u.value === localFormData.value.quotaUnit);
|
||||||
actualQuota = localFormData.value.premiumQuotaLimit * (unit?.multiplier || 1);
|
actualQuota = localFormData.value.premiumQuotaLimit * (unit?.multiplier || 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitData: TokenFormData = {
|
const submitData: TokenFormData = {
|
||||||
...localFormData.value,
|
...localFormData.value,
|
||||||
expireTime: neverExpire.value ? '' : localFormData.value.expireTime,
|
expireTime: neverExpire.value ? '' : localFormData.value.expireTime,
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { useUserStore } from '@/stores/index.js';
|
import {useUserStore} from '@/stores/index.js';
|
||||||
|
|
||||||
// 判断是否是 VIP 用户
|
// 判断是否是 VIP 用户
|
||||||
export function isUserVip(): boolean {
|
export function isUserVip(): boolean {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const userRoles = userStore.userInfo?.roles ?? [];
|
return userStore.userInfo.isVip;
|
||||||
const isVip = userRoles.some((role: any) => role.roleCode === 'YiXinAi-Vip');
|
|
||||||
return isVip;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户头像
|
// 用户头像
|
||||||
|
|||||||
Reference in New Issue
Block a user