-
密钥管理
+
密钥详情
- 密钥:{{ showCode }}
+ {{ $t("keyMangage.name") }}:{{ name }}
+
+
+
+ appId:{{ showCode }}
{{ showText }}
- 复制
+
+
+
+ appKey:{{ showCodeII }}
+ {{ showTextII }}
+ 复制
+
+
+
+ signKey:{{ showCodeIII }}
+ {{
+ showTextIII
+ }}
+ 复制
密钥状态:
- 作废
- 正常
+ 正常
+ 失效
- 恢复
- 恢复
+ 作废
@@ -36,40 +59,107 @@ import { useI18n } from "vue-i18n";
import { useRoute, useRouter } from "vue-router";
+import { getKeyByIdApi, updateKeyStatusApi } from "@/api_mangage/key";
+
const route = useRoute();
const router = useRouter();
const { locale } = useI18n();
const lanChange = ref(locale);
const AccessToken = localStorage.getItem("AccessToken"); // 判断有没有登录
-const key = ref("AE0DVHDWMDOURSBCAP");
+const keyId = ref("");
+const name = ref("");
+
+const appId = ref("");
const hideCode = ref("");
const showCode = ref("");
const showText = ref("查看");
-const getKey = () => {
- const len = key.value.length;
- let code = "";
- for (let index = 0; index < len; index++) {
- code += "*";
- }
- hideCode.value = code;
- showCode.value = code;
-};
-
const showHideCode = () => {
if (showText.value == "查看") {
showText.value = "隐藏";
- showCode.value = key.value;
+ showCode.value = appId.value;
} else {
showText.value = "查看";
showCode.value = hideCode.value;
}
};
-const copyKey = () => {
+const appKey = ref("");
+const hideCodeII = ref("");
+const showCodeII = ref("");
+const showTextII = ref("查看");
+
+const showHideCodeII = () => {
+ if (showTextII.value == "查看") {
+ showTextII.value = "隐藏";
+ showCodeII.value = appKey.value;
+ } else {
+ showTextII.value = "查看";
+ showCodeII.value = hideCodeII.value;
+ }
+};
+
+const signKey = ref("");
+const hideCodeIII = ref("");
+const showCodeIII = ref("");
+const showTextIII = ref("查看");
+
+const showHideCodeIII = () => {
+ if (showTextIII.value == "查看") {
+ showTextIII.value = "隐藏";
+ showCodeIII.value = signKey.value;
+ } else {
+ showTextIII.value = "查看";
+ showCodeIII.value = hideCodeIII.value;
+ }
+};
+
+const getKeyFunc = async () => {
+ const id = keyId.value;
+ try {
+ const res = await getKeyByIdApi(id);
+ console.log(res, "res");
+ appId.value = res.data.appId;
+ appKey.value = res.data.appKey;
+ signKey.value = res.data.signKey;
+ keyStatus.value = res.data.status;
+ name.value = res.data.name;
+
+ const len = signKey.value.length;
+ const lenII = signKey.value.length;
+ const lenIII = signKey.value.length;
+
+ let code = "";
+ let codeII = "";
+ let codeIII = "";
+ for (let index = 0; index < len; index++) {
+ code += "*";
+ }
+
+ for (let index = 0; index < lenII; index++) {
+ codeII += "*";
+ }
+
+ for (let index = 0; index < lenIII; index++) {
+ codeIII += "*";
+ }
+ hideCode.value = code;
+ showCode.value = code;
+
+ hideCodeII.value = codeII;
+ showCodeII.value = codeII;
+
+ hideCodeIII.value = codeIII;
+ showCodeIII.value = codeIII;
+ } catch (error) {
+ console.log(error, "err");
+ }
+};
+
+const copyKey = (text) => {
navigator.clipboard
- .writeText(key.value)
+ .writeText(text)
.then(() => {
ElMessage.success("复制成功!");
})
@@ -80,19 +170,48 @@ const copyKey = () => {
const keyStatus = ref("");
-const getStatus = () => {
- // 1:正常;2:作废
- const status = 1;
- keyStatus.value = status;
-};
-
-const changeStatus = (num) => {
- keyStatus.value = num;
+const changeStatus = async (status) => {
+ const id = keyId.value;
+ if (status) {
+ ElMessageBox.confirm("此操作将作废密钥,确定?", "Warning", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(async () => {
+ try {
+ const res = await updateKeyStatusApi(id, status);
+ if (res.code == 200) {
+ ElMessage({
+ type: "success",
+ message: "作废成功!",
+ });
+ getKeyFunc();
+ }
+ } catch (error) {
+ console.log(error, "err");
+ }
+ })
+ .catch(() => {});
+ } else {
+ try {
+ const res = await updateKeyStatusApi(id, status);
+ if (res.code == 200) {
+ ElMessage({
+ type: "success",
+ message: "恢复成功!",
+ });
+ getKeyFunc();
+ }
+ } catch (error) {
+ console.log(error, "err");
+ }
+ }
};
onMounted(() => {
- getKey();
- getStatus();
+ keyId.value = route.query.id;
+ getKeyFunc();
});
@@ -104,9 +223,9 @@ onMounted(() => {
border-radius: 30px 0 0 0;
overflow: hidden;
.card {
- width: 60%;
- height: 55%;
- background-color: #f8f8f8;
+ width: 80%;
+ height: 70%;
+ background-color: #fafafa;
margin-top: 10vh;
border-radius: 5vh;
box-shadow: #0000002e 1px 1px 1px 1px;
@@ -119,8 +238,10 @@ onMounted(() => {
.key {
text-align: center;
- font-size: 3vh;
- padding: 4vh;
+ font-size: 2.5vh;
+ padding: 5vh;
+ padding-bottom: 0.5vh;
+ text-align: left;
.copy {
color: #ffffff;
@@ -146,8 +267,9 @@ onMounted(() => {
}
.keyStatus {
text-align: center;
- font-size: 3vh;
+ font-size: 2.9vh;
padding: 4vh;
+ margin-top: 1vh;
.success {
color: #ffffff;
diff --git a/src/views/mangage/keyList.vue b/src/views/mangage/keyList.vue
new file mode 100644
index 0000000..a78ba77
--- /dev/null
+++ b/src/views/mangage/keyList.vue
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+ {{ getStatus(scope.row.status) }}
+
+
+
+
+
+ {{ $t("keyMangage.check") }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/myCreating/index copy.vue b/src/views/myCreating/index copy.vue
deleted file mode 100644
index a5a0054..0000000
--- a/src/views/myCreating/index copy.vue
+++ /dev/null
@@ -1,698 +0,0 @@
-
-
-
-
-
-
-
-
-
-
![]()
-
![](@/assets/img/left-top-logo.png)
-
-
-
- {{ $t("myCreating." + item.statusName) }}
-
-
-
- {{ item.title }}
- {{ dayjs(item.createDate).format("YYYY-MM-DD") }}
-
-
-
-
-
-
-
-
...
-
-
-
-
-
-
-
{{ $t("myCreating.download") }}
-
-
-
-
-
-
-
{{ $t("myCreating.delete") }}
-
-
-
-
-
-
-
- {{ $t("myCreating.noList") }}
-
-
- {{ $t("myCreating.goCreate") }}
-
-
-
-
-
-
-
-
{{ $t("myCreating.loading") }}
-
-
-
-
-
-
- {{ $t("myCreating." + presentItem.statusName + "Text") }}
- {{
- presentItem.videoMsg
- }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-