Commit 4f7da662 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 1957d17c 73b74488
import { GlobalConfig } from '@/global/config'
import { getTopDomainByHost, getDefaultEnterprise, getChannelInfo, getIChannelInfo } from '@/utils'
export const NOT_CHANGE_VALUE = 'hello, world'
// socket的链接地址, 默认会使用后端接口网关地址
export const SOCKET_URL = process.env.SOCKET_URL?.replace('http|https', 'ws') || process.env.BACK_GATEWAY?.replace('http|https', 'ws')
......@@ -10,60 +7,6 @@ export const MEMBER_ROLE_LISTS = [
{ label: '服务提供者', value: 1 }, { label: '服务消费者', value: 2 }
]
/**
* 请求头
*/
export const REQUEST_HEADER = 'http://'
/**
* 顶域
*/
export const TOP_DOMAIN = process.env.NODE_ENV !== 'development' ? getTopDomainByHost(GlobalConfig.global.siteInfo.siteUrl, true) : 'lingxidev.com'
// export const TOP_DOMAIN = getTopDomainByHost(GlobalConfig.global.siteInfo.siteUrl)
/**
* 平台首页域名
*/
export const PLATFORM_DOMAIN = `${REQUEST_HEADER}www.${TOP_DOMAIN}`
/**
* 企业商城域名
*/
const enterpriseInfo = getDefaultEnterprise()
export const ENTERPRISE_CENTER_URL = `${REQUEST_HEADER}${enterpriseInfo ? enterpriseInfo.url : 'b2b'}.${TOP_DOMAIN}`
/**
* 渠道商城域名
*/
const channelInfo = getChannelInfo()
export const CHANNEL_CENTER_URL = `${REQUEST_HEADER}${channelInfo ? channelInfo.url : 'channel'}.${TOP_DOMAIN}`
/**
* 渠道自有商城域名
*/
const iChannelInfo = getIChannelInfo()
export const ICHANNEL_CENTER_URL = `${REQUEST_HEADER}${iChannelInfo ? iChannelInfo.url : 'ichannel'}.${TOP_DOMAIN}`
/**
* 行情资讯域名
*/
export const INFO_CENTER_URL = `${REQUEST_HEADER}info.${TOP_DOMAIN}`
/**
* 企业采购域名
*/
export const SRM_CENTER_URL = `${REQUEST_HEADER}srm.${TOP_DOMAIN}`
/**
* 物流服务域名
*/
export const LOGISTICS_CENTER_URL = `${REQUEST_HEADER}logistics.${TOP_DOMAIN}`
/**
* 加工服务域名
*/
export const MANUFACTURE_CENTER_URL = `${REQUEST_HEADER}manufacture.${TOP_DOMAIN}`
// 会员等级类型
export const MEMBER_GRADE_LISTS = [
......
/**
*
*
* **********
* 脚本注入全局配置
*
*
* **********
*/
......
......@@ -13,7 +13,6 @@ import ListLayout from '@/components/DetailLayout/components/listLayout';
import GeneralLayout from '@/components/DetailLayout/components/generalLayout';
import RecordLyout from '@/components/DetailLayout/components/recordLyout';
import EyePreview from '@/components/EyePreview';
import { ENTERPRISE_CENTER_URL } from '@/constants';
const TABLINK = [
{ id: 'progressLayout', title: '流转进度' },
......@@ -139,7 +138,7 @@ const ProductInquiryDetail = () => {
const handleJump = (data:any) => {
console.log(data)
window.open(`${ENTERPRISE_CENTER_URL}/shop/${data.memberId}_${data.memberRoleId}/inquiry/detail/${data.commodityId}`)
window.open(`/shop/${data.memberId}_${data.memberRoleId}/inquiry/detail/${data.commodityId}`)
}
const columns: ColumnType<any>[] = [
......
......@@ -12,7 +12,6 @@ import BasicLayout from '@/components/DetailLayout/components/basicLayout';
import ListLayout from '@/components/DetailLayout/components/listLayout';
import GeneralLayout from '@/components/DetailLayout/components/generalLayout';
import RecordLyout from '@/components/DetailLayout/components/recordLyout';
import { ENTERPRISE_CENTER_URL } from '@/constants';
const TABLINK = [
{ id: 'progressLayout', title: '流转进度' },
......@@ -144,7 +143,7 @@ const ConfirmOfferDetail = () => {
dataIndex: 'productId',
render: (productId, data) => (
<Space direction='vertical'>
<Typography.Link target="_blank" href={`${ENTERPRISE_CENTER_URL}/shop/${data.memberId}_${data.memberRoleId}/commodity/detail/${data.commodityId}`}>{productId}</Typography.Link>
<Typography.Link target="_blank" href={`/shop/${data.memberId}_${data.memberRoleId}/commodity/detail/${data.commodityId}`}>{productId}</Typography.Link>
<Typography.Text>{data.productName}</Typography.Text>
</Space>
)
......
import deepClone from 'clone'
import moment from 'moment';
import { ISchema } from '@formily/antd';
import { GlobalConfig } from '@/global/config';
function isArray(arr: any) {
return Array.isArray(arr)
......@@ -365,49 +364,6 @@ export const coverColFiltersItem = (
}
};
export const getDefaultEnterprise = () => {
const shopInfo = GlobalConfig.web.shopInfo
const webMallList = shopInfo.filter((item: { environment: number; type: number }) => item.environment === 1 && item.type === 1)
const defaultMall = webMallList.filter((item) => item.isDefault === 1)[0]
let result: any = undefined
if (defaultMall) {
result = defaultMall
} else {
if (webMallList && webMallList.length > 0) {
result = webMallList[0]
}
}
return result
}
export const getChannelInfo = () => {
const shopInfo = GlobalConfig.web.shopInfo
const webMallList = shopInfo.filter((item: { environment: number; type: number }) => item.environment === 1 && item.type === 3)
return webMallList[0]
}
export const getIChannelInfo = () => {
const shopInfo = GlobalConfig.web.shopInfo
const webMallList = shopInfo.filter((item: { environment: number; type: number }) => item.environment === 1 && item.type === 4)
return webMallList[0]
}
/**
* 根据host获取当前一级域名
* @param url 链接
* @returns
*/
export const getTopDomainByHost = (url: string, isPort = false): string => {
if (!url) return ''
// 如果后缀带有端口号, 可通过第二个参数把端口去掉
const splitUrl = url.replace(/(http|https)\:\/\//, '').split(':')
if (splitUrl.length > 1 && isPort) {
return `${splitUrl[0].split('.').slice(-2).join('.')}`
}
return url.split('.').slice(-2).join('.')
}
export default {
isArray,
isObject,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment