fix: 添加页面,统一修改样式。
This commit is contained in:
@@ -98,6 +98,32 @@ const form = reactive({
|
||||
status: '0'
|
||||
})
|
||||
|
||||
// 表单验证错误字段
|
||||
const errorFields = ref([])
|
||||
|
||||
// 输入框基础样式
|
||||
const inputBaseStyle = {
|
||||
background: '#ffffff',
|
||||
border: '2rpx solid #dcdfe6',
|
||||
borderRadius: '8rpx',
|
||||
padding: '0 24rpx',
|
||||
height: '68rpx'
|
||||
}
|
||||
|
||||
// 输入框错误样式
|
||||
const inputErrorStyle = {
|
||||
background: '#fef0f0',
|
||||
border: '2rpx solid #f56c6c',
|
||||
borderRadius: '8rpx',
|
||||
padding: '0 24rpx',
|
||||
height: '68rpx'
|
||||
}
|
||||
|
||||
// 根据字段名获取输入框样式
|
||||
const getInputStyle = (field) => {
|
||||
return errorFields.value.includes(field) ? inputErrorStyle : inputBaseStyle
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
console.log('页面加载参数:', options)
|
||||
if (options.id) {
|
||||
@@ -327,17 +353,21 @@ async function submitForm() {
|
||||
}
|
||||
|
||||
function doSubmit() {
|
||||
errorFields.value = [] // 清空错误字段
|
||||
console.log('准备提交的表单数据:', form)
|
||||
|
||||
if (!form.noticeTitle) {
|
||||
errorFields.value.push('noticeTitle')
|
||||
modal.msgError('请输入公告标题')
|
||||
return
|
||||
}
|
||||
if (!form.noticeType) {
|
||||
errorFields.value.push('noticeType')
|
||||
modal.msgError('请选择公告类型')
|
||||
return
|
||||
}
|
||||
if (!form.noticeContent || form.noticeContent.trim() === '') {
|
||||
errorFields.value.push('noticeContent')
|
||||
modal.msgError('请输入公告内容')
|
||||
return
|
||||
}
|
||||
@@ -433,6 +463,20 @@ function doSubmit() {
|
||||
}
|
||||
}
|
||||
|
||||
.select-input-wrapper {
|
||||
position: relative;
|
||||
|
||||
.select-arrow {
|
||||
position: absolute;
|
||||
right: 24rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: #c0c4cc;
|
||||
font-size: 28rpx;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.editor-container {
|
||||
width: 100%;
|
||||
border: 2rpx solid #e8edf3;
|
||||
|
||||
Reference in New Issue
Block a user