Skip to content

Commit e2d0986

Browse files
committed
【调整】自动部署证书申请调整
1 parent 4fd115d commit e2d0986

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+74
-54
lines changed

frontend/apps/allin-ssl/src/views/autoDeploy/children/workflowView/node/apply/model.tsx

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
NInputNumber,
44
NSwitch,
55
NSelect,
6-
NAutoComplete,
76
NInput,
87
NFlex,
98
NText,
@@ -15,6 +14,7 @@ import {
1514
} from 'naive-ui'
1615
import { useForm, useFormHooks, useModalHooks } from '@baota/naive-ui/hooks'
1716
import { useStore } from '@components/FlowChart/useStore'
17+
import { useRoute } from '@baota/router'
1818
import { $t } from '@locales/index'
1919
import rules from './verify'
2020
import DnsProviderSelect from '@components/DnsProviderSelect'
@@ -54,20 +54,26 @@ export default defineComponent({
5454
},
5555
setup(props) {
5656
const { updateNodeConfig, advancedOptions, isRefreshNode } = useStore()
57+
// 获取路由信息
58+
const route = useRoute()
5759
// 弹窗辅助
5860
const { confirm } = useModalHooks()
5961
// 获取表单助手函数
6062
const { useFormInput, useFormSelect, useFormMore, useFormHelp, useFormSwitch } = useFormHooks()
6163
// 表单参数
6264
const param = ref(deepClone(props.node.config))
6365

66+
// 获取路由参数
67+
const isEdit = computed(() => route.query.isEdit === 'true')
68+
const routeEmail = computed(() => (route.query.email as string) || '')
69+
6470
// CA选项状态
6571
const caOptions = ref<Array<{ label: string; value: string; icon: string }>>([])
6672
const emailOptions = ref<string[]>([])
6773
const isLoadingCA = ref(false)
6874
const isLoadingEmails = ref(false)
6975
const showEmailDropdown = ref(false)
70-
const emailInputRef = ref<any>(null)
76+
const emailInputRef = ref<InstanceType<typeof NInput> | null>(null)
7177

7278
// 加载CA选项
7379
const loadCAOptions = async () => {
@@ -121,12 +127,20 @@ export default defineComponent({
121127
try {
122128
const { data } = await getEabList({ ca, p: 1, limit: 1000 }).fetch()
123129
emailOptions.value = data?.map((item) => item.email).filter(Boolean) || []
124-
if (!emailOptions.value.length) {
125-
param.value.email = ''
126-
}
127-
// 如果邮箱数组有内容且当前邮箱为空,自动填充第一个邮箱地址
128-
if (emailOptions.value.length > 0 && emailOptions.value[0]) {
129-
param.value.email = emailOptions.value[0]
130+
131+
// 检查是否为编辑模式且有外部传入的邮箱
132+
if (isEdit.value && routeEmail.value) {
133+
// 编辑模式:使用外部传入的邮箱地址
134+
param.value.email = routeEmail.value
135+
} else {
136+
// 非编辑模式:保持原有逻辑
137+
if (!emailOptions.value.length) {
138+
param.value.email = ''
139+
}
140+
// 如果邮箱数组有内容且当前邮箱为空,自动填充第一个邮箱地址
141+
if (emailOptions.value.length > 0 && emailOptions.value[0] && !param.value.email) {
142+
param.value.email = emailOptions.value[0]
143+
}
130144
}
131145
} catch (error) {
132146
console.error('加载邮件选项失败:', error)
@@ -138,7 +152,8 @@ export default defineComponent({
138152
// 处理CA选择变化
139153
const handleCAChange = (value: string) => {
140154
param.value.ca = value
141-
loadEmailOptions(value)
155+
// 移除直接调用 loadEmailOptions,让 watch 监听器统一处理
156+
// 这样避免了用户切换CA时的重复 API 请求
142157
}
143158

144159
// 跳转到CA管理页面
@@ -157,7 +172,7 @@ export default defineComponent({
157172
}
158173

159174
// 渲染CA选择器单选标签
160-
const renderSingleSelectTag = ({ option }: { option: any }) => {
175+
const renderSingleSelectTag = ({ option }: any) => {
161176
return (
162177
<NFlex align="center">
163178
{option.label ? renderLabel(option) : <NText class="text-[#aaa]">{$t('t_0_1747990228780')}</NText>}
@@ -472,10 +487,14 @@ export default defineComponent({
472487
onMounted(async () => {
473488
advancedOptions.value = false
474489
await loadCAOptions()
475-
// 如果初始化时已有CA值,加载对应的邮箱选项
476-
if (param.value.ca) {
477-
await loadEmailOptions(param.value.ca)
490+
491+
// 如果是编辑模式且有外部传入的邮箱,直接设置邮箱值
492+
if (isEdit.value && routeEmail.value) {
493+
param.value.email = routeEmail.value
478494
}
495+
496+
// 移除重复调用,让 watch 监听器处理 CA 值变化
497+
// 这样避免了 onMounted 和 watch 同时调用 loadEmailOptions 导致的重复请求
479498
})
480499

481500
// 确认事件触发

frontend/apps/allin-ssl/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export default defineConfig({
112112
discardChanges: true,
113113
},
114114
],
115+
115116
localSync: [
116117
{
117118
source: 'apps/allin-ssl/dist',

static/build/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="icon" href="./favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>AllinSSL</title>
8-
<script type="module" crossorigin src="./static/js/main-CjRU4uiB.js"></script>
8+
<script type="module" crossorigin src="./static/js/main-CpZ6R5yx.js"></script>
99
<link rel="stylesheet" crossorigin href="./static/css/style-CDEpaaff.css">
1010
</head>
1111
<body>
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)