重命名前端目录

This commit is contained in:
yml2213
2026-07-07 19:55:18 +08:00
parent 8268a3b906
commit dbcb5a4979
182 changed files with 7019 additions and 7017 deletions
+62 -43
View File
@@ -1,64 +1,83 @@
import { ElMessage, ElMessageBox } from 'element-plus'
import type { ElMessageBoxOptions, MessageOptions } from 'element-plus'
import { Input, Modal, message as antdMessage } from 'antd'
import type { ModalFuncProps } from 'antd'
import { createElement } from 'react'
import 'element-plus/theme-chalk/el-message.css'
import 'element-plus/theme-chalk/el-overlay.css'
import 'element-plus/theme-chalk/el-message-box.css'
const baseMessageOptions: Partial<MessageOptions> = {
grouping: true,
type MessageOptions = {
duration?: number
}
const baseConfirmOptions: ElMessageBoxOptions = {
type: 'warning',
confirmButtonText: '继续执行',
cancelButtonText: '取消',
closeOnClickModal: false,
closeOnPressEscape: false,
autofocus: false,
distinguishCancelAndClose: true,
type PromptResult = {
value: string
}
const basePromptOptions: ElMessageBoxOptions = {
confirmButtonText: '提交',
cancelButtonText: '取消',
closeOnClickModal: false,
closeOnPressEscape: false,
autofocus: false,
distinguishCancelAndClose: true,
}
export function showSuccess(message: string, options: Partial<MessageOptions> = {}) {
return ElMessage.success({
...baseMessageOptions,
...options,
message,
export function showSuccess(message: string, options: MessageOptions = {}) {
return antdMessage.success({
content: message,
duration: options.duration,
})
}
export function showError(message: string, options: Partial<MessageOptions> = {}) {
return ElMessage.error({
...baseMessageOptions,
...options,
message,
export function showError(message: string, options: MessageOptions = {}) {
return antdMessage.error({
content: message,
duration: options.duration,
})
}
export function showConfirm(
message: string,
title = '确认操作',
options: ElMessageBoxOptions = {},
options: ModalFuncProps = {},
) {
return ElMessageBox.confirm(message, title, {
...baseConfirmOptions,
...options,
return new Promise<void>((resolve, reject) => {
Modal.confirm({
title,
content: message,
okText: '继续执行',
cancelText: '取消',
centered: true,
...options,
onOk: () => {
options.onOk?.()
resolve()
},
onCancel: () => {
options.onCancel?.()
reject('cancel')
},
})
})
}
export function showPrompt(message: string, title: string, options: ElMessageBoxOptions = {}) {
return ElMessageBox.prompt(message, title, {
...basePromptOptions,
...options,
export function showPrompt(message: string, title: string, options: ModalFuncProps = {}) {
let value = ''
return new Promise<PromptResult>((resolve, reject) => {
Modal.confirm({
title,
content: createElement('div', { className: 'feedback-prompt' }, [
createElement('p', { key: 'message' }, message),
createElement(Input, {
key: 'input',
autoFocus: true,
onChange: (event) => {
value = event.target.value
},
}),
]),
okText: '提交',
cancelText: '取消',
centered: true,
...options,
onOk: () => {
options.onOk?.()
resolve({ value })
},
onCancel: () => {
options.onCancel?.()
reject('cancel')
},
})
})
}