-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
593 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
|
||
/** UI 上的常量*/ | ||
export const UNKNOWN_ERROR_MSG = '未知错误,请重试'; | ||
export const TITLE = '分布式公钥基础设施'; | ||
export const SEARCH_PLACE_HOLDER = '请输入证书编号进行检索'; | ||
|
||
|
||
/** 设置 */ | ||
export const REQUEST_BASE_URL = import.meta.env.MODE === 'development'? '/dev/': '/dpki/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script lang="ts" setup> | ||
import { ref } from "vue"; | ||
import { message, Modal } from "ant-design-vue"; | ||
import { apply } from "@/api/cert"; | ||
const createFormVisible = ref(false); | ||
const certApplyUID = ref(""); | ||
const placeholder = "请输入 UID"; | ||
function createCert() { | ||
const uid = certApplyUID.value; | ||
if (uid === undefined || uid === "") { | ||
message.error("UID 不能为空"); | ||
return; | ||
} | ||
apply({ uid }) | ||
.then((res) => { | ||
Modal.success({ | ||
title: "创建成功", | ||
content: `证书编号为:${res.certificate.serialNumber}`, | ||
okText: "好的", | ||
onOk() { | ||
createFormVisible.value = false; | ||
}, | ||
}); | ||
}) | ||
.catch((err) => { | ||
message.error(err); | ||
}); | ||
} | ||
</script> | ||
|
||
<template> | ||
<a-button @click="createFormVisible = true"> 创建证书 </a-button> | ||
<a-modal v-model:visible="createFormVisible" title="创建"> | ||
<a-form | ||
ref="formRef" | ||
name="custom-validation" | ||
:label-col="{ span: 6 }" | ||
:wrapper-col="{ span: 18 }" | ||
labelAlign="left" | ||
> | ||
<a-form-item label="UID"> | ||
<a-input | ||
v-model:value="certApplyUID" | ||
:placeholder="placeholder" | ||
></a-input> | ||
</a-form-item> | ||
</a-form> | ||
<template #footer> | ||
<a-button key="submit" type="primary" @click="createCert"> | ||
确认创建 | ||
</a-button> | ||
</template> | ||
</a-modal> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<template> | ||
<div class="group"> | ||
<input | ||
type="text" | ||
required | ||
v-model="searchKey" | ||
@keydown.enter="onSearch(searchKey)" | ||
:placeholder="dynamicPlaceholder ? '' : placeholder" | ||
/> | ||
<span class="bar"></span> | ||
<a-button | ||
type="link" | ||
class="search-icon" | ||
size="large" | ||
@click="onSearch(searchKey)" | ||
> | ||
<template #icon> | ||
<SearchOutlined /> | ||
</template> | ||
</a-button> | ||
<label v-if="dynamicPlaceholder">{{ placeholder }}</label> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
import { onSearch } from "@/composition/useSearch"; | ||
import { SearchOutlined } from "@ant-design/icons-vue"; | ||
defineProps({ | ||
placeholder: { | ||
type: String, | ||
default: "请在此输入", | ||
}, | ||
dynamicPlaceholder: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
}); | ||
const searchKey = ref(""); | ||
</script> | ||
|
||
<style scoped> | ||
.group { | ||
position: relative; | ||
} | ||
input { | ||
width: 100%; | ||
border: none; | ||
display: block; | ||
font-size: 18px; | ||
padding: 10px 10px 10px 0; | ||
background-color: transparent; | ||
border-bottom: 1px solid #757575; | ||
} | ||
input:focus { | ||
outline: none; | ||
} | ||
label { | ||
left: 0; | ||
top: 10px; | ||
color: #999; | ||
font-size: 18px; | ||
position: absolute; | ||
font-weight: normal; | ||
pointer-events: none; | ||
transition: 0.2s ease all; | ||
-moz-transition: 0.2s ease all; | ||
-webkit-transition: 0.2s ease all; | ||
} | ||
/* active state */ | ||
input:focus ~ label, | ||
input:valid ~ label { | ||
top: -20px; | ||
font-size: 14px; | ||
color: #646464; | ||
} | ||
.bar { | ||
width: 100%; | ||
display: block; | ||
position: relative; | ||
} | ||
.bar:before { | ||
left: 0%; | ||
width: 0; | ||
bottom: 1px; | ||
content: ""; | ||
height: 2px; | ||
position: absolute; | ||
background: #646464; | ||
transition: 0.2s ease all; | ||
-moz-transition: 0.2s ease all; | ||
-webkit-transition: 0.2s ease all; | ||
} | ||
/* active state */ | ||
input:focus ~ .bar:before { | ||
width: 100%; | ||
} | ||
.search-icon { | ||
position: absolute; | ||
right: 0; | ||
bottom: 3px; | ||
color: black; | ||
} | ||
.search-icon:hover { | ||
color: #1890ff; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script lang="ts" setup> | ||
import { verify } from "@/api/cert"; | ||
import { readLocalFile } from "@/utils/files"; | ||
import { message } from "ant-design-vue"; | ||
function verifyCert() { | ||
readLocalFile( | ||
(_, content) => { | ||
verify(content) | ||
.then((res) => { | ||
if (res === "True") { | ||
message.success("验证通过"); | ||
} | ||
}) | ||
.catch(console.log); | ||
}, | ||
(err) => { | ||
console.log(err); | ||
message.error(err); | ||
} | ||
); | ||
} | ||
</script> | ||
|
||
<template> | ||
<a-button @click="verifyCert"> 验证本地证书 </a-button> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import router from "@/router"; | ||
import { message } from 'ant-design-vue'; | ||
|
||
/** | ||
* 搜索框复用 | ||
* @param searchKey 搜索关键词 | ||
*/ | ||
export function onSearch(searchKey: string) { | ||
const s = searchKey; | ||
if (s.length > 0) { | ||
router.push(`/query/${s}`); | ||
} | ||
else { | ||
message.error('请输入证书编号') | ||
} | ||
} |
Oops, something went wrong.