fix: 功能bug修复,完善。

This commit is contained in:
tianyongbao
2026-02-07 23:24:13 +08:00
parent f2d6171e61
commit cd5b0f6765
10 changed files with 278 additions and 329 deletions

View File

@@ -25,12 +25,9 @@
<u-number-box v-model="form.postSort" :min="0" :max="999" inputAlign="right"></u-number-box>
</u-form-item>
<u-form-item label="状态" prop="statusName" @click="showStatusPicker = true">
<view class="select-input-wrapper">
<u-form-item label="状态" prop="statusName" @click="showStatusPicker = true" class="with-arrow">
<u--input v-model="statusName" disabled disabledColor="#ffffff" placeholder="请选择状态"
inputAlign="left" :customStyle="inputBaseStyle"></u--input>
<u-icon name="arrow-down" class="select-arrow"></u-icon>
</view>
</u-form-item>
<u-form-item label="备注" prop="remark" labelPosition="top">
@@ -43,7 +40,6 @@
</view>
</view>
</view>
<u-toast ref="uToast"></u-toast>
<u-picker itemHeight="88" :show="showStatusPicker" :columns="statusList" keyName="dictLabel" @cancel="showStatusPicker = false"
@confirm="handleStatusConfirm"></u-picker>
</view>
@@ -79,7 +75,9 @@ const inputBaseStyle = {
border: '2rpx solid #dcdfe6',
borderRadius: '8rpx',
padding: '0 24rpx',
height: '68rpx'
height: '68rpx',
width: '100%',
boxSizing: 'border-box'
}
// 输入框错误样式
@@ -88,7 +86,9 @@ const inputErrorStyle = {
border: '2rpx solid #f56c6c',
borderRadius: '8rpx',
padding: '0 24rpx',
height: '68rpx'
height: '68rpx',
width: '100%',
boxSizing: 'border-box'
}
// 根据字段名获取输入框样式
@@ -147,22 +147,19 @@ function handleStatusConfirm(e) {
function submit() {
errorFields.value = [] // 清空错误字段
proxy.$refs['uForm'].validate().then(() => {
console.log('提交的表单数据:', form)
if (form.postId) {
updatePost(form).then(() => {
proxy.$refs['uToast'].show({
message: '修改成功', complete() {
uni.navigateTo({ url: `/pages_mine/pages/system/post/list` })
}
})
proxy.$modal.msgSuccess('修改成功')
setTimeout(() => {
uni.navigateTo({ url: `/pages_mine/pages/system/post/list` })
}, 1500)
})
} else {
addPost(form).then(() => {
proxy.$refs['uToast'].show({
message: '新增成功', complete() {
uni.navigateTo({ url: `/pages_mine/pages/system/post/list` })
}
})
proxy.$modal.msgSuccess('新增成功')
setTimeout(() => {
uni.navigateTo({ url: `/pages_mine/pages/system/post/list` })
}, 1500)
})
}
}).catch((errors) => {
@@ -170,10 +167,7 @@ function submit() {
if (errors && Array.isArray(errors)) {
errorFields.value = errors.map(err => err.field || err.prop)
}
proxy.$refs['uToast'].show({
type: 'error',
message: '请填写完整信息'
})
proxy.$modal.msgError('请填写完整信息')
})
}
</script>
@@ -215,20 +209,6 @@ function submit() {
}
}
}
.select-input-wrapper {
position: relative;
.select-arrow {
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
color: #c0c4cc;
font-size: 28rpx;
pointer-events: none;
}
}
</style>
<style lang="scss">