second commit

This commit is contained in:
2025-12-25 18:33:15 +08:00
parent 78407f1cbd
commit 6a6ddba71a
34 changed files with 527 additions and 1226 deletions

View File

@@ -191,6 +191,71 @@ export function dragEvent(e, className, moving, moveEnd) {
}
}
}
export function resizeEvent(e, className, resizing, resizeEnd) {
if (e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'svg' || e.target.nodeName === 'path') {
return
}
if (className && !e.target.className.includes(className)) {
return
}
const dialogElement = e.target.closest('.el-dialog') || e.target // 获取对话框元素
if (!dialogElement) {
return
}
const startX = e.clientX
const startY = e.clientY
const startWidth = parseInt(document.defaultView.getComputedStyle(dialogElement).width, 10)
const startHeight = parseInt(document.defaultView.getComputedStyle(dialogElement).height, 10)
// 防止文本在拖拽过程中被选中
document.body.style.userSelect = 'none'
document.onmousemove = (e) => {
const newWidth = startWidth + (e.clientX - startX)
const newHeight = startHeight + (e.clientY - startY)
// 设置最小宽度和高度限制
const minWidth = 200
const minHeight = 150
const width = Math.max(newWidth, minWidth)
const height = Math.max(newHeight, minHeight)
dialogElement.style.width = `${width}px`
dialogElement.style.height = `${height}px`
// 同时调整 el-dialog__body 的尺寸
const dialogBody = dialogElement.querySelector('.el-dialog__body')
if (dialogBody) {
// 计算头部和底部的高度(通常为固定值)
const dialogHeader = dialogElement.querySelector('.el-dialog__header')
const dialogFooter = dialogElement.querySelector('.el-dialog__footer')
let headerHeight = dialogHeader ? dialogHeader.offsetHeight : 56 // 默认头部高度
let footerHeight = dialogFooter ? dialogFooter.offsetHeight : 0 // 默认底部高度
const bodyHeight = height - headerHeight - footerHeight - 20 // 20px 为上下边距
dialogBody.style.height = `${bodyHeight}px`
dialogBody.style.width = 'calc(100% - 20px)' // 减去左右边距
}
if (resizing) {
resizing({ width, height })
}
}
document.onmouseup = (e) => {
// 恢复文本选择功能
document.body.style.userSelect = ''
document.onmousemove = null
document.onmouseup = null
if (resizeEnd) {
resizeEnd()
}
}
}
/**
* @param value 将十进制转为度分秒
* @returns { degrees: number, minutes: number, seconds: number } degrees:度 minutes:分 seconds:秒

View File

@@ -21,7 +21,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: import.meta.env.VITE_APP_BASE_URL,
// 超时
timeout: 10000
timeout: 20000
})
// request拦截器
@@ -102,7 +102,7 @@ service.interceptors.response.use(res => {
} else if (code === 601) {
ElMessage({ message: msg, type: 'warning' })
return Promise.reject(new Error(msg))
} else if (code !== 200) {
} else if (code != 200) {
ElNotification.error({ title: msg })
return Promise.reject('error')
}