Browse Source

reg validation pge

fengchang 1 year ago
parent
commit
e2ff83aff6

+ 64 - 0
hichina-main-front-mobile-first/src/pages/RegvalidationPage.vue

@@ -0,0 +1,64 @@
+<template>
+  <q-page>
+    <div class="row flex flex-center">
+      <div v-if="!validated" class="text-h5 text-red">Validating...</div>
+      <div v-if="validated" class="text-h5 text-red">
+        Your register has finished, please go to login page
+      </div>
+    </div>
+  </q-page>
+</template>
+
+<script>
+import { ref, onMounted, getCurrentInstance } from "vue";
+import { api } from "boot/axios";
+import { useRoute } from "vue-router";
+import { useQuasar } from "quasar";
+export default {
+  name: "RegvalidationPage",
+  setup() {
+    const instance = getCurrentInstance();
+    const app = instance.appContext.app;
+    const gp = app.config.globalProperties;
+    const $q = useQuasar();
+
+    const validated = ref(false);
+
+    const route = useRoute();
+
+    const waitAndGo = async () => {
+      setTimeout(() => {
+        gp.$goPage("/login");
+      }, 2500);
+    };
+
+    onMounted(() => {
+      console.log("on mounted");
+      api
+        .post("/api/public/register/pushintodb/" + route.params.regKey)
+        .then((response) => {
+          console.log("Validating register result: ");
+          console.log(response.data);
+          if (response.data.ok == true) {
+            validated.value = true;
+            waitAndGo();
+          } else {
+            gp.$generalNotify(
+              $q,
+              false,
+              "Validating registering failed: " + response.data.message
+            );
+          }
+        })
+        .catch((e) => {
+          console.log("Validate registering fail detail err");
+          gp.$generalNotify($q, false, "Validating registering failed: " + e);
+          console.log(e);
+        });
+    });
+    return {
+      validated,
+    };
+  },
+};
+</script>

+ 7 - 0
hichina-main-front-mobile-first/src/router/routes.js

@@ -128,6 +128,13 @@ const routes = [
       { path: "", component: () => import("pages/FinishpayPage.vue") },
     ],
   },
+  {
+    path: "/regvalidation/:regKey",
+    component: () => import("layouts/MainLayout.vue"),
+    children: [
+      { path: "", component: () => import("pages/RegvalidationPage.vue") },
+    ],
+  },
   {
     path: "/regsuccess",
     component: () => import("layouts/MainLayout.vue"),