瀏覽代碼

Revert "move chat to main page"

This reverts commit 2a0d8d1719019044d552b1c7aa1ee5d4ded68540.
Timmy 1 年之前
父節點
當前提交
c612e299a9

+ 1 - 39
hichina-main-front-mobile-first/src/layouts/MainLayout.vue

@@ -351,22 +351,11 @@
         </div>
       </q-footer>
     </q-page-container>
-    <!-- Messenger Chat Plugin Code -->
-    <div id="fb-root"></div>
-
-    <!-- Your Chat Plugin code -->
-    <div id="fb-customer-chat" class="fb-customerchat"></div>
   </q-layout>
 </template>
 
 <script>
-import {
-  defineComponent,
-  onMounted,
-  onBeforeMount,
-  ref,
-  getCurrentInstance,
-} from "vue";
+import { defineComponent, onMounted, ref, getCurrentInstance } from "vue";
 import { api } from "boot/axios";
 import { useI18n } from "vue-i18n";
 import { useQuasar } from "quasar";
@@ -433,35 +422,8 @@ export default defineComponent({
           location.reload();
         });
     }
-    function setupChat() {
-      var chatbox = document.getElementById("fb-customer-chat");
-      chatbox.setAttribute("page_id", "1534271790187013");
-      chatbox.setAttribute("attribution", "biz_inbox");
-    }
-    function initFacebookSDK() {
-      window.fbAsyncInit = function () {
-        FB.init({
-          xfbml: true,
-          version: "v17.0",
-        });
-      };
-
-      (function (d, s, id) {
-        var js,
-          fjs = d.getElementsByTagName(s)[0];
-        if (d.getElementById(id)) return;
-        js = d.createElement(s);
-        js.id = id;
-        js.src = "https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js";
-        fjs.parentNode.insertBefore(js, fjs);
-      })(document, "script", "facebook-jssdk");
-    }
     onMounted(() => {
       whoami();
-      setupChat();
-    });
-    onBeforeMount(() => {
-      initFacebookSDK();
     });
     return {
       setLanguage,

+ 41 - 1
hichina-main-front-mobile-first/src/pages/ContactPage.vue

@@ -26,12 +26,52 @@
         />
       </div>
     </div>
+    <!-- Messenger Chat Plugin Code -->
+    <div id="fb-root"></div>
+
+    <!-- Your Chat Plugin code -->
+    <div id="fb-customer-chat" class="fb-customerchat"></div>
   </q-page>
 </template>
 
 <script>
+import { ref, onMounted, onBeforeMount, getCurrentInstance } from "vue";
+import { useQuasar } from "quasar";
+import { api } from "boot/axios";
+import Qs from "qs";
 export default {
   name: "ContactPage",
-  setup() {},
+  setup() {
+    function setupChat() {
+      var chatbox = document.getElementById("fb-customer-chat");
+      chatbox.setAttribute("page_id", "1534271790187013");
+      chatbox.setAttribute("attribution", "biz_inbox");
+    }
+    function initFacebookSDK() {
+      window.fbAsyncInit = function () {
+        FB.init({
+          xfbml: true,
+          version: "v17.0",
+        });
+      };
+
+      (function (d, s, id) {
+        var js,
+          fjs = d.getElementsByTagName(s)[0];
+        if (d.getElementById(id)) return;
+        js = d.createElement(s);
+        js.id = id;
+        js.src = "https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js";
+        fjs.parentNode.insertBefore(js, fjs);
+      })(document, "script", "facebook-jssdk");
+    }
+    onMounted(() => {
+      setupChat();
+    });
+
+    onBeforeMount(() => {
+      initFacebookSDK();
+    });
+  },
 };
 </script>