修复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) => {

View File

@@ -145,6 +145,18 @@
} else if (uni.getStorageSync('operationType') == 'add') {
id.value = undefined
type.value = '添加'
// 添加模式下清空上次残留的缓存,保证每次进入都是干净的
uni.removeStorageSync('communityName')
uni.removeStorageSync('communityId')
uni.removeStorageSync('parkingLotName')
uni.removeStorageSync('parkingLotId')
uni.removeStorageSync('parkingSpaceName')
uni.removeStorageSync('parkingSpaceId')
uni.removeStorageSync('parkingStatus')
uni.removeStorageSync('bindCarName')
uni.removeStorageSync('bindCarId')
uni.removeStorageSync('ownerName')
uni.removeStorageSync('ownerId')
}
})

View File

@@ -64,6 +64,7 @@
const statusBarHeight = ref(20)
const currentStatus = ref('')
const isDeleting = ref(false)
const isUpdating = ref(false)
const id = ref(undefined)
const form = ref({
plateNo: '',
@@ -72,6 +73,7 @@
color: '',
carImg: ''
})
let isFirstLoad = true
onLoad((options) => {
console.log(options);
id.value = options.id
@@ -80,7 +82,17 @@
})
onShow(() => {
// 首次加载由 onLoad 处理,仅从编辑页返回时刷新
if (isFirstLoad) {
isFirstLoad = false
return
}
isUpdating.value = false
if (id.value) {
loadCarDetail()
}
})
const loadCarDetail = async () => {
// 防重复请求
@@ -104,6 +116,8 @@
}
}
const clickUpdate = () => {
if (isUpdating.value) return
isUpdating.value = true
uni.setStorageSync('operationType', 'update')
uni.navigateTo({
url: '/pageSubPack/my/addCar?id=' + id.value
@@ -112,12 +126,12 @@
const onDelete = () => {
if (isDeleting.value) return
isDeleting.value = true
uni.showModal({
title: "确认删除",
content: "确认删除此车辆信息吗?",
success: (res) => {
if (res.confirm) {
isDeleting.value = true
uni.showLoading({
title: '删除中...',
mask: true
@@ -125,7 +139,6 @@
deleteCar({
carId: id.value
}).then(deleteRes => {
isDeleting.value = false
uni.hideLoading()
if (deleteRes.code === 200) {
uni.showToast({
@@ -136,12 +149,22 @@
uni.navigateBack()
}, 1500)
} else {
isDeleting.value = false
uni.showToast({
title: deleteRes.msg || '删除失败',
icon: 'none'
})
}
}).catch(() => {
isDeleting.value = false
uni.hideLoading()
uni.showToast({
title: '删除失败',
icon: 'none'
})
})
} else {
isDeleting.value = false
}
}
})

View File

@@ -131,13 +131,7 @@
});
} else if (sourcePage.value == 'addParkingSpace') {
uni.setStorageSync('checkType', '停车场')
uni.navigateTo({
// url: '/pageSubPack/my/bindHouse',
url: '/pageSubPack/my/selectParingLot',
success: res => {},
fail: () => {},
complete: () => {}
});
uni.navigateBack()
} else {
}

View File

@@ -46,7 +46,10 @@
<text class="label-text">问题描述</text>
</view>
<view class="row-right desc-right">
<textarea v-model="description" placeholder="请描述您的问题" class="desc-input" auto-height maxlength="500"></textarea>
<view class="desc-input-wrap">
<textarea v-model="description" placeholder="请描述您的问题" class="desc-input" auto-height maxlength="200"></textarea>
<text class="desc-count">{{ description.length }}/200</text>
</view>
</view>
</view>
@@ -56,7 +59,7 @@
<text class="label-text">投诉人姓名</text>
</view>
<view class="row-right">
<input v-model="name" placeholder="请输入姓名" class="text-input" type="text" />
<input v-model="name" placeholder="请输入姓名" class="text-input" type="text" maxlength="20" />
</view>
</view>
@@ -97,7 +100,7 @@
<!-- 底部下一步按钮 -->
<view class="bottom-btn-wrap">
<button class="next-btn" @click="submitForm">提交</button>
<button class="next-btn" :disabled="isSubmitting" @click="submitForm">提交</button>
</view>
<!-- ================== 自定义Popup弹窗纯view实现 ================== -->
@@ -161,7 +164,9 @@ const villageId = ref('')
const tempFilePaths = ref([])
const maxCount = ref(9)
// 关闭所有弹窗
const isSubmitting = ref(false)
// 关闭所有弹窗
const closeAllPopup = () => {
showTypePopup.value = false
showPropertyPopup.value = false
@@ -238,12 +243,14 @@ const submitForm = async () => {
if (!selectedTypeId.value) {
return uni.showToast({ title: '请选择投诉类型', icon: 'none' })
}
if (selectedType.value === '物业服务' && !selectedProperty.value) {
return uni.showToast({ title: '请选择物业', icon: 'none' })
}
// if (selectedType.value === '物业服务' && !selectedProperty.value) {
// return uni.showToast({ title: '请选择物业', icon: 'none' })
// }
if (!description.value.trim()) {
return uni.showToast({ title: '请输入问题描述', icon: 'none' })
}
if (isSubmitting.value) return
isSubmitting.value = true
uni.showLoading({ title: '提交中...', mask: true })
@@ -272,14 +279,14 @@ const submitForm = async () => {
if (res.code === 200) {
uni.showToast({ title: '提交成功', icon: 'success' })
setTimeout(() => {
uni.navigateTo({
url: '/pageSubPack/service-list/complaintsSuggestionsIndex'
})
uni.navigateBack()
}, 1500)
} else {
isSubmitting.value = false
uni.showToast({ title: res.msg || '提交失败', icon: 'none' })
}
} catch (err) {
isSubmitting.value = false
uni.hideLoading()
uni.showToast({
title: err.msg || '提交失败,请重试',
@@ -391,20 +398,35 @@ const submitForm = async () => {
.desc-right {
flex: 1;
width: 100%;
}
.desc-input-wrap {
width: 100%;
margin-top: 20rpx;
border: 1rpx solid #f0f0f0;
border-radius: 8rpx;
padding: 24rpx;
box-sizing: border-box;
}
.desc-input {
width: calc(100vw - 84rpx);
width: 100%;
min-height: 80px;
margin-top: 20rpx;
padding: 24rpx;
border: 1rpx solid #f0f0f0;
border-radius: 8rpx;
font-size: 30rpx;
color: #333;
line-height: 1.5;
box-sizing: border-box;
background: transparent;
border: none;
outline: none;
}
.desc-count {
display: block;
text-align: right;
font-size: 24rpx;
color: #999;
margin-top: 8rpx;
}
/* 照片上传区域 */

View File

@@ -53,7 +53,7 @@
<script setup>
import { ref, onMounted } from 'vue'
import {onLoad} from '@dcloudio/uni-app'
import {onLoad, onShow} from '@dcloudio/uni-app'
import {getComplainList} from '../api/apiSub.js'
// 分段器
@@ -116,6 +116,9 @@ const getComplainListData = async () =>{
onLoad(() =>{
getComplainListData()
})
onShow(() => {
getComplainListData()
})
// 跳转到详情
const turnToDetail = (item) => {

View File

@@ -46,7 +46,7 @@ export default {
},
customIcons: {}, // 自定义图标与unicode对应关系
// 默认单位可以通过配置为rpx那么在用于传入组件大小参数为数值时就默认为rpx
unit: 'px',
unit: 'rpx',
// 拦截器
interceptor: {
navbarLeftClick: null