Explorar o código

:sparkles: 注册时根据域名发送邮箱

Ritchie hai 1 ano
pai
achega
5c9125f33c
Modificáronse 2 ficheiros con 26 adicións e 4 borrados
  1. 2 3
      src/views/login.vue
  2. 24 1
      src/views/register.vue

+ 2 - 3
src/views/login.vue

@@ -148,8 +148,8 @@ export default {
 
     const getDomainFunc = async () => {
       const currentDomain = window.location.href;
-      // const currentDomain = window.location.hostname;
-      console.log("currentDomain >>>", currentDomain);
+      console.log("href >>>", currentDomain);
+      console.log("hostname >>>", window.location.hostname);
       switch (true) {
         // case currentDomain.includes('/shenze/'):
         //   logoName.value = aetiLogo;
@@ -159,7 +159,6 @@ export default {
         case currentDomain.includes('/aeti/'): // aeti是美国孙总portalmcc.com.cn
           logoName.value = aetiLogo;
           sysTitle.value = 'AETI GLOBAL';
-
           break;
         default:
           logoName.value = defaultLogo;

+ 24 - 1
src/views/register.vue

@@ -148,6 +148,7 @@ export default {
 
     const router = useRouter();
     const reqApi = ref(false);
+    const hostName = ref('');
 
     // 注册点击
     const registerSubmit = async () => {
@@ -189,12 +190,15 @@ export default {
       } else {
         phoneOrEmailStr = email.value;
       }
+      
+      getCurrentDomain();
 
       try {
         const { data } = await sentRegisterCode({
           ifForeign: ifForeign.value,
           phoneOrEmail: phoneOrEmailStr,
-          hostName: 'Sunzee',
+          // hostName: 'Sunzee',
+          hostName: hostName.value,
         });
         if (data.code === '00000') {
           reqApi.value = false;
@@ -209,6 +213,7 @@ export default {
         reqApi.value = false;
       }
     }
+
     // 验证码发送成功开始1分钟倒计时
     const verCodeTimeInterval = () => {
       const intervalId = setInterval(() => {
@@ -234,6 +239,24 @@ export default {
       }
     });
 
+    const getCurrentDomain = () => {
+      const currentDomain = window.location.href;
+      // const currentHostname = window.location.hostname;
+      console.log("currentDomain >>>", currentDomain);
+      // console.log("currentHostname >>>", currentHostname);
+      switch (true) {
+        case currentDomain.includes('sevencloud.com.cn'):
+          hostName.value = 'Sevencloud';
+          break;
+        case currentDomain.includes('portalmcc.com.cn'):
+          hostName.value = 'Portalmcc';
+          break;
+        default:
+          hostName.value = 'Sunzee';
+      }
+      console.log("hostName.value >>>", hostName.value);
+    }
+
     const signOptions = [
       { text: '手机注册', value: "mo" },
       { text: '邮箱注册', value: "ema" }