From 35c7b841f41398ab270d9316e41e841ec6bfd9c0 Mon Sep 17 00:00:00 2001
From: chengkun <chengkun@ishangstudy.com>
Date: Mon, 15 Sep 2025 15:00:41 +0800
Subject: [PATCH] 提交

---
 app/home/view/contact/index.html |   64 +++++++++++++++++++++++++++----
 1 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/app/home/view/contact/index.html b/app/home/view/contact/index.html
index 1daa4ea..4c9367d 100644
--- a/app/home/view/contact/index.html
+++ b/app/home/view/contact/index.html
@@ -94,7 +94,8 @@
                 </div>
             </div>
         </div>
-        <!-- contact area2 -->
+
+        <!-- 提交在线咨询 -->
         <div class="contact_area2">
             <div class="container">
                 <div class="row">
@@ -106,33 +107,33 @@
                                 <h2>{{ $t('message.common.submit-contact-information') }}</h2>
                             </div>
                             <div class="witr_apartment_form">
-                                <form action="mail.php" method="post" id="contact-form">
+                                <form method="post" id="contact-form">
                                     <div class="row">
                                         <div class="col-lg-6 col-md-6">
                                             <div class="twr_form_box">
-                                                <input type="text" name="name" :placeholder="$t('message.common.name')">
+                                                <input type="text" name="name" :placeholder="$t('message.common.name')" v-model="form.name">
                                             </div>
                                         </div>
                                         <div class="col-lg-6 col-md-6">
                                             <div class="twr_form_box">
-                                                <input type="email" name="email" :placeholder="$t('message.common.email')">
+                                                <input type="email" name="email" :placeholder="$t('message.common.email')" v-model="form.email">
                                             </div>
                                         </div>
                                         <div class="col-lg-6 col-md-6">
                                             <div class="twr_form_box">
-                                                <input type="number" name="number" :placeholder="$t('message.common.phone')">
+                                                <input type="number" name="number" :placeholder="$t('message.common.phone')" v-model="form.phone">
                                             </div>
                                         </div>
                                         <div class="col-lg-6 col-md-6">
                                             <div class="twr_form_box">
-                                                <input type="text" name="subject" :placeholder="$t('message.common.subject')">
+                                                <input type="text" name="subject" :placeholder="$t('message.common.subject')" v-model="form.subject">
                                             </div>
                                         </div>
                                         <div class="col-lg-12 col-md-12">
                                             <div class="twr_form_box ">
-                                                <textarea name="textarea" :placeholder="$t('message.common.message')"></textarea>
+                                                <textarea name="textarea" :placeholder="$t('message.common.message')" v-model="form.message"></textarea>
                                             </div>
-                                            <button type="submit" name="ok" class="btn ">{{ $t('message.common.submit') }}</button>
+                                            <button type="button" name="ok" class="btn" @click="submitForm" :disabled="submitDisabled">{{ $t('message.common.submit') }}</button>
                                         </div>
                                         <div class="col-lg-12 text-center">
                                             <p class="form-messege"></p>
@@ -155,7 +156,13 @@
             mixins: [sharedMixin],
             data() {
                 return {
-
+                    form: {
+                        name: '',
+                        email: '',
+                        phone: '',
+                        subject: '',
+                        message: '',
+                    }
                 };
             },
             computed: {
@@ -166,6 +173,45 @@
             created() {
             },
             methods: {
+                submitForm() {
+                    var that = this;
+                    that.submitDisabled = true;
+                    const loading = this.$loading({
+                        lock: true,
+                        text: '提交中',
+                        spinner: 'el-icon-loading',
+                        background: 'rgba(0, 0, 0, 0.2)'
+                    });
+                    let url = "/home/contact/save_message.html";
+                    postRequest(url, that.form).then(res => {
+                        loading.close();
+                        if (res.data.code == 200) {
+                            that.$message({
+                                message: res.data.message,
+                                type: 'success',
+                                duration: 1000,
+                                center: true,
+                                onClose: function () {
+                                    that.form = {
+                                        name: '',
+                                        email: '',
+                                        phone: '',
+                                        subject: '',
+                                        message: '',
+                                    }
+                                }
+                            });
+                        } else {
+                            that.submitDisabled = false;
+                            that.$message({
+                                message: res.data.message,
+                                type: 'error',
+                                duration: 1500,
+                                center: true
+                            });
+                        }
+                    });
+                }
 
             },
         };

--
Gitblit v1.9.0