Forráskód Böngészése

页面问题修复

QAQ 陈 4 hónapja
szülő
commit
118cffd552
3 módosított fájl, 70 hozzáadás és 15 törlés
  1. 67 12
      pages/baoxiudj/baoxiudj.js
  2. 1 1
      pages/homepage/homepage.wxml
  3. 2 2
      pages/homepage/homepage.wxss

+ 67 - 12
pages/baoxiudj/baoxiudj.js

@@ -17,6 +17,7 @@ Page({
     mode: '',
     isReplied: false,
     formSubmitted: false,
+    isSubmitting: false,
   },
 
   onLoad: function (options) {
@@ -173,7 +174,15 @@ Page({
       repairType,
       description
     } = this.data;
-    const isValid = contact && phone && address && repairType && description;
+    
+    const hasAddress = address && address.trim() !== '';
+    const hasContact = contact && contact.trim() !== '';
+    const hasPhone = phone && phone.trim() !== '';
+    const hasValidPhone = this.validatePhone(phone);
+    const hasRepairType = repairType && repairType.trim() !== '';
+    const hasDescription = description && description.trim() !== '';
+    
+    const isValid = hasAddress && hasContact && hasPhone && hasValidPhone && hasRepairType && hasDescription;
 
     this.setData({
       isFormValid: isValid
@@ -290,15 +299,38 @@ Page({
   },
 
   submitForm: function () {
-    if (this.data.isPreviewMode) {
+    if (this.data.isSubmitting) {
       return;
     }
 
-    if (!this.checkFormValidity()) {
+    this.setData({
+      isSubmitting: true
+    });
+
+    if (!this.data.address || this.data.address.trim() === '') {
       wx.showToast({
-        title: '请填写完整信息',
+        title: '请填写地址',
+        icon: 'none'
+      });
+      this.setData({ isSubmitting: false });
+      return;
+    }
+
+    if (!this.data.contact || this.data.contact.trim() === '') {
+      wx.showToast({
+        title: '请填写联系人',
         icon: 'none'
       });
+      this.setData({ isSubmitting: false });
+      return;
+    }
+
+    if (!this.data.phone || this.data.phone.trim() === '') {
+      wx.showToast({
+        title: '请填写联系电话',
+        icon: 'none'
+      });
+      this.setData({ isSubmitting: false });
       return;
     }
 
@@ -307,8 +339,28 @@ Page({
         title: '请输入正确的手机号',
         icon: 'none'
       });
+      this.setData({ isSubmitting: false });
+      return;
+    }
+
+    if (!this.data.repairType || this.data.repairType.trim() === '') {
+      wx.showToast({
+        title: '请选择报修类型',
+        icon: 'none'
+      });
+      this.setData({ isSubmitting: false });
+      return;
+    }
+
+    if (!this.data.description || this.data.description.trim() === '') {
+      wx.showToast({
+        title: '请填写故障说明',
+        icon: 'none'
+      });
+      this.setData({ isSubmitting: false });
       return;
     }
+
     const fileManager = wx.getFileSystemManager();
     this.data.imageList.map(imgInfo => {
       const base64 = fileManager.readFileSync(imgInfo.tempFilePath, 'base64');
@@ -329,7 +381,11 @@ Page({
 
     wx.showLoading({
       title: '提交中...',
+      mask: true
     });
+
+    const that = this;
+    
     wx.request({
       url: app.globalData.interfaceUrls.repairRegistration,
       method: 'POST',
@@ -343,22 +399,21 @@ Page({
       success(res) {
         wx.hideLoading();
         if (res.data.code == '200') {
-          debugger
           wx.navigateTo({
             url: '/pages/baoxiuSuccess/baoxiuSuccess',
           });
         }
+        that.setData({ isSubmitting: false });
       },
       fail(error) {
-        wx.hideLoading()
-        utils.simleInfo('登记失败,请稍后再试')
+        wx.hideLoading();
+        wx.showToast({
+          title: '登记失败,请稍后再试',
+          icon: 'none'
+        });
+        that.setData({ isSubmitting: false });
       }
     })
-
-    // 在提交成功后设置标记
-    this.setData({
-      formSubmitted: true
-    });
   },
 
   inputAddress: function (e) {

+ 1 - 1
pages/homepage/homepage.wxml

@@ -44,7 +44,7 @@
           <view class="amount-label">总计应缴(元)</view>
 
           <view class="amount-details">
-            <view class="detaisl-item">
+            <view class="detail-item">
               <text class="number">{{billInfo.waterUsage}}</text>
               <text class="label">用水量(m³)</text>
             </view>

+ 2 - 2
pages/homepage/homepage.wxss

@@ -83,8 +83,8 @@
   position: absolute;
   top: 0rpx;
   left: 0;
-  width: 35%;
-  height: 35%;
+  width: 30%;
+  height: 30%;
   z-index: 0;
 }