update show credential
This commit is contained in:
1 parent
09c831b74f
commit
ac7bdc0021
3 files changed
+47
-7
No files matched your search
@@ -6,5 +6,6 @@ export default {
|
||||
operation: '操作',
|
||||
amount: '数量',
|
||||
shouldPayPrice: '应付金额',
|
||||
api: 'API'
|
||||
api: 'API',
|
||||
credential: '密钥'
|
||||
};
|
||||
@@ -5,6 +5,21 @@ export enum IApplicationType {
|
||||
PROXY = 'Proxy'
|
||||
}
|
||||
|
||||
export enum ICredentialType {
|
||||
TOKEN = 'Token',
|
||||
IDENTITY = 'Identity'
|
||||
}
|
||||
|
||||
export interface ICredential {
|
||||
type: ICredentialType;
|
||||
name?: string;
|
||||
token?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
export interface IApplication {
|
||||
id?: string;
|
||||
api?: IApi;
|
||||
@@ -15,6 +30,7 @@ export interface IApplication {
|
||||
user_id?: string;
|
||||
remaining_count?: number;
|
||||
used_count?: number;
|
||||
credential?: ICredential;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
@@ -27,12 +27,24 @@
|
||||
width="100px"
|
||||
class-name="text-center"
|
||||
/>
|
||||
<el-table-column :label="$t('application.field.apiKey')" class-name="api-key" width="330px">
|
||||
<el-table-column :label="$t('application.field.credential')" class-name="api-key" width="330px">
|
||||
<template #default="scope">
|
||||
<span class="key">{{ scope?.row?.api_key }}</span>
|
||||
<span class="copy">
|
||||
<copy-to-clipboard :content="scope?.row?.api_key" />
|
||||
</span>
|
||||
<div v-if="scope?.row?.credential?.type === credentialType.TOKEN">
|
||||
<span class="key">{{ scope?.row?.credential?.token }}</span>
|
||||
<span class="copy">
|
||||
<copy-to-clipboard :content="scope?.row?.credential?.token" />
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="scope?.row?.credential?.type === credentialType.IDENTITY">
|
||||
<span class="key"
|
||||
>{{ scope?.row?.credential?.username }}:{{ scope?.row?.credential?.password }}</span
|
||||
>
|
||||
<span class="copy">
|
||||
<copy-to-clipboard
|
||||
:content="`${scope?.row?.credential?.username}:${scope?.row?.credential?.password}`"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column>
|
||||
@@ -65,7 +77,14 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { applicationOperator, IApplication, IApplicationListResponse, IService } from '@/operators';
|
||||
import {
|
||||
applicationOperator,
|
||||
IApplication,
|
||||
IApplicationListResponse,
|
||||
IApplicationType,
|
||||
ICredentialType,
|
||||
IService
|
||||
} from '@/operators';
|
||||
import Pagination from '@/components/common/Pagination.vue';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
import CreateOrder from '@/components/order/Create.vue';
|
||||
@@ -85,6 +104,8 @@ interface IData {
|
||||
service: IService | undefined;
|
||||
application: IApplication | undefined;
|
||||
};
|
||||
applicationType: typeof IApplicationType;
|
||||
credentialType: typeof ICredentialType;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
@@ -102,6 +123,8 @@ export default defineComponent({
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
credentialType: ICredentialType,
|
||||
applicationType: IApplicationType,
|
||||
applications: [],
|
||||
loading: false,
|
||||
total: undefined,
|
||||
|
||||
Reference in new issue
Block a user