修复报修bug
This commit is contained in:
@@ -22,13 +22,17 @@
|
||||
<!-- 标题 -->
|
||||
<view class="form-item">
|
||||
<text class="label">标题</text>
|
||||
<uni-easyinput v-model="form.title" placeholder="请输入内容" :inputBorder="false" maxlength="30"></uni-easyinput>
|
||||
<uni-easyinput v-model="form.title" placeholder="请输入内容(最多30个字符)" :inputBorder="false" maxlength="30"></uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 问题描述 -->
|
||||
<view class="form-item-wenti">
|
||||
<text class="label">问题描述</text>
|
||||
<uni-easyinput v-model="form.desc" placeholder="请描述你的问题" type="textarea" maxlength="200"></uni-easyinput>
|
||||
<view class="textarea-wrap">
|
||||
<textarea v-model="form.desc" placeholder="请描述你的问题(最多200字)" maxlength="200" class="desc-textarea" />
|
||||
<text class="char-count">{{ form.desc.length }}/200</text>
|
||||
</view>
|
||||
<!-- <uni-easyinput v-model="form.desc" placeholder="请描述你的问题" type="textarea" maxlength="200"></uni-easyinput> -->
|
||||
</view>
|
||||
|
||||
<!-- 手机号 -->
|
||||
@@ -61,7 +65,9 @@
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="submit-btn" @click="submitForm">提交</button>
|
||||
<button class="submit-btn" :disabled="submitting" @click="submitForm">{{ submitting ? '提交中...' : '提交' }}</button>
|
||||
<!-- 提交中遮罩 -->
|
||||
<view class="submit-mask" v-if="submitting" @touchmove.stop.prevent></view>
|
||||
|
||||
<!-- 时间选择弹窗 -->
|
||||
<uni-popup ref="timePopupRef" type="bottom" :mask-click="false" border-radius="16rpx">
|
||||
@@ -149,6 +155,9 @@ const houseId = ref('')
|
||||
const projectName = ref('')
|
||||
const projectId = ref('')
|
||||
|
||||
|
||||
// 提交状态锁
|
||||
const submitting = ref(false)
|
||||
// 表单数据
|
||||
const form = ref({
|
||||
title: '',
|
||||
@@ -214,6 +223,11 @@ const closeTimePopup = () => {
|
||||
|
||||
const confirmTime = () => {
|
||||
const selectedDateTime = `${selectedDate.value} ${selectedHour.value}:${selectedMinute.value}`
|
||||
const now = moment()
|
||||
if (moment(selectedDateTime, 'YYYY-MM-DD HH:mm').isBefore(now)) {
|
||||
uni.showToast({ title: '预约时间不能早于当前时间', icon: 'none' })
|
||||
return
|
||||
}
|
||||
selectedTime.value = moment(selectedDateTime, 'YYYY-MM-DD HH:mm')
|
||||
form.value.datetime = selectedTime.value.format('YYYY-MM-DD HH:mm')
|
||||
closeTimePopup()
|
||||
@@ -355,15 +369,17 @@ const submitForm = async () => {
|
||||
if (!form.value.title) return uni.showToast({ title: '请输入标题', icon: 'none' })
|
||||
// if (!form.value.desc) return uni.showToast({ title: '请输入问题描述', icon: 'none' })
|
||||
if (!/^1[3-9]\d{9}$/.test(form.value.phone)) return uni.showToast({ title: '手机号不正确', icon: 'none' })
|
||||
// if (!form.value.datetime) return uni.showToast({ title: '请选择预约时间', icon: 'none' })
|
||||
if (!form.value.datetime) return uni.showToast({ title: '请选择预约时间', icon: 'none' })
|
||||
if (moment(form.value.datetime, 'YYYY-MM-DD HH:mm').isBefore(moment())) return uni.showToast({ title: '预约时间不能早于当前时间', icon: 'none' })
|
||||
|
||||
const villageId = uni.getStorageSync('currentVillageId')
|
||||
if (!villageId || villageId === '0') return uni.showToast({ title: '请先选择小区', icon: 'none' })
|
||||
|
||||
const userId = uni.getStorageSync('userId')
|
||||
if (!userId) return uni.showToast({ title: '用户信息失效', icon: 'none' })
|
||||
submitting.value = true
|
||||
|
||||
uni.showLoading({ title: '提交中...' })
|
||||
uni.showLoading({ title: '提交中...' ,mask:true})
|
||||
|
||||
try {
|
||||
const imageUrls = await uploadImages()
|
||||
@@ -399,9 +415,11 @@ const submitForm = async () => {
|
||||
})
|
||||
}, 1500)
|
||||
} else {
|
||||
submitting.value = false
|
||||
uni.showToast({ title: res.msg || '提交失败', icon: 'none' })
|
||||
}
|
||||
} catch (e) {
|
||||
submitting.value = false
|
||||
uni.showToast({ title: '提交失败,请检查网络或重试', icon: 'none' })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
@@ -438,9 +456,10 @@ const submitForm = async () => {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
/* .time-value {
|
||||
color: #000;
|
||||
} */
|
||||
.time-value {
|
||||
white-space: nowrap;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.input, .textarea {
|
||||
flex: 1;
|
||||
padding: 20rpx;
|
||||
@@ -458,6 +477,27 @@ const submitForm = async () => {
|
||||
/* border-bottom: 1px solid #eee; */
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.textarea-wrap {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
}
|
||||
.desc-textarea {
|
||||
width: 100%;
|
||||
height: 160rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx 0;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
}
|
||||
.char-count {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
bottom: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.switch {
|
||||
font-size: 12px;
|
||||
@@ -511,6 +551,16 @@ textarea {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
/* 提交中遮罩 */
|
||||
.submit-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
z-index: 9999;
|
||||
}
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
background: #007aff;
|
||||
|
||||
Reference in New Issue
Block a user