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

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

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