【调整】部署跳过开关保存问题,证书申请模块增加litessl

This commit is contained in:
cai
2026-01-19 14:35:07 +08:00
parent de29831f2a
commit f588ba643b
60 changed files with 97 additions and 69 deletions

View File

@@ -118,5 +118,6 @@ export interface FreeProductItem {
code: string
num: number
valid_days: number
desc?: string
features: string[]
}

View File

@@ -118,6 +118,8 @@ export default defineComponent({
const currentTab = ref(DeployCategories.ALL)
// 搜索关键字
const searchKeyword = ref('')
// 是否已初始化(用于区分初始化和重新选择类型)
const isInitialized = ref(false)
// 插件方法提示
const pluginActionTips = ref('')
@@ -728,7 +730,9 @@ export default defineComponent({
// 初始化配置模式和跳过开关为默认值
configMode.value = 'default'
param.value.configMode = 'default'
param.value.skip = 1
if (isInitialized.value) {
param.value.skip = 1
}
// 加载证书来源选项
certOptions.value = findApplyUploadNodesUp(props.node.id).map((item) => {
@@ -764,6 +768,7 @@ export default defineComponent({
param.value = {}
param.value.provider_id = ''
param.value.provider = ''
isInitialized.value = true
}
/**

View File

@@ -1,8 +1,8 @@
import type { ProductsType, FreeProductItem } from '@/types/cert'
export const mainTabOptionsData = [
{ key: 'commercial', title: '商业证书', desc: '品牌SSL证书安全保障全球兼容' },
{ key: 'free', title: '免费证书', desc: '适用于个人博客、测试环境的免费SSL证书' },
{ key: 'commercial', title: '商业证书', desc: '品牌SSL证书安全保障全球兼容' },
]
export const typeOptionsData = {
@@ -240,6 +240,17 @@ export const productsData: ProductsType = {
}
export const freeProductsData: FreeProductItem[] = [
{
pid: 9002,
brand: "LiteSSL",
type: '域名型(DV)',
title: "LiteSSL 单域名SSL证书",
code: 'litessl-single',
num: 1,
valid_days: 90,
desc: '是面向全球开发者提供免费、全生命周期自动化的 TLS / SSL 证书。',
features: ['90 天证书', '自主可控', '快速验证', 'ACME 自动化集成'],
},
{
pid: 9001,
brand: "Let's Encrypt",
@@ -248,6 +259,7 @@ export const freeProductsData: FreeProductItem[] = [
code: 'letsencrypt-single',
num: 1,
valid_days: 90,
desc: '是广泛使用的免费SSL证书提供商适合个人网站和测试环境。',
features: ['90天有效期', '自动续期', '单域名', '全球认可'],
},
]

View File

@@ -12,7 +12,7 @@ interface FreeProductCardProps {
valid_days: number
features: string[]
}
onApply: (id: number) => void
onApply: (product: { brand: string }) => void
}
/**
@@ -47,7 +47,7 @@ export default defineComponent({
// 处理申请按钮点击
const handleApply = () => {
props.onApply(props.product.pid)
props.onApply(props.product)
}
// 获取品牌图标
@@ -58,6 +58,7 @@ export default defineComponent({
positive: '/static/icons/positive-ico.png',
ssltrus: '/static/icons/ssltrus-ico.png',
"let's encrypt": isDark.value ? '/static/icons/letsencrypt-icon-dark.svg' : '/static/icons/letsencrypt-icon.svg',
litessl: isDark.value ? '/static/icons/litessl-icon-dark.png' : '/static/icons/litessl-icon.png',
}
return Object.keys(brandIconMap).find((key) => brandLower.includes(key))
? brandIconMap[Object.keys(brandIconMap).find((key) => brandLower.includes(key)) as string]
@@ -66,9 +67,9 @@ export default defineComponent({
return () => (
<div class="bg-[var(--content-bg-secondary)] relative border border-[var(--border-color-transparent)] rounded-[0.8rem] p-[2rem] transition-all duration-300 h-full flex flex-col shadow-sm hover:shadow-md hover:-translate-y-[0.2rem]">
{props.product.brand === "Let's Encrypt" && (
{props.product.brand === "LiteSSL" && (
<div class="absolute top-[1.2rem] right-[1.2rem] z-10">
<NBadge type="info" value={$t('t_12_1746667589733')} />
<NBadge type="warning" value={'推荐'} />
</div>
)}
@@ -83,7 +84,7 @@ export default defineComponent({
<div class="flex-1 w-full">
<h3 class="font-semibold mb-[0.8rem] leading-tight text-[var(--color-card-title)]">{props.product.title}</h3>
<p class="text-[1.3rem] text-color5 m-0 leading-relaxed px-[0.8rem]">
{props.product.brand + $t('t_13_1746667599218')}
{props.product.brand + props.product.desc}
</p>
</div>
</div>

View File

@@ -1,12 +1,22 @@
import { useCertificateFormController } from '@certApply/useController'
interface CertificateFormProps {
product?: { brand: string }
}
/**
* 证书申请表单组件
*/
export default defineComponent({
name: 'CertificateForm',
setup() {
const { CertificateForm } = useCertificateFormController()
props: {
product: {
type: Object as PropType<CertificateFormProps['product']>,
default: () => undefined,
},
},
setup(props) {
const { CertificateForm } = useCertificateFormController(props.product)
return () => <CertificateForm labelPlacement="top" class="max-w-[50rem] mx-auto" />
},
})

View File

@@ -1,5 +1,4 @@
import { useController } from './useController'
import { useRouter } from 'vue-router';
import { NTabs, NTabPane, NEmpty, NIcon } from 'naive-ui'
import ProductCard from './components/ProductCard'
import FreeProductCard from './components/FreeProductCard'
@@ -24,7 +23,6 @@ export default defineComponent({
formatPrice,
handleOpenApplyModal,
} = useController()
const router = useRouter();
return () => (
<div class="w-full max-w-[160rem] mx-auto p-[2rem]">
<div class="bg-[var(--content-bg-base)] rounded-[0.6rem] p-[2.4rem] mb-[3rem]">
@@ -46,6 +44,13 @@ export default defineComponent({
),
default: () => (
<div class="py-[0.4rem] rounded-[1.6rem]">
{activeMainTab.value === 'free' && (
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
{freeProducts.value.map((product) => (
<FreeProductCard key={product.pid} product={product} onApply={() => handleOpenApplyModal(product)} />
))}
</div>
)}
{/* 商业证书内容 */}
{activeMainTab.value === 'commercial' && (
<NTabs
@@ -78,14 +83,6 @@ export default defineComponent({
))}
</NTabs>
)}
{activeMainTab.value === 'free' && (
<div><span onClick={() => router.push("/auto-deploy")} class="cursor-pointer text-[var(--color-text-primary-success)] text-[14px]"></span></div>
// <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
// {freeProducts.value.map((product) => (
// <FreeProductCard key={product.pid} product={product} onApply={handleOpenApplyModal} />
// ))}
// </div>
)}
</div>
),
}}

View File

@@ -49,11 +49,12 @@ export const useController = () => {
/**
* @description 打开申请弹窗
*/
const handleOpenApplyModal = () => {
const handleOpenApplyModal = (product: { brand: string }) => {
useModal({
title: $t(`申请免费证书 - Let's Encrypt`),
title: $t(`申请免费证书 - ${product.brand}`),
area: '520px',
component: CertificateForm,
componentProps: { product },
footer: true,
})
}
@@ -79,7 +80,7 @@ export const useController = () => {
* @description 证书申请表单控制器
* @returns {object} 返回controller对象
*/
export const useCertificateFormController = () => {
export const useCertificateFormController = (product?: { brand: string }) => {
// 表单hooks
const { useFormInput } = useFormHooks()
const { addNewWorkflow } = useWorkflowViewStore()
@@ -148,7 +149,7 @@ export const useCertificateFormController = () => {
const request = async () => {
try {
await addNewWorkflow({
name: `申请免费证书-Let's Encrypt${formData.value.domains}`,
name: `申请免费证书-${product?.brand || "LiteSSL"}${formData.value.domains}`,
exec_type: 'manual',
active: '1',
content: JSON.stringify({

View File

@@ -14,7 +14,7 @@ export const useCertApplyStore = defineStore('cert-apply-store', () => {
const test = ref('证书申请')
// 当前激活的主标签
const activeMainTab = ref<'commercial' | 'free'>('commercial')
const activeMainTab = ref<'commercial' | 'free'>('free')
// 当前激活的子标签
const activeTab = ref<'dv' | 'ov' | 'ev'>('dv')