mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
chore:
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.fs-iconify{
|
||||
font-size:18px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.cd-icon-button {
|
||||
|
||||
@@ -1,55 +1,53 @@
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
export function createApi() {
|
||||
const apiPrefix = "/open/key";
|
||||
return {
|
||||
async GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
});
|
||||
},
|
||||
export const OPEN_API_DOC = "https://apifox.com/apidoc/shared-2e76f8c4-7c58-413b-a32d-a1316529af44/254949529e0";
|
||||
|
||||
async AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
},
|
||||
const apiPrefix = "/open/key";
|
||||
export const openkeyApi = {
|
||||
async GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
});
|
||||
},
|
||||
|
||||
async UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
},
|
||||
async AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
},
|
||||
|
||||
async DelObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
async UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
},
|
||||
|
||||
async GetObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
async GetApiToken(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/getApiToken",
|
||||
method: "post",
|
||||
data: { id }
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
async DelObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
|
||||
export const pipelineGroupApi = createApi();
|
||||
async GetObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
async GetApiToken(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/getApiToken",
|
||||
method: "post",
|
||||
data: { id }
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
// @ts-ignore
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { pipelineGroupApi } from "./api";
|
||||
import dayjs from "dayjs";
|
||||
import { Modal } from "ant-design-vue";
|
||||
import CertView from "/@/views/certd/pipeline/cert-view.vue";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { OPEN_API_DOC, openkeyApi } from "./api";
|
||||
import { useModal } from "/@/use/use-modal";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const api = pipelineGroupApi;
|
||||
const api = openkeyApi;
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
@@ -59,17 +56,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
actionbar: {
|
||||
buttons: {
|
||||
add: {
|
||||
text: "生成新的Key",
|
||||
click() {
|
||||
Modal.confirm({
|
||||
title: "确认",
|
||||
content: "确定要生成新的Key?",
|
||||
async onOk() {
|
||||
await api.AddObj({});
|
||||
await crudExpose.doRefresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
text: "生成新的Key"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -82,7 +69,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
edit: { show: false },
|
||||
remove: { show: true },
|
||||
gen: {
|
||||
text: "测试ApiToken",
|
||||
text: " 接口测试",
|
||||
size: "mini",
|
||||
icon: "devicon-plain:vitest",
|
||||
type: "primary",
|
||||
async click({ row }) {
|
||||
const apiToken = await api.GetApiToken(row.id);
|
||||
|
||||
@@ -94,7 +84,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
content: () => {
|
||||
return (
|
||||
<div>
|
||||
<div class={"m-10 p-10"}>测试ApiKey如下,您可以在3分钟内使用它进行开放接口请求测试</div>
|
||||
<div class={"m-10 p-10"}>
|
||||
测试ApiKey如下,您可以在3分钟内使用它进行
|
||||
<a href={OPEN_API_DOC} target={"_blank"}>
|
||||
开放接口
|
||||
</a>
|
||||
请求测试
|
||||
</div>
|
||||
<div class={"m-10 p-10"} style={{ border: "1px solid #333" }}>
|
||||
<fs-copyable model-value={apiToken}></fs-copyable>
|
||||
</div>
|
||||
@@ -126,26 +122,50 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
keyId: {
|
||||
title: "KeyId",
|
||||
type: ["text", "copyable"],
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
type: "text",
|
||||
column: {
|
||||
width: 200,
|
||||
width: 250,
|
||||
sorter: true
|
||||
}
|
||||
},
|
||||
keySecret: {
|
||||
title: "KeySecret",
|
||||
type: "text",
|
||||
type: ["text", "copyable"],
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 550,
|
||||
width: 580,
|
||||
sorter: true
|
||||
}
|
||||
},
|
||||
scope: {
|
||||
title: "权限范围",
|
||||
type: "dict-radio",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "仅开放接口", value: "open", color: "blue" },
|
||||
{ label: "账户所有权限", value: "user", color: "red" }
|
||||
]
|
||||
}),
|
||||
form: {
|
||||
value: "open",
|
||||
show: true,
|
||||
rules: [{ required: true, message: "此项必填" }],
|
||||
helper: "仅开放接口只可以访问开放接口,账户所有权限可以访问所有接口",
|
||||
component: {
|
||||
vModel: "value"
|
||||
}
|
||||
},
|
||||
column: {
|
||||
width: 120,
|
||||
align: "center",
|
||||
sorter: true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,16 +2,20 @@
|
||||
<fs-page>
|
||||
<template #header>
|
||||
<div class="title">开放接口密钥管理</div>
|
||||
<div class="more">
|
||||
<a :href="OPEN_API_DOC" target="_blank">开放接口文档</a>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineComponent, onActivated, onMounted } from "vue";
|
||||
import { onActivated, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { createApi } from "./api";
|
||||
import { OPEN_API_DOC } from "/@/views/certd/open/openkey/api";
|
||||
|
||||
defineOptions({
|
||||
name: "OpenKey"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user