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

View File

@@ -145,6 +145,18 @@
} else if (uni.getStorageSync('operationType') == 'add') { } else if (uni.getStorageSync('operationType') == 'add') {
id.value = undefined id.value = undefined
type.value = '添加' 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 statusBarHeight = ref(20)
const currentStatus = ref('') const currentStatus = ref('')
const isDeleting = ref(false) const isDeleting = ref(false)
const isUpdating = ref(false)
const id = ref(undefined) const id = ref(undefined)
const form = ref({ const form = ref({
plateNo: '', plateNo: '',
@@ -72,6 +73,7 @@
color: '', color: '',
carImg: '' carImg: ''
}) })
let isFirstLoad = true
onLoad((options) => { onLoad((options) => {
console.log(options); console.log(options);
id.value = options.id 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 () => { const loadCarDetail = async () => {
// 防重复请求 // 防重复请求
@@ -104,6 +116,8 @@
} }
} }
const clickUpdate = () => { const clickUpdate = () => {
if (isUpdating.value) return
isUpdating.value = true
uni.setStorageSync('operationType', 'update') uni.setStorageSync('operationType', 'update')
uni.navigateTo({ uni.navigateTo({
url: '/pageSubPack/my/addCar?id=' + id.value url: '/pageSubPack/my/addCar?id=' + id.value
@@ -112,12 +126,12 @@
const onDelete = () => { const onDelete = () => {
if (isDeleting.value) return if (isDeleting.value) return
isDeleting.value = true
uni.showModal({ uni.showModal({
title: "确认删除", title: "确认删除",
content: "确认删除此车辆信息吗?", content: "确认删除此车辆信息吗?",
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
isDeleting.value = true
uni.showLoading({ uni.showLoading({
title: '删除中...', title: '删除中...',
mask: true mask: true
@@ -125,7 +139,6 @@
deleteCar({ deleteCar({
carId: id.value carId: id.value
}).then(deleteRes => { }).then(deleteRes => {
isDeleting.value = false
uni.hideLoading() uni.hideLoading()
if (deleteRes.code === 200) { if (deleteRes.code === 200) {
uni.showToast({ uni.showToast({
@@ -136,12 +149,22 @@
uni.navigateBack() uni.navigateBack()
}, 1500) }, 1500)
} else { } else {
isDeleting.value = false
uni.showToast({ uni.showToast({
title: deleteRes.msg || '删除失败', title: deleteRes.msg || '删除失败',
icon: 'none' 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') { } else if (sourcePage.value == 'addParkingSpace') {
uni.setStorageSync('checkType', '停车场') uni.setStorageSync('checkType', '停车场')
uni.navigateTo({ uni.navigateBack()
// url: '/pageSubPack/my/bindHouse',
url: '/pageSubPack/my/selectParingLot',
success: res => {},
fail: () => {},
complete: () => {}
});
} else { } else {
} }

View File

@@ -46,7 +46,10 @@
<text class="label-text">问题描述</text> <text class="label-text">问题描述</text>
</view> </view>
<view class="row-right desc-right"> <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>
</view> </view>
@@ -56,7 +59,7 @@
<text class="label-text">投诉人姓名</text> <text class="label-text">投诉人姓名</text>
</view> </view>
<view class="row-right"> <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>
</view> </view>
@@ -97,7 +100,7 @@
<!-- 底部下一步按钮 --> <!-- 底部下一步按钮 -->
<view class="bottom-btn-wrap"> <view class="bottom-btn-wrap">
<button class="next-btn" @click="submitForm">提交</button> <button class="next-btn" :disabled="isSubmitting" @click="submitForm">提交</button>
</view> </view>
<!-- ================== 自定义Popup弹窗纯view实现 ================== --> <!-- ================== 自定义Popup弹窗纯view实现 ================== -->
@@ -161,7 +164,9 @@ const villageId = ref('')
const tempFilePaths = ref([]) const tempFilePaths = ref([])
const maxCount = ref(9) const maxCount = ref(9)
// 关闭所有弹窗 const isSubmitting = ref(false)
// 关闭所有弹窗
const closeAllPopup = () => { const closeAllPopup = () => {
showTypePopup.value = false showTypePopup.value = false
showPropertyPopup.value = false showPropertyPopup.value = false
@@ -238,12 +243,14 @@ const submitForm = async () => {
if (!selectedTypeId.value) { if (!selectedTypeId.value) {
return uni.showToast({ title: '请选择投诉类型', icon: 'none' }) return uni.showToast({ title: '请选择投诉类型', icon: 'none' })
} }
if (selectedType.value === '物业服务' && !selectedProperty.value) { // if (selectedType.value === '物业服务' && !selectedProperty.value) {
return uni.showToast({ title: '请选择物业', icon: 'none' }) // return uni.showToast({ title: '请选择物业', icon: 'none' })
} // }
if (!description.value.trim()) { if (!description.value.trim()) {
return uni.showToast({ title: '请输入问题描述', icon: 'none' }) return uni.showToast({ title: '请输入问题描述', icon: 'none' })
} }
if (isSubmitting.value) return
isSubmitting.value = true
uni.showLoading({ title: '提交中...', mask: true }) uni.showLoading({ title: '提交中...', mask: true })
@@ -272,14 +279,14 @@ const submitForm = async () => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ title: '提交成功', icon: 'success' }) uni.showToast({ title: '提交成功', icon: 'success' })
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateBack()
url: '/pageSubPack/service-list/complaintsSuggestionsIndex'
})
}, 1500) }, 1500)
} else { } else {
isSubmitting.value = false
uni.showToast({ title: res.msg || '提交失败', icon: 'none' }) uni.showToast({ title: res.msg || '提交失败', icon: 'none' })
} }
} catch (err) { } catch (err) {
isSubmitting.value = false
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: err.msg || '提交失败,请重试', title: err.msg || '提交失败,请重试',
@@ -391,20 +398,35 @@ const submitForm = async () => {
.desc-right { .desc-right {
flex: 1; 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 { .desc-input {
width: calc(100vw - 84rpx); width: 100%;
min-height: 80px; min-height: 80px;
margin-top: 20rpx;
padding: 24rpx;
border: 1rpx solid #f0f0f0;
border-radius: 8rpx;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
line-height: 1.5; line-height: 1.5;
box-sizing: border-box;
background: transparent; 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> <script setup>
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import {onLoad} from '@dcloudio/uni-app' import {onLoad, onShow} from '@dcloudio/uni-app'
import {getComplainList} from '../api/apiSub.js' import {getComplainList} from '../api/apiSub.js'
// 分段器 // 分段器
@@ -116,6 +116,9 @@ const getComplainListData = async () =>{
onLoad(() =>{ onLoad(() =>{
getComplainListData() getComplainListData()
}) })
onShow(() => {
getComplainListData()
})
// 跳转到详情 // 跳转到详情
const turnToDetail = (item) => { const turnToDetail = (item) => {

View File

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