修复bug

This commit is contained in:
zhouyanli
2026-08-10 14:15:59 +08:00
parent 92dd39cf4b
commit 5f8f5fc73d
7 changed files with 103 additions and 42 deletions

View File

@@ -50,7 +50,7 @@
</view>
</scroll-view>
<view class="bottom-btn-wrap">
<button class="next-btn" @click="saveCar">保存</button>
<button class="next-btn" :disabled="isSubmitting" @click="saveCar">保存</button>
</view>
</view>
</template>
@@ -85,12 +85,6 @@
const type = ref('')
const isSubmitting = ref(false)
const formData = ref({
// carNum: uni.getStorageSync('carNum'),
// carBrand: uni.getStorageSync('carBrand'),
// carModel: uni.getStorageSync('carModel'),
// carColor: uni.getStorageSync('carColor'),
// carImageUrl: uni.getStorageSync('carImageUrl'),
// carBrandId: uni.getStorageSync('carBrandId')
carNum: '',
carBrand: '',
carModel: '',
@@ -253,6 +247,7 @@
}
}
const submitCarData = (carImageUrl) => {
// 处理 carImageUrl 可能是对象 { url: string } 的情况
const imageUrl = typeof carImageUrl === 'object' ? carImageUrl.url : carImageUrl
@@ -273,7 +268,6 @@
params.id = id.value
putCar(params).then(res => {
console.log(res);
isSubmitting.value = false
uni.hideLoading()
if (res.code === 200) {
uni.showToast({
@@ -291,16 +285,22 @@
uni.navigateBack()
}, 1500)
} else {
isSubmitting.value = false
isSubmitting.value = false
uni.showToast({
title: res.msg || '提交失败',
icon: 'none'
})
}
})
}else{
postCar(params).then(res => {
}).catch((err) => {
isSubmitting.value = false
uni.hideLoading()
uni.showToast({
title: err.msg || '提交失败',
icon: 'none'
})
})
} else {
postCar(params).then(res => {
uni.hideLoading()
if (res.code === 200) {
uni.showToast({
@@ -318,16 +318,23 @@
uni.navigateBack()
}, 1500)
} else {
isSubmitting.value = false
isSubmitting.value = false
uni.showToast({
title: res.msg || '提交失败',
icon: 'none'
})
}
}).catch((err) => {
isSubmitting.value = false
uni.hideLoading()
uni.showToast({
title: err.msg || '提交失败',
icon: 'none'
})
})
}
}
const selectItem = (typeStr) => {