【新增】插件git同步模块,用于同步项目内容,加速项目开发

【调整】前端暗色问题
This commit is contained in:
chudong
2025-05-14 16:50:56 +08:00
parent dc43da936b
commit e6947ec5c4
215 changed files with 19918 additions and 9710 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -74,6 +74,7 @@ export default function useSocket(url: string, options?: SocketOptions) {
// 连接成功的回调
socket.value.onopen = () => {
console.log(4123432)
connected.value = true
reconnectAttempts = 0 // 重置重连计数
// 如果配置了心跳包,启动心跳定时器

Binary file not shown.

View File

@@ -555,8 +555,10 @@ const useFormGroup = <T extends Record<string, any>>(group: Record<string, any>[
{children.map((child: BaseFormElement | RenderFormElement | SlotFormElement) => {
if (child.type === 'render' || child.type === 'custom')
return (child as RenderFormElement).render(formData, formRef)
let type = child.type
if (['textarea', 'password'].includes(child.type)) type = 'input'
// 获取对应的 Naive UI 组件
const Component = componentMap[child.type as keyof typeof componentMap]
const Component = componentMap[type as keyof typeof componentMap]
if (!Component) return null
// 解构出组件属性,分离类型和字段名
const { field, ...componentProps } = child as BaseFormElement
@@ -769,8 +771,8 @@ const useFormHelp = (
type: 'custom',
render: () => (
<ul
class={`text-[#777] mt-[2px] leading-[2rem] text-[12px] ml-[20px] list-${other?.listStyle || 'disc'}`}
style="color: var(--n-close-icon-color);"
class={`mt-[2px] leading-[2rem] text-[1.4rem] list-${other?.listStyle || 'disc'}`}
style="color: var(--n-close-icon-color);margin-left: 1.6rem; line-height:2.2rem;"
{...other}
>
{helpList.value.map(

View File

@@ -38,18 +38,48 @@ export function useMessage(): MessageApiExtended {
}))
// 创建discreteMessage实例
const { message } = createDiscreteApi(['message'], { configProviderProps })
const { message, unmount } = createDiscreteApi(['message'], { configProviderProps })
return {
// 创建包装函数添加unmount到onAfterLeave
const wrapMethod =
(method: any) =>
(content: string, options: MessageOptions = {}) => {
const newOptions = {
...options,
onAfterLeave: () => {
options.onAfterLeave?.()
unmount()
},
}
return method(content, newOptions)
}
// 包装所有消息方法
const wrappedMessage = {
...message,
request: (data: { status: boolean; message: string }, options?: MessageOptions) => {
info: wrapMethod(message.info),
success: wrapMethod(message.success),
warning: wrapMethod(message.warning),
error: wrapMethod(message.error),
loading: wrapMethod(message.loading),
request: (data: { status: boolean; message: string }, options: MessageOptions = {}) => {
const newOptions = {
...options,
onAfterLeave: () => {
options.onAfterLeave?.()
unmount()
},
}
if (data.status) {
return message.success(data.message, options)
return wrapMethod(message.success)(data.message, newOptions)
} else {
return message.error(data.message, options)
return wrapMethod(message.error)(data.message, newOptions)
}
},
}
} as MessageApiExtended
return wrappedMessage
}
export default useMessage

View File

@@ -10,6 +10,7 @@ import {
App,
Ref,
computed,
ComputedRef,
} from 'vue'
import {
useModal as useNaiveModal,
@@ -19,7 +20,7 @@ import {
NButton,
ModalOptions,
} from 'naive-ui'
import { isBoolean, isFunction } from '@baota/utils/type'
import { isBoolean } from '@baota/utils/type'
import { useTheme } from '../theme'
import { translation } from '../locals/translation'
@@ -43,8 +44,8 @@ export interface CustomModalOptions {
draggable?: boolean // 是否可拖拽
closable?: boolean // 是否显示关闭按钮
footer?: boolean | (() => VNodeChild) // 是否显示底部按钮
confirmText?: string // 确认按钮文本
cancelText?: string // 取消按钮文本
confirmText?: string | Ref<string> | ComputedRef<string> // 确认按钮文本
cancelText?: string | Ref<string> | ComputedRef<string> // 取消按钮文本
modalStyle?: Record<string, any> // 弹窗样式
confirmButtonProps?: ButtonProps // 确认按钮props
cancelButtonProps?: ButtonProps // 取消按钮props
@@ -184,7 +185,7 @@ const useModal = (options: CustomModalOptions) => {
cancelHandler.value?.()
// 调用外部传入的取消回调
onCancel?.(() => {})
// unmount() // 卸载
unmount() // 卸载
return true
},
content: () => {

View File

@@ -92,6 +92,7 @@ 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
@@ -239,15 +240,17 @@ const useTablePage = <T extends Record<string, any> = Record<string, any>>({
const useTableOperation = (
options: {
title: string
width?: number
onClick: (row: any) => void
isHide?: boolean | ((row: any) => boolean)
}[],
others?: any,
) => {
const width = options.reduce((accumulator, option) => accumulator + (option.width || 40), 0) + 20
return {
title: hookT('operation'),
key: 'CreatedAt',
width: 180,
width,
fixed: 'right' as const,
align: 'right' as const,
render: (row: any) => {

View File

@@ -39,7 +39,11 @@ export const useTheme = (name?: ThemeName) => {
const themeActiveOverrides = ref<ThemeTemplate | null>(null)
// 是否暗黑
const isDark = useDark()
// const isDark = useDark()
// 禁用自动切换暗色模式避免错误
const isDark = ref(false)
// 主题
const theme = computed(() => {

View File

@@ -16,6 +16,10 @@ const defaultLight: ThemeTemplate = {
themeOverrides: {
common: {
borderRadius: '0.6rem', // 圆角
primaryColor: '#4caf50', // 主色
primaryColorHover: '#20a53a', // 主色悬停
primaryColorPressed: '#157f3a', // 主色按下
primaryColorSuppl: '#4caf50', // 主色补充
},
}, // 主题变量
presetsOverrides: presets, // 预设变量