zhengnaiwen_citu hace 7 meses
padre
commit
5135818240
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      pagesB/headhunting/pages/contact.vue

+ 7 - 2
pagesB/headhunting/pages/contact.vue

@@ -10,7 +10,7 @@
       <uni-forms-item label="企业名称" required>
         <uni-easyinput v-model="baseFormData.enterpriseName" placeholder="请输入企业名称" />
       </uni-forms-item>
-      <button type="primary" @click="submit">提交</button>
+      <button type="primary" @click="submit" :disabled="loading">提交</button>
     </uni-forms>
   </view>
 </template>
@@ -38,24 +38,29 @@ const rules = {
     rules: [{required: true, errorMessage: '请输入企业名称' }]
   }
 }
-
+const loading = ref(false)
 const submit = async () => {
   try {
     const valid = await unref(baseForm).validate()
     if (!valid) return
 
+    loading.value = true
+
     const { code, msg } = await huntSubmit(baseFormData.value)
     if (code !== 0) {
+      loading.value = false
       uni.showToast({ title: msg, icon: 'none' })
       return
     }
     uni.showToast({ title: '提交成功,我们会尽快与您联系', icon: 'none', success: () => {
       setTimeout(() => {
+        loading.value = false
         uni.navigateBack()
       }, 1000)
     } })
   } catch (error) {
     console.log('error', error)
+    loading.value = false
   }
 }
 </script>