Commit 28ffaa12 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

🐞 fix(): 修改门户链接显示

parent 47217bb9
......@@ -28,6 +28,8 @@ const defaultCityData = { index: 0, provinceCode: 0, province: '', cityCode: 0,
const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
const { siteUrl, siteId } = props.SiteStore
const [door, setDoor] = useState<string>('');
const [resUrl, setResUrl] = useState<string>('');
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [formIsHalfFilledOut, setFormIsHalfFilledOut] = useState(false)
const [form] = Form.useForm()
......@@ -78,7 +80,7 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
const fetchAllShop = () => {
const param: any = {
siteId,
type: 2
type: 3
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
if (res.code === 1000) {
......@@ -265,68 +267,26 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
})
}
const handleMallSelectChange = (mallId: number) => {
setShopId(mallId)
if (!shopInfo) {
return
}
if (shopInfo.shopId && shopInfo.memberId) {
const resUrl = getMallItemAndSetUrl(mallId)
setStoreUrl(resUrl)
} else {
setStoreUrl(null)
}
const handleFormValueChange = () => {
setFormIsHalfFilledOut(true)
}
const getMallItemAndSetUrl = (mallId) => {
let result = ""
const mallItem = allMallList.filter(item => item.id === mallId)[0]
if (!mallItem) {
return ""
}
let newSiteUrl = siteUrl
if (newSiteUrl.indexOf('http') < 0) {
newSiteUrl = `${REQUEST_HEADER}${newSiteUrl}`
}
if (mallItem.environment === 1) {
switch (mallItem.type) {
case 3:
result = `${REQUEST_HEADER}${GlobalConfig.channelRootRoute}.${TOP_DOMAIN}/m${shopInfo.memberId}`
break
case 4:
result = `${REQUEST_HEADER}${GlobalConfig.ichannelRootRoute}.${TOP_DOMAIN}/m${shopInfo.memberId}`
break
default:
result = ""
break
/** 获取店铺链接 */
const checkUrl = (url) => {
if (url && typeof url === 'string') {
if (url.indexOf('/') === 0) {
return url.replace('/', '').trim()
} else {
return `${url}`.trim()
}
} else {
result = ""
}
return result
}
const handleFormValueChange = () => {
setFormIsHalfFilledOut(true)
}
const getSelectMallStoreUrl = () => {
if (!shopInfo) {
return null
}
if (shopId && shopInfo.memberId) {
const resUrl = getMallItemAndSetUrl(shopId)
return resUrl ? (
<div className={styles.shop_url}>
<span>当前商城链接:</span>
<label title={resUrl}>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
) : null
const handleMallSelectChange = (val, option) => {
setDoor(option.children);
if (option.url) {
checkUrl(option.url) ? setResUrl(`${checkUrl(option.url)}.${siteUrl}`) : setResUrl(`${siteUrl}`)
}
return null
}
return (
......@@ -442,7 +402,7 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
{Object.keys(file).length > 0 && (
<div className={styles.upload_item}>
<div className={styles.upload_left}>
<LinkOutlined style={{ marginRight: '5px'}} />
<LinkOutlined style={{ marginRight: '5px' }} />
<Typography.Link
href={`/api/contract/contractTemplate/downloadContract?contractName=${file.albumName}&contractUrl=${file.albumURL}`}
target="_blank"
......@@ -482,9 +442,13 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
))
}
</Select>
{
getSelectMallStoreUrl()
}
{resUrl && (
<div className={styles.shop_url}>
<span>当前{door}链接:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
)}
</Form.Item>
<Form.Item
label={<RequireItem label="" />}
......
......@@ -30,6 +30,8 @@ const defaultCategoryData = { index: 0, firstId: 0, secondId: 0, thirdlyId: 0, f
const HandlingInfo: React.FC<HandlingInfoPropsType> = (props) => {
const { siteUrl, siteId } = props.SiteStore
const [door, setDoor] = useState<string>('');
const [resUrl, setResUrl] = useState<string>('');
const [formIsHalfFilledOut, setFormIsHalfFilledOut] = useState(false)
const [form] = Form.useForm()
const [allMallList, setAllMallList] = useState([])
......@@ -80,7 +82,7 @@ const HandlingInfo: React.FC<HandlingInfoPropsType> = (props) => {
const fetchAllShop = () => {
const param: any = {
siteId,
type: 1
type: 8
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
if (res.code === 1000) {
......@@ -365,64 +367,26 @@ const HandlingInfo: React.FC<HandlingInfoPropsType> = (props) => {
})
}
const handleMallSelectChange = (mallId: number) => {
setShopId(mallId)
if (!shopInfo) {
return null
}
if (shopInfo.shopId && shopInfo.memberId) {
const resUrl = getMallItemAndSetUrl(mallId)
}
const handleFormValueChange = () => {
setFormIsHalfFilledOut(true)
}
const getMallItemAndSetUrl = (mallId) => {
let result = ""
const mallItem = allMallList.filter(item => item.id === mallId)[0]
if (!mallItem) {
return ""
}
if (mallItem.environment === 1) {
let newSiteUrl = siteUrl
if (newSiteUrl.indexOf('http') < 0) {
newSiteUrl = `http://` + newSiteUrl
}
switch (mallItem.type) {
case 1:
result = `${newSiteUrl}/shop?shopId=${btoa(JSON.stringify({ shopId: shopInfo.id, memberId: shopInfo.memberId, roleId: shopInfo.roleId }))}`
break
case 2:
result = `${newSiteUrl}/shop/pointsMall?shopId=${btoa(JSON.stringify({ shopId: shopInfo.id, memberId: shopInfo.memberId, roleId: shopInfo.roleId }))}`
break
default:
result = ""
break
/** 获取店铺链接 */
const checkUrl = (url) => {
if (url && typeof url === 'string') {
if (url.indexOf('/') === 0) {
return url.replace('/', '').trim()
} else {
return `${url}`.trim()
}
} else {
result = ""
}
return result
}
const handleFormValueChange = () => {
setFormIsHalfFilledOut(true)
}
const getSelectMallStoreUrl = () => {
if (!shopInfo) {
return null
}
if (shopId && shopInfo.memberId) {
const resUrl = getMallItemAndSetUrl(shopId)
return resUrl ? (
<div className={styles.shop_url}>
<span>当前店铺链接:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
) : null
const handleMallSelectChange = (val, option) => {
setDoor(option.children);
if (option.url) {
checkUrl(option.url) ? setResUrl(`${checkUrl(option.url)}.${siteUrl}`) : setResUrl(`${siteUrl}`)
}
return null
}
return (
......@@ -638,9 +602,13 @@ const HandlingInfo: React.FC<HandlingInfoPropsType> = (props) => {
))
}
</Select>
{
getSelectMallStoreUrl()
}
{resUrl && (
<div className={styles.shop_url}>
<span>当前{door}链接:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
)}
</Form.Item>
</TabPane>
<TabPane tab='SEO' key='2' forceRender>
......
......@@ -82,7 +82,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
const fetchAllShop = () => {
const param: any = {
siteId,
type: 1
type: 7
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
if (res.code === 1000) {
......@@ -352,66 +352,7 @@ const LogisticsInfo: React.FC<LogisticsInfoPropsType> = (props) => {
slideshowBOList: result
})
}
/**
const handleMallSelectChange = (mallId: number) => {
setShopId(mallId)
if (!shopInfo) {
return null
}
if (shopInfo.shopId && shopInfo.memberId) {
const resUrl = getMallItemAndSetUrl(mallId)
setStoreUrl(resUrl)
} else {
setStoreUrl(null)
}
}
const getMallItemAndSetUrl = (mallId) => {
let result = ""
const mallItem = allMallList.filter(item => item.id === mallId)[0]
if (!mallItem) {
return ""
}
if (mallItem.environment === 1) {
let newSiteUrl = siteUrl
if (newSiteUrl.indexOf('http') < 0) {
newSiteUrl = `http://` + newSiteUrl
}
switch (mallItem.type) {
case 1:
result = `${newSiteUrl}/shop?shopId=${btoa(JSON.stringify({ shopId: shopInfo.id, memberId: shopInfo.memberId, roleId: shopInfo.roleId }))}`
break
case 2:
result = `${newSiteUrl}/shop/pointsMall?shopId=${btoa(JSON.stringify({ shopId: shopInfo.id, memberId: shopInfo.memberId, roleId: shopInfo.roleId }))}`
break
default:
result = ""
break
}
} else {
result = ""
}
return result
}
const getSelectMallStoreUrl = () => {
if (!shopInfo) {
return null
}
if (shopId && shopInfo.memberId) {
const resUrl = getMallItemAndSetUrl(shopId)
return resUrl ? (
<div className={styles.shop_url}>
<span>当前店铺链接:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
) : null
}
return null
}
*/
const handleFormValueChange = () => {
setFormIsHalfFilledOut(true)
}
......
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