修复bug

This commit is contained in:
zhouyanli
2026-08-07 18:05:16 +08:00
parent 3851aebe66
commit 92dd39cf4b
7 changed files with 128 additions and 16 deletions

View File

@@ -83,6 +83,7 @@
const id = ref(undefined)
const type = ref('')
const isSubmitting = ref(false)
const formData = ref({
// carNum: uni.getStorageSync('carNum'),
// carBrand: uni.getStorageSync('carBrand'),
@@ -202,14 +203,25 @@
}
}
// 车牌号正则:省份简称 + 城市代码字母 + 5位(蓝牌)或6位(新能源绿牌)字母数字
const CAR_NUM_REGEX = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤川青藏琼宁][A-Z][A-Z0-9]{5,6}$/
const saveCar = async () => {
if (isSubmitting.value) return
if (!formData.value.carNum) {
return uni.showToast({
title: "请输入车牌号",
icon: "none"
})
}
if (!CAR_NUM_REGEX.test(formData.value.carNum)) {
return uni.showToast({
title: "请输入正确的车牌号",
icon: "none"
})
}
isSubmitting.value = true
uni.showLoading({
title: '提交中...',
mask: true
@@ -232,6 +244,7 @@
submitCarData(carImageUrl)
} catch (err) {
isSubmitting.value = false
uni.hideLoading()
uni.showToast({
title: err.msg || '网络异常',
@@ -260,6 +273,7 @@
params.id = id.value
putCar(params).then(res => {
console.log(res);
isSubmitting.value = false
uni.hideLoading()
if (res.code === 200) {
uni.showToast({
@@ -274,9 +288,10 @@
uni.removeStorageSync("carImageUrl")
uni.removeStorageSync("carBrandId")
uni.removeStorageSync("checkType")
uni.redirectTo({ url: "/pageSubPack/my/myCarIndex" })
uni.navigateBack()
}, 1500)
} else {
isSubmitting.value = false
uni.showToast({
title: res.msg || '提交失败',
icon: 'none'
@@ -285,6 +300,7 @@
})
}else{
postCar(params).then(res => {
isSubmitting.value = false
uni.hideLoading()
if (res.code === 200) {
uni.showToast({
@@ -299,9 +315,10 @@
uni.removeStorageSync("carImageUrl")
uni.removeStorageSync("carBrandId")
uni.removeStorageSync("checkType")
uni.redirectTo({ url: "/pageSubPack/my/myCarIndex" })
uni.navigateBack()
}, 1500)
} else {
isSubmitting.value = false
uni.showToast({
title: res.msg || '提交失败',
icon: 'none'
@@ -467,4 +484,4 @@
color: #999 !important;
font-size: 28rpx !important;
}
</style>
</style>