【新增】部署类型七牛云oss、七牛云cdn、百度cdn、腾讯waf、腾讯edgeone、阿里云waf

【新增】解析类型godaddy
【新增】自定义CA授权管理
【调整】优化部署流程,减少代码冗余,提升类型添加效率
This commit is contained in:
chudong
2025-05-23 16:58:34 +08:00
parent 71de397e11
commit e5634d4992
263 changed files with 18348 additions and 14253 deletions

View File

@@ -1,6 +1,8 @@
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
import axios from 'axios'
import { requestMiddleware, responseMiddleware, errorMiddleware } from './other'
import type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
/**
* 中间件类型定义
* @property request - 请求拦截器,用于处理请求配置
@@ -10,7 +12,7 @@ import { requestMiddleware, responseMiddleware, errorMiddleware } from './other'
export type Middleware = {
request?: (config: AxiosRequestConfig) => AxiosRequestConfig | Promise<AxiosRequestConfig>
response?: (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse>
error?: (error: unknown) => unknown
error?: (error: AxiosError) => AxiosError | Promise<AxiosError>
}
/**
@@ -135,8 +137,8 @@ class HttpClient {
* @param config - 请求配置
* @returns Promise<AxiosResponse<T>> - 返回请求响应
*/
public async get<T = unknown>(url: string, config: AxiosRequestConfig = {}): Promise<AxiosResponse<T>> {
return this.request<T>({ ...config, url, method: 'get' })
public async get<T = unknown>(url: string, config: AxiosRequestConfig = {}) {
return this.request<T>({ ...config, url, method: 'get' }) as Promise<AxiosResponse<T>>
}
/**
@@ -146,12 +148,8 @@ class HttpClient {
* @param config - 请求配置
* @returns Promise<AxiosResponse<T>> - 返回请求响应
*/
public async post<T = unknown>(
url: string,
data?: Record<string, unknown>,
config: AxiosRequestConfig = {},
): Promise<AxiosResponse<T>> {
return this.request<T>({ ...config, url, data, method: 'post' })
public async post<T = unknown>(url: string, data?: Record<string, unknown>, config: AxiosRequestConfig = {}) {
return this.request<T>({ ...config, url, data, method: 'post' }) as Promise<AxiosResponse<T>>
}
/**
@@ -161,12 +159,8 @@ class HttpClient {
* @param config - 请求配置
* @returns Promise<AxiosResponse<T>> - 返回请求响应
*/
public async put<T = unknown>(
url: string,
data?: Record<string, unknown>,
config: AxiosRequestConfig = {},
): Promise<AxiosResponse<T>> {
return this.request<T>({ ...config, url, data, method: 'put' })
public async put<T = unknown>(url: string, data?: Record<string, unknown>, config: AxiosRequestConfig = {}) {
return this.request<T>({ ...config, url, data, method: 'put' }) as Promise<AxiosResponse<T>>
}
/**
@@ -175,8 +169,8 @@ class HttpClient {
* @param config - 请求配置
* @returns Promise<AxiosResponse<T>> - 返回请求响应
*/
public async delete<T = unknown>(url: string, config: AxiosRequestConfig = {}): Promise<AxiosResponse<T>> {
return this.request<T>({ ...config, url, method: 'delete' })
public async delete<T = unknown>(url: string, config: AxiosRequestConfig = {}) {
return this.request<T>({ ...config, url, method: 'delete' }) as Promise<AxiosResponse<T>>
}
}

View File

@@ -20,15 +20,6 @@ export default defineComponent({
const { naiveLocale, naiveDateLocale } = useNaiveI18nSync(locale) // i18n 同步
const { theme, themeOverrides } = useTheme() // 主题
console.log(theme.value, themeOverrides.value)
watch(
() => themeOverrides.value,
(newVal) => {
console.log('1111', newVal)
},
)
// 国际化配置
return () => (
<NConfigProvider

View File

@@ -126,7 +126,6 @@ const processFormItemSlots = (slot?: { prefix?: Array<() => JSX.Element>; suffix
render: item,
}))
: []
const suffixElements = slot?.suffix
? slot.suffix.map((item: () => JSX.Element) => ({
type: 'render' as const,
@@ -293,12 +292,12 @@ export default function useForm<T>(options: UseFormOptions<T>) {
// 处理插槽元素:使用配置的插槽函数渲染内容
if (isSlotElement(element)) {
console.log(element, 'element')
return slots?.[element.slot]?.(data as unknown as Ref<T>, formRef) ?? null
}
// 处理自定义渲染元素:调用自定义渲染函数
if (isRenderElement(element)) {
console.log(data, 'data')
return element.render(data as unknown as Ref<T>, formRef)
}
// 处理基础表单元素:使用组件映射表渲染对应组件
@@ -635,7 +634,7 @@ const useFormRadio = (
itemAttrs?: FormItemProps & { class?: string },
slot?: { prefix?: Array<() => JSX.Element>; suffix?: Array<() => JSX.Element> },
) => {
return createFormItem(label, key, 'radio', { options, ...other }, itemAttrs, slot)
return createFormItem(label, key, 'radio', { options, ...other }, itemAttrs, slot || {})
}
/**
@@ -651,7 +650,7 @@ const useFormRadioButton = (
itemAttrs?: FormItemProps & { class?: string },
slot?: { prefix?: Array<() => JSX.Element>; suffix?: Array<() => JSX.Element> },
) => {
return createFormItem(label, key, 'radioButton', { options, ...other }, itemAttrs, slot)
return createFormItem(label, key, 'radioButton', { options, ...other }, itemAttrs, slot || {})
}
/**
* 创建一个表单复选框
@@ -666,7 +665,7 @@ const useFormCheckbox = (
itemAttrs?: FormItemProps & { class?: string },
slot?: { prefix?: Array<() => JSX.Element>; suffix?: Array<() => JSX.Element> },
) => {
return createFormItem(label, key, 'checkbox', { options, ...other } as any, itemAttrs, slot)
return createFormItem(label, key, 'checkbox', { options, ...other } as any, itemAttrs, slot || {})
}
/**
@@ -679,7 +678,7 @@ const useFormSwitch = (
key: string,
other?: SwitchProps & { class?: string },
itemAttrs?: FormItemProps & { class?: string },
slot?: SwitchSlots,
slot?: { prefix?: Array<() => JSX.Element>; suffix?: Array<() => JSX.Element> },
) => {
return createFormItem(label, key, 'switch', { ...other }, itemAttrs, slot)
}
@@ -739,9 +738,9 @@ const useFormMore = (isMore: Ref<boolean>, content?: string) => {
return {
type: 'custom',
render: () => (
<NDivider class="cursor-pointer w-full !m-[1rem]" onClick={() => (isMore.value = !isMore.value)}>
<NDivider class="cursor-pointer w-full" style={{ marginTop: '0' }} onClick={() => (isMore.value = !isMore.value)}>
<div class="flex items-center w-full" style={{ color }}>
<span class="mr-[4px]">
<span class="mr-[4px] text-[1.4em]">
{!isMore.value ? hookT('expand') : hookT('collapse')}
{content || hookT('moreConfig')}
</span>

View File

@@ -92,7 +92,6 @@ export default function useTable<T = Record<string, any>, Z extends Record<strin
const component = (props: DataTableProps, context: { slots?: DataTableSlots }) => {
const { slots, ...attrs } = props as any
const s2 = context
console.log(slots, s2)
return (
<NDataTable
remote

View File

@@ -1,5 +1,5 @@
import { computed, ref, effectScope, onScopeDispose, watch } from 'vue'
import { useDark, useLocalStorage } from '@vueuse/core'
import { useLocalStorage } from '@vueuse/core'
import { darkTheme, lightTheme, useThemeVars } from 'naive-ui'
import themes from './model'
@@ -131,16 +131,12 @@ export const useTheme = (name?: ThemeName) => {
// 加载主题样式
const themeConfig = await themeItem.import()
const themeStyles = await themeItem.styleContent() // 获取主题样式内容
// 加载新样式
if (themeStyles || themeStyles) {
loadDynamicCss(themeStyles as string, 'theme-style')
}
// 更新激活的主题
themeActiveOverrides.value = themeConfig
console.log('themeActiveOverrides', themeActiveOverrides.value)
console.log('themeOverrides', themeOverrides.value)
} catch (error) {
console.error(`加载主题失败 ${themeName}:`, error)
}

View File

@@ -15,7 +15,7 @@ const defaultLight: ThemeTemplate = {
title: '默认亮色主题', // 主题名称
themeOverrides: {
common: {
// borderRadius: '0.6rem', // 圆角
borderRadius: '0.6rem', // 圆角
// primaryColor: '#4caf50', // 主色
// primaryColorHover: '#20a53a', // 主色悬停
// primaryColorPressed: '#157f3a', // 主色按下
@@ -32,6 +32,7 @@ const defaultDark: ThemeTemplate = {
title: '默认暗色主题',
themeOverrides: {
common: {
borderRadius: '0.6rem', // 圆角
// baseColor: '#F1F1F1', // 基础色
// primaryColor: '#4caf50', // 主色
// primaryColorHover: '#20a53a', // 主色悬停

View File

@@ -28,7 +28,7 @@ import type {
FormProps,
GridItemProps,
} from 'naive-ui'
import type { Ref, ShallowRef } from 'vue'
import type { Ref, ShallowRef, ComputedRef, ToRefs } from 'vue'
/** 选项接口 */
export interface RadioOptionItem extends Partial<RadioProps> {
@@ -153,9 +153,7 @@ export interface FormItemConfig extends Partial<FormItemProps> {
// }
/** 表单配置类型 */
export type FormBaseConfig = (FormItemConfig | GridItemConfig | FormItemCustomConfig)[]
/** 表单配置类型-动态表单 */
export type FormBaseConfig = (FormItemConfi| GridItemConfig | FormItemCustomConfig)[]/** 表单配置类型-动态表单 */
export type FormConfig = Ref<FormBaseConfig> | ComputedRef<FormBaseConfig> | FormBaseConfig
/** 表单 Hook 配置项接口 */