mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
chore: 1
This commit is contained in:
@@ -27,6 +27,12 @@ function createService() {
|
||||
}
|
||||
// dataAxios 是 axios 返回数据中的 data
|
||||
const dataAxios = response.data;
|
||||
|
||||
if (response.config.unpack === false) {
|
||||
//如果不需要解包
|
||||
return dataAxios;
|
||||
}
|
||||
|
||||
// 这个状态码是和后端约定的
|
||||
const { code } = dataAxios;
|
||||
// 根据 code 进行判断
|
||||
@@ -40,10 +46,6 @@ function createService() {
|
||||
case 0:
|
||||
// [ 示例 ] code === 0 代表没有错误
|
||||
// @ts-ignore
|
||||
if (response.config.unpack === false) {
|
||||
//如果不需要解包
|
||||
return dataAxios;
|
||||
}
|
||||
return dataAxios.data;
|
||||
default:
|
||||
// 不是正确的 code
|
||||
|
||||
@@ -65,6 +65,9 @@ const onError = (error: any) => {
|
||||
};
|
||||
|
||||
const nextTime = computed(() => {
|
||||
if (props.modelValue == null) {
|
||||
return "请先设置正确的cron表达式";
|
||||
}
|
||||
try {
|
||||
const interval = parser.parseExpression(props.modelValue);
|
||||
const next = interval.next().getTime();
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<div class="description mt-5">
|
||||
<div v-for="desc of currentStepItem.descriptions">{{ desc }}</div>
|
||||
</div>
|
||||
<div v-if="currentStepItem.body">
|
||||
<fs-render :render-func="currentStepItem.body" />
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="currentStepItem.image">
|
||||
<div class="image-box">
|
||||
@@ -17,13 +20,15 @@
|
||||
</div>
|
||||
|
||||
<div class="flex-center actions">
|
||||
<fs-button class="m-10" icon="mingcute:arrow-left-fill" @click="prev()">上一步</fs-button>
|
||||
<fs-button class="m-10" type="primary" icon-right="mingcute:arrow-right-fill" @click="next()">下一步</fs-button>
|
||||
<fs-button class="m-10" icon="ion:arrow-back-outline" @click="prev()">上一步</fs-button>
|
||||
<fs-button class="m-10" type="primary" icon-right="ion:arrow-forward-outline" @click="next()">下一步</fs-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { FsRender } from "@fast-crud/fast-crud";
|
||||
import SimpleSteps from "./simple-steps.vue";
|
||||
type Step = {
|
||||
title: string;
|
||||
subTitle?: string;
|
||||
@@ -34,6 +39,7 @@ type StepItems = {
|
||||
image?: string;
|
||||
title: string;
|
||||
descriptions?: string[];
|
||||
body?: () => JSX.Element;
|
||||
};
|
||||
|
||||
import { computed, nextTick, ref } from "vue";
|
||||
@@ -45,7 +51,10 @@ const steps = ref<Step[]>([
|
||||
items: [
|
||||
{
|
||||
title: "教程演示内容",
|
||||
descriptions: ["本教程演示如何自动申请证书并部署到Nginx上"]
|
||||
descriptions: ["本教程演示如何自动申请证书并部署到Nginx上", "仅需3步,全自动申请部署证书"],
|
||||
body: () => {
|
||||
return <SimpleSteps></SimpleSteps>;
|
||||
}
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/1-add.png",
|
||||
@@ -290,5 +299,9 @@ function previewMask() {
|
||||
font-size: 12px !important;
|
||||
color: #999 !important;
|
||||
}
|
||||
|
||||
.description {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<a-dropdown>
|
||||
<div class="fs-user-info">您好,{{ userStore.getUserInfo?.nickName }}</div>
|
||||
<div class="fs-user-info">您好,{{ userStore.getUserInfo?.nickName || userStore.getUserInfo?.username }}</div>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item>
|
||||
|
||||
@@ -48,7 +48,7 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
|
||||
wrapper: {
|
||||
width: 1350,
|
||||
saveRemind: false,
|
||||
title: "创建证书申请流水线"
|
||||
title: "创建证书流水线"
|
||||
}
|
||||
},
|
||||
columns: {
|
||||
@@ -113,6 +113,7 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
|
||||
}),
|
||||
form: {
|
||||
order: 101,
|
||||
value: true,
|
||||
helper: {
|
||||
render: () => {
|
||||
if (settingStore.isPlus) {
|
||||
@@ -120,7 +121,7 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
建议启用,需要配置<router-link to={{ path: "/sys/settings/email" }}>邮件服务器</router-link>才能发送邮件(专业版请忽略)
|
||||
建议启用,需要配置<router-link to={{ path: "/sys/settings/email" }}>邮件服务器</router-link>才能发送邮件
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { request } from "/@/api/service";
|
||||
import { LocalStorage } from "/@/utils/util.storage";
|
||||
|
||||
export async function GetStatisticCount() {
|
||||
return await request({
|
||||
@@ -6,3 +7,23 @@ export async function GetStatisticCount() {
|
||||
method: "POST"
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetLatestVersion() {
|
||||
const latest = LocalStorage.get("latestVersion");
|
||||
if (latest) {
|
||||
return latest;
|
||||
}
|
||||
const res = await request({
|
||||
url: "https://registry.npmmirror.com/@certd/pipeline",
|
||||
method: "GET",
|
||||
unpack: false
|
||||
});
|
||||
try {
|
||||
const latest = res["dist-tags"].latest;
|
||||
LocalStorage.set("latestVersion", latest, 60 * 60 * 24);
|
||||
return latest;
|
||||
} catch (e: any) {
|
||||
console.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,23 +13,26 @@
|
||||
<span>您好,{{ userInfo.nickName || userInfo.username }}, 欢迎使用 【{{ siteInfo.title }}】</span>
|
||||
</div>
|
||||
<div>
|
||||
<a-tag color="green" class="flex-inline"> <fs-icon icon="ion:time-outline" class="mr-5"></fs-icon> {{ now }}</a-tag>
|
||||
<a-tag color="blue" class="flex-inline"> <fs-icon icon="ion:rocket-outline" class="mr-5"></fs-icon> v{{ version }}</a-tag>
|
||||
<a-tag color="green" class="flex-inline pointer"> <fs-icon icon="ion:time-outline" class="mr-5"></fs-icon> {{ now }}</a-tag>
|
||||
<a-badge v-if="userStore.isAdmin" :dot="hasNewVersion">
|
||||
<a-tag color="blue" class="flex-inline pointer" :title="'最新版本:' + latestVersion">
|
||||
<fs-icon icon="ion:rocket-outline" class="mr-5"></fs-icon>
|
||||
v{{ version }}
|
||||
</a-tag>
|
||||
</a-badge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="suggest">
|
||||
<div>
|
||||
<tutorial-button class="flex-center">
|
||||
<a-tooltip title="点击查看详细教程">
|
||||
<a-tag color="blue" class="flex-center">
|
||||
仅需3步,全自动申请部署证书
|
||||
<fs-icon class="font-size-16 ml-5" icon="mingcute:question-line"></fs-icon>
|
||||
</a-tag>
|
||||
</a-tooltip>
|
||||
</tutorial-button>
|
||||
<simple-steps></simple-steps>
|
||||
</div>
|
||||
<tutorial-button class="flex-center mt-10">
|
||||
<a-tooltip title="点击查看详细教程">
|
||||
<a-tag color="blue" class="flex-center">
|
||||
仅需3步,全自动申请部署证书
|
||||
<fs-icon class="font-size-16 ml-5" icon="mingcute:question-line"></fs-icon>
|
||||
</a-tag>
|
||||
</a-tooltip>
|
||||
</tutorial-button>
|
||||
<SimpleSteps></SimpleSteps>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!settingStore.isComm" class="warning">
|
||||
@@ -49,12 +52,12 @@
|
||||
<statistic-card title="证书流水线数量" :count="count.pipelineCount">
|
||||
<template v-if="count.pipelineCount === 0" #default>
|
||||
<div class="flex-center flex-1 flex-col">
|
||||
<div style="font-size: 20px; font-weight: 700">您还没有证书流水线</div>
|
||||
<fs-button class="mt-10" icon="ion:add-circle-outline" type="primary" @click="goPipeline">立即添加</fs-button>
|
||||
<div style="font-size: 18px; font-weight: 700">您还没有证书流水线</div>
|
||||
<fs-button type="primary" class="mt-10" icon="ion:add-circle-outline" @click="goPipeline">立即创建</fs-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<router-link to="/certd/pipeline" class="flex"><fs-icon icon="ion:add-circle-outline" class="mr-5 fs-16" /> 管理流水线</router-link>
|
||||
<router-link to="/certd/pipeline" class="flex"><fs-icon icon="ion:settings-outline" class="mr-5 fs-16" /> 管理流水线</router-link>
|
||||
</template>
|
||||
</statistic-card>
|
||||
</a-col>
|
||||
@@ -104,7 +107,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { FsIcon } from "@fast-crud/fast-crud";
|
||||
import SimpleSteps from "./simple-steps.vue";
|
||||
import SimpleSteps from "/@/components/tutorial/simple-steps.vue";
|
||||
import { useUserStore } from "/@/store/modules/user";
|
||||
import { computed, ComputedRef, onMounted, Ref, ref } from "vue";
|
||||
import dayjs from "dayjs";
|
||||
@@ -121,12 +124,31 @@ import { SiteInfo } from "/@/api/modules/api.basic";
|
||||
import { UserInfoRes } from "/@/api/modules/api.user";
|
||||
import { GetStatisticCount } from "/@/views/framework/home/dashboard/api";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
import * as api from "./api";
|
||||
defineOptions({
|
||||
name: "DashboardUser"
|
||||
});
|
||||
|
||||
const version = ref(import.meta.env.VITE_APP_VERSION);
|
||||
const latestVersion = ref();
|
||||
const hasNewVersion = computed(() => {
|
||||
if (!latestVersion.value) {
|
||||
return false;
|
||||
}
|
||||
//分段比较
|
||||
const current = version.value.split(".");
|
||||
const latest = latestVersion.value.split(".");
|
||||
for (let i = 0; i < current.length; i++) {
|
||||
if (parseInt(latest[i]) > parseInt(current[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
async function loadLatestVersion() {
|
||||
latestVersion.value = await api.GetLatestVersion();
|
||||
console.log("latestVersion", latestVersion.value);
|
||||
}
|
||||
const settingStore = useSettingStore();
|
||||
const siteInfo: Ref<SiteInfo> = computed(() => {
|
||||
return settingStore.siteInfo;
|
||||
@@ -183,6 +205,7 @@ async function loadPluginGroups() {
|
||||
|
||||
const pluginGroups = ref();
|
||||
onMounted(async () => {
|
||||
await loadLatestVersion();
|
||||
await loadCount();
|
||||
await loadPluginGroups();
|
||||
});
|
||||
@@ -204,7 +227,7 @@ onMounted(async () => {
|
||||
background-color: #fff;
|
||||
|
||||
.avatar {
|
||||
margin-right: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.text {
|
||||
flex: 1;
|
||||
|
||||
Reference in New Issue
Block a user