Przeglądaj źródła

頁面問題修正

jeter20131220 3 lat temu
rodzic
commit
6698c8735d
4 zmienionych plików z 256 dodań i 97 usunięć
  1. 75 41
      desktopB/goto.js
  2. 53 11
      desktopB/index.html
  3. 75 35
      mobileB/goto.js
  4. 53 10
      mobileB/index.html

+ 75 - 41
desktopB/goto.js

@@ -22,55 +22,89 @@ $(".banner-slider").slick({
   
     return o;
   };
+// email
+  $(document).ready(function () {
+  
+    //E-MAIL格式檢查
+
+    $("body").on("change", "#email", function () {
+
+      $Emailchecking = IsEmail($("#email").val());
+
+
+      if ($Emailchecking == false) {
+
+        alert("請填寫正確的E-MAIL格式");
+
+        // $("#email").blur(); //離開焦點
+
+      }
+
+    })
+
+    function IsEmail(email) {
+
+      var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
+
+      if (!regex.test(email)) {
+
+        return false;
+
+      } else {
+
+        return true;
+
+      }
+
+    }
+
+  });
+  // phone
+  $(document).ready(function () {
+
+    //phone格式檢查
+
+    $("body").on("change", "#phone", function () {
+
+      $Phonechecking = IsPhone($("#phone").val());
+
+
+      if ($Phonechecking == false) {
+
+        alert("請填寫正確的手機格式");
+
+        // $("#email").blur(); //離開焦點
+
+      }
+
+    })
+
+    function IsPhone(phone) {
+
+      var regex = /^[0-9]+$/;
+
+      if (!regex.test(phone)) {
+
+        return false;
+
+      } else {
+
+        return true;
+
+      }
+
+    }
+
+  });
+ 
 
   $(".contact-form1").submit(function (e) {
     /*	var formRef = $('#form1').serializeArray();
       var jsonString = JSON.stringify(formRef);*/
     var jsonInfo = $('.contact-form1').serializeObject();
     var jsonString = JSON.stringify(jsonInfo);
-    // email 格式檢查
-    $(document).ready(function () {
-  
-      //E-MAIL格式檢查
-  
-      $("body").on("change", "#email", function () {
-  
-        $Emailchecking = IsEmail($("#email").val());
-  
-  
-        if ($Emailchecking == false) {
-  
-          alert("請填寫正確的E-MAIL格式");
-  
-          // $("#email").blur(); //離開焦點
-  
-        }
-  
-      })
-  
-      function IsEmail(email) {
-  
-        var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-  
-        if (!regex.test(email)) {
-  
-          return false;
-  
-        } else {
-  
-          return true;
-  
-        }
-  
-      }
-  
-    });
    
   
-    
-  
-  
-  
     $.ajax({
       type: 'POST',
       url: 'https://go.hhh.com.tw:8001/deco_request_detail',

+ 53 - 11
desktopB/index.html

@@ -31,6 +31,47 @@
 </head>
 
 <body>
+    <script>
+        function statusChangeCallback(response) {  // Called with the results from FB.getLoginStatus().
+            if (response.status === 'connected') {  // 已登入
+                testAPI();
+            }
+        }
+
+        function checkLoginState() {                 // Called when a person is finished with the Login Button.
+            FB.getLoginStatus(function (response) {   // See the onlogin handler
+                statusChangeCallback(response);
+            });
+        }
+
+        window.fbAsyncInit = function () {
+            FB.init({
+                appId: '1388696554848391',
+                cookie: true,            // Enable cookies to allow the server to access the session.
+                xfbml: true,            // Parse social plugins on this webpage.
+                version: 'v11.0'          // Use this Graph API version for this call.
+            });
+
+            FB.getLoginStatus(function (response) {   // Called after the JS SDK has been initialized.
+                statusChangeCallback(response);      // Returns the login status.
+            });
+        };
+
+        function testAPI() {
+            FB.api('/me/?fields=id,name,email', function (response) {
+                console.log('FB API回傳資料: ' + JSON.stringify(response));
+
+                if (response.id) {
+                    // 設定欄位預設值
+                    document.getElementById("email").value = response.email;
+                    document.getElementById("name").value = response.name;
+
+                    // 隱藏FB登入按鈕
+                    document.getElementById("fb_login").style.display = 'none';
+                }
+            });
+        };
+    </script>
     <div class="banner container-fluid" style="padding:0; margin:0 ">
         <!-- <section id="banner"> -->
         <div class="Navigation">
@@ -62,7 +103,7 @@
                         <div class="box">
                             <img src="./img/process/box3.png" alt="">
                             <div class="box-text">設計公司會</div>
-                            <div class="box-text"> 主動與屋主</div>
+                            <div class="box-text"> 主動與屋主聯繫</div>
                         </div>
                         <div class="box">
                             <img src="./img/process/box4.png" alt="">
@@ -132,13 +173,13 @@
     </div>
     <section id="contact-us">
         <div class="form-title">
-            <h1>已經服務超過14392個生活</h1>
+            <h1>已經服務超過14392個家庭</h1>
             <h1>打造夢想中的完美居家生活</h1>
             <h1>即刻啟動!</h1>
         </div>
         <!-- <hr> -->
         <div class="contact-text">
-            <div class="text-p">請撥打全台付費專線<span style="opacity: 0;">11</span><span id="phone"
+            <div class="text-p">請撥打全台付費專線<span style="opacity: 0;">11</span><span id="phone"
                     style="color: #ee751b; font-weight:900;"> 0800-336-086</span></div>
             <div class="text-p">或填寫以下資料,專人將盡速與您聯繫</div>
         </div>
@@ -199,7 +240,7 @@
                         </select>
                         <input name="size" type="text" id="square" placeholder="請輸入坪數" required>
                         <select name="bed_num" id="rooms" required style="margin-right:1.5vw">
-                            <option value="幾房" disabled selected="selected">房</option>
+                            <option value="幾房" disabled selected="selected">2房</option>
                             <option class="option" value="1">1</option>
                             <option class="option" value="2">2</option>
                             <option class="option" value="3">3</option>
@@ -210,12 +251,12 @@
                             <option class="option" value="8">8</option>
                         </select>
                         <select name="liv_num" id="livingroom" required style="margin-right:1.5vw">
-                            <option value="幾廳" disabled selected="selected" style="margin-right:25px">廳</option>
+                            <option value="幾廳" disabled selected="selected" style="margin-right:25px">2廳</option>
                             <option class="option" value="1">1</option>
                             <option class="option" value="2">2</option>
                         </select>
                         <select name="bath_num" id="bathroom" required>
-                            <option value="地區" disabled selected="selected">衛</option>
+                            <option value="地區" disabled selected="selected">1衛</option>
                             <option class="option" value="1">1</option>
                             <option class="option" value="2">2</option>
                             <option class="option" value="3">3</option>
@@ -246,9 +287,10 @@
                     </div>
                     <hr>
                     <div id="form-right">
-                        <div id="facebook" onclick='callFB()'>
-                            <img src="./img/logo/facebook.webp" alt="">
-                            使用FB填入信箱與姓名
+                        <div id="fb_login">
+                            <fb:login-button scope="public_profile,email" onlogin="checkLoginState();">使用FB填入信箱與姓名
+                            </fb:login-button>
+                            <div id="status"></div>
                         </div>
                         <input type="text" name="email" id="email" placeholder="請輸入信箱" required>
                         <input type="text" name="name" id="name" placeholder="請輸入姓名" required>
@@ -329,8 +371,8 @@
 
 
 
-
-
+<!-- Load the JS SDK asynchronously -->
+    <script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
     <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"
         integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
         crossorigin="anonymous"></script>

+ 75 - 35
mobileB/goto.js

@@ -30,48 +30,88 @@ $(".feedback-slider1").slick({
   
     return o;
   };
+  // email 格式檢查
+  $(document).ready(function () {
+  
+    //E-MAIL格式檢查
+
+    $("body").on("change", "#email", function () {
+
+      $Emailchecking = IsEmail($("#email").val());
+
+
+      if ($Emailchecking == false) {
+
+        alert("請填寫正確的E-MAIL格式");
+
+        // $("#email").blur(); //離開焦點
+
+      }
+
+    })
+
+    function IsEmail(email) {
+
+      var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
+
+      if (!regex.test(email)) {
+
+        return false;
+
+      } else {
+
+        return true;
+
+      }
+
+    }
+
+  });
+  // phone 格式檢查
+  $(document).ready(function () {
+
+    //phone格式檢查
+
+    $("body").on("change", "#phone", function () {
+
+      $Phonechecking = IsPhone($("#phone").val());
+
+
+      if ($Phonechecking == false) {
+
+        alert("請填寫正確的手機格式");
+
+        // $("#email").blur(); //離開焦點
+
+      }
+
+    })
+
+    function IsPhone(phone) {
+
+      var regex = /^[0-9]+$/;
+
+      if (!regex.test(phone)) {
+
+        return false;
+
+      } else {
+
+        return true;
+
+      }
+
+    }
+
+  });
+  
   $(".contact-form1").submit(function (e) {
     /*	var formRef = $('#form1').serializeArray();
       var jsonString = JSON.stringify(formRef);*/
     var jsonInfo = $('.contact-form1').serializeObject();
     var jsonString = JSON.stringify(jsonInfo);
     // email 格式檢查
-    $(document).ready(function () {
-  
-      //E-MAIL格式檢查
-  
-      $("body").on("change", "#email", function () {
-  
-        $Emailchecking = IsEmail($("#email").val());
-  
-  
-        if ($Emailchecking == false) {
   
-          alert("請填寫正確的E-MAIL格式");
-  
-          // $("#email").blur(); //離開焦點
-  
-        }
-  
-      })
-  
-      function IsEmail(email) {
-  
-        var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-  
-        if (!regex.test(email)) {
-  
-          return false;
-  
-        } else {
-  
-          return true;
-  
-        }
-  
-      }
-  
-    });
    
   
     

+ 53 - 10
mobileB/index.html

@@ -33,6 +33,47 @@
 </head>
 
 <body>
+    <script>
+        function statusChangeCallback(response) {  // Called with the results from FB.getLoginStatus().
+            if (response.status === 'connected') {  // 已登入
+                testAPI();
+            }
+        }
+
+        function checkLoginState() {                 // Called when a person is finished with the Login Button.
+            FB.getLoginStatus(function (response) {   // See the onlogin handler
+                statusChangeCallback(response);
+            });
+        }
+
+        window.fbAsyncInit = function () {
+            FB.init({
+                appId: '1388696554848391',
+                cookie: true,            // Enable cookies to allow the server to access the session.
+                xfbml: true,            // Parse social plugins on this webpage.
+                version: 'v11.0'          // Use this Graph API version for this call.
+            });
+
+            FB.getLoginStatus(function (response) {   // Called after the JS SDK has been initialized.
+                statusChangeCallback(response);      // Returns the login status.
+            });
+        };
+
+        function testAPI() {
+            FB.api('/me/?fields=id,name,email', function (response) {
+                console.log('FB API回傳資料: ' + JSON.stringify(response));
+
+                if (response.id) {
+                    // 設定欄位預設值
+                    document.getElementById("email").value = response.email;
+                    document.getElementById("name").value = response.name;
+
+                    // 隱藏FB登入按鈕
+                    document.getElementById("fb_login").style.display = 'none';
+                }
+            });
+        };
+    </script>
     <div class="container-fluid" style="padding:0;margin:0 ">
 
         <section id="banner-box">
@@ -130,7 +171,7 @@
                             <div class="box">
                                 <img src="./img/process/box3.png" alt="">
                                 <div class="box-text">設計公司會</div>
-                                <div class="box-text"> 主動與屋主</div>
+                                <div class="box-text"> 主動與屋主聯繫</div>
                             </div>
                             <div class="box">
                                 <img src="./img/process/box4.png" alt="">
@@ -147,7 +188,7 @@
     </div>
     <section id="contact-us">
         <div id="form-title">
-            <h1>已經服務超過14392個生活</h1>
+            <h1>已經服務超過14392個家庭</h1>
             <h1>打造夢想中的完美居家生活</h1>
             <h1>即刻啟動!</h1>
 
@@ -212,7 +253,7 @@
                 </select>
                 <input name="size" type="text" id="square" placeholder="請輸入坪數" required>
                 <select name="bed_num" id="rooms" required>
-                    <option value="幾房" disabled selected="selected">房</option>
+                    <option value="幾房" disabled selected="selected">2房</option>
                     <option class="option" value="1">1</option>
                     <option class="option" value="2">2</option>
                     <option class="option" value="3">3</option>
@@ -223,12 +264,12 @@
                     <option class="option" value="8">8</option>
                 </select>
                 <select name="liv_num" id="livingroom" required style="margin-right:1.5vw">
-                    <option value="living room" disabled selected="selected">廳</option>
+                    <option value="living room" disabled selected="selected">2廳</option>
                     <option class="option" value="1">1</option>
                     <option class="option" value="2">2</option>
                 </select>
                 <select name="bath_num" id="bathroom" required>
-                    <option value="bathroom" disabled selected="selected">衛</option>
+                    <option value="bathroom" disabled selected="selected">1衛</option>
                     <option class="option" value="1">1</option>
                     <option class="option" value="2">2</option>
                     <option class="option" value="3">3</option>
@@ -255,10 +296,11 @@
                     <option class="option" value="type">工業風</option>
                     <option class="option" value="type">異國風</option>
                 </select>
-                <input name="prefer_date" type="date" id="date" required>
-                <div id="facebook">
-                    <img src="./img/logo/facebook.webp" alt="">
-                    <p>使用FB填入信箱與姓名 </p>
+                <input name="prefer_date" type="date"  placeholder="預選裝修日期" id="date" required>
+                <div id="fb_login">
+                    <fb:login-button scope="public_profile,email" onlogin="checkLoginState();">使用FB填入信箱與姓名
+                    </fb:login-button>
+                    <div id="status"></div>
                 </div>
                 <input type="text" name="email" id="email" placeholder="請輸入信箱" required>
                 <input type="text" name="name" id="name" placeholder="請輸入姓名" required>
@@ -327,7 +369,8 @@
 
 
 
-
+<!-- Load the JS SDK asynchronously -->
+<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
     <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"
         integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
         crossorigin="anonymous"></script>