|
@@ -9,14 +9,19 @@ Page({
|
|
|
countDown: 3,
|
|
|
isFormValid: false,
|
|
|
category: '投诉',
|
|
|
+ categoryValue: '1',
|
|
|
isPreviewMode: false,
|
|
|
title: '',
|
|
|
content: '',
|
|
|
replyTime: '',
|
|
|
replyContent: '',
|
|
|
formSubmitted: false,
|
|
|
- isSubmitting: false, // 新增保存标志位
|
|
|
- lastSubmitTime: 0, // 上次提交时间(通过防抖(Debounce)技术,限制用户在一定时间内只能提交一次。)
|
|
|
+ isSubmitting: false,
|
|
|
+ lastSubmitTime: 0,
|
|
|
+ categoryMap: [
|
|
|
+ {name: '投诉', value: '1'},
|
|
|
+ {name: '建议', value: '2'}
|
|
|
+ ],
|
|
|
},
|
|
|
|
|
|
onLoad: function (options) {
|
|
@@ -67,8 +72,12 @@ Page({
|
|
|
},
|
|
|
|
|
|
radioChange: function (e) {
|
|
|
+ const value = e.detail.value;
|
|
|
+ const selectedCategory = this.data.categoryMap.find(item => item.value === value || item.name === value);
|
|
|
+
|
|
|
this.setData({
|
|
|
- category: e.detail.value
|
|
|
+ category: selectedCategory.name,
|
|
|
+ categoryValue: selectedCategory.value
|
|
|
});
|
|
|
this.checkFormValidity();
|
|
|
},
|
|
@@ -242,9 +251,8 @@ Page({
|
|
|
imgInfo.base64 = base64;
|
|
|
return imgInfo;
|
|
|
})
|
|
|
- // 构建提交数据
|
|
|
const submitData = {
|
|
|
- category: this.data.category,
|
|
|
+ category: this.data.categoryValue,
|
|
|
contact: this.data.contact,
|
|
|
phone: this.data.phone,
|
|
|
description: this.data.description,
|
|
@@ -309,7 +317,6 @@ debugger
|
|
|
|
|
|
if (prevPage && prevPage.data.noticeList) {
|
|
|
const item = prevPage.data.noticeList.find(item => item.id == id);
|
|
|
- debugger
|
|
|
if (item) {
|
|
|
const formatTime = (timeString) => {
|
|
|
if (!timeString) return ''; // 如果时间为空,返回空字符串
|
|
@@ -319,9 +326,16 @@ debugger
|
|
|
const day = String(date.getDate()).padStart(2, '0'); // 日期补零
|
|
|
return `${year}-${month}-${day}`;
|
|
|
};
|
|
|
+
|
|
|
+ let categoryName = '投诉';
|
|
|
+ const categoryItem = this.data.categoryMap.find(cat => cat.value === item.category);
|
|
|
+ if (categoryItem) {
|
|
|
+ categoryName = categoryItem.name;
|
|
|
+ }
|
|
|
+
|
|
|
this.setData({
|
|
|
- category: item.category || '投诉',
|
|
|
- description: item.description || '',
|
|
|
+ category: categoryName,
|
|
|
+ categoryValue: item.category || '1',
|
|
|
contact: item.feedbackperson || '',
|
|
|
description: item.replynote || '',
|
|
|
phone: item.contactnumber || '',
|
|
@@ -333,13 +347,14 @@ debugger
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 添加重置表单的方法
|
|
|
resetForm: function () {
|
|
|
this.setData({
|
|
|
contact: '',
|
|
|
phone: '',
|
|
|
description: '',
|
|
|
- imageList: []
|
|
|
+ imageList: [],
|
|
|
+ category: '投诉',
|
|
|
+ categoryValue: '1'
|
|
|
});
|
|
|
}
|
|
|
});
|