Parcourir la source

域名取用方式调整

shish il y a 5 ans
Parent
commit
cdbf5b543f
4 fichiers modifiés avec 16 ajouts et 9 suppressions
  1. 2 2
      pt/src/config/env.js
  2. 6 4
      pt/src/cool/utils/index.js
  3. 7 2
      pt/src/saas/shop/list.vue
  4. 1 1
      pt/src/saas/shop/shop.vue

+ 2 - 2
pt/src/config/env.js

@@ -5,7 +5,7 @@ import { getUrlParam, getFirstHost } from '@/cool/utils';
 const routerMode = 'hash';
 
 // 图片host
-const imgHostUrl = `${window.location.protocol}//img.${getFirstHost()}.com`;
+const imgHostUrl = `${window.location.protocol}//img.${getFirstHost()}`;
 
 // 请求地址
 const baseUrl = (function() {
@@ -24,7 +24,7 @@ const baseUrl = (function() {
 		case 'development':
 			return `/${proxy}`;
 		case 'production':
-			return `${window.location.protocol}//api.pt.${getFirstHost()}.com`;
+			return `${window.location.protocol}//api.pt.${getFirstHost()}`;
 		default:
 			return '';
 	}

+ 6 - 4
pt/src/cool/utils/index.js

@@ -3,14 +3,16 @@ import { routerMode } from '@/config/env';
 export const getFirstHost = () => {
 	let host = window.location.host;
 	host = host.split('.');
-	host = host.length == 3 ? host[1] : host[0];
+	if(host.length == 3){
+		return host[1]+'.'+host[2];
+	}
 	if(process.env.NODE_ENV == 'local'){
-		return 'hhb';
+		return 'hhb.com';
 	}
 	if(process.env.NODE_ENV == 'development'){
-		return 'huaml';
+		return 'huaml.com';
 	}
-	return host;
+	return 'huaml.com';
 };
 
 export const revisePath = path => {

+ 7 - 2
pt/src/saas/shop/list.vue

@@ -47,11 +47,16 @@
 
 			<!-- 平台帐号激活 -->
 			<template #slot-activation="{scope}">
-				<div v-if="firstHost == 'huaml' || firstHost == 'huahb' ">
+				<div v-if="firstHost == 'huaml.com' || firstHost == 'huahb.com' ">
 				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=hd&authType=1`)">花店公众号激活</el-button>
 				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=hd&authType=2`)">花店小程序激活</el-button>
 				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/bind-open?id=hd&actId=6`)">花店小程序体验码</el-button>
 </div>
+<div v-else-if="firstHost == 'theflorist.cn' || firstHost == 'zhhinc.com'">
+				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=mall&authType=1`)">商城公众号激活</el-button>
+				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=mall&authType=2`)">商城小程序激活</el-button>
+				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/bind-open?id=mall&actId=6`)">商城小程序体验码</el-button>
+	</div>
 <div v-else>
 				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=ghs&authType=1`)">供货商公众号激活</el-button>
 				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=ghs&authType=2`)">供货商小程序激活</el-button>
@@ -139,7 +144,7 @@ export default {
 		wxPayConfigFn() {},
 		// 绑定跳转
 		bindJump(url) {
-			let host = `http://api.pt.${getFirstHost()}.com`;
+			let host = `http://api.pt.${getFirstHost()}`;
 			window.open(host + url);
 		},
 		getWxOpen() {

+ 1 - 1
pt/src/saas/shop/shop.vue

@@ -106,7 +106,7 @@
 
             gotoPage(type,data) {
                 console.log(data)
-                let host = `http://api.pt.${getFirstHost()}.com`;
+                let host = `http://api.pt.${getFirstHost()}`;
                 let url=null
                 switch (type) {
                     case 1: