Commit dd7c9740 authored by GuanHua's avatar GuanHua

feat:企业商城名称的显示和店铺渠道商城商品链接跳转

parent db6c73cf
......@@ -41,7 +41,7 @@
"copy-to-clipboard": "^3.3.1",
"god": "^0.1.27",
"lingxi-design": "^1.0.7",
"lingxi-design-ui": "^1.1.2",
"lingxi-design-ui": "^1.1.3",
"lingxi-editor-core": "^1.0.6",
"lingxi-web": "^1.0.6",
"lint-staged": "^10.0.7",
......
......@@ -33,14 +33,22 @@
}
.shop_url {
width: 572px;
color: #6B778C;
margin-top: 16px;
font-size: 14px;
display: flex;
&>label {
flex: 1;
width: 0;
display: block;
color: #172B4D;
margin-left: 8px;
margin-right: 15px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.copy_icon {
......
......@@ -209,21 +209,42 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
}
const handleMallSelectChange = (mallId: number) => {
let selectItem = allMallList.filter(item => item.id === mallId)
// let selectItem = allMallList.filter(item => item.id === mallId)
setShopId(mallId)
if (mallId) {
setStoreUrl(`${siteUrl}/channelmall?id=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
// setStoreUrl(`${siteUrl}/${selectItem[0].url}?id=${1}`)
if (shopInfo.shopId && shopInfo.memberId) {
getMallItemAndSetUrl(mallId)
} else {
setStoreUrl(null)
}
}
const getMallItemAndSetUrl = (mallId) => {
let mallItem = allMallList.filter(item => item.id === mallId)[0]
if (mallItem.environment === 1) {
switch (mallItem.type) {
case 3:
setStoreUrl(`${siteUrl}/channelmall?id=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
break
case 4:
setStoreUrl(`${siteUrl}/channelmall?id=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
break
case 5:
setStoreUrl(`${siteUrl}/channelmall/pointsMall?id=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
break
default:
setStoreUrl(null)
break
}
} else {
setStoreUrl(null)
}
}
const handleFormValueChange = () => {
console.log('handleFormValueChange')
setFormIsHalfFilledOut(true)
}
return (
<PageHeaderWrapper>
<Prompt when={formIsHalfFilledOut} message="您还有未保存的内容,是否确定要离开?" />
......
......@@ -106,12 +106,20 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
let categoryDetail: any = await fetchCategoryById(item.id)
result.push(
<ShopFloorLine
linkUrl={`/channelmall/commodity?id=${shopUrlParam}&categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
anchor={`floorline_${item.id}`}
key={item.id}
title={item.name}
>
<ShopFloorLine.Category categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl} categoryList={categoryDetail.categoryBOList} />
<ShopFloorLine.Goods goodsList={categoryDetail.goodsBOList} />
<ShopFloorLine.Category
categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl}
categoryList={categoryDetail.categoryBOList}
linkUrl={`/channelmall/commodity?id=${shopUrlParam}`}
/>
<ShopFloorLine.Goods
goodsList={categoryDetail.goodsBOList}
linkUrl={`/channelmall/commodity/detail?id=${shopUrlParam}`}
/>
</ShopFloorLine>
)
}
......
......@@ -60,15 +60,10 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
const [filterConfig, setFilterConfig] = useState([FILTER_TYPE.categoryAndAttr, FILTER_TYPE.brand, FILTER_TYPE.price, FILTER_TYPE.useArea, FILTER_TYPE.commodityType])
useEffect(() => {
setCurrent(1)
fetchCommodityList()
fetchCommodityList(1)
}, [filterParam])
useEffect(() => {
fetchCommodityList()
}, [current])
useEffect(() => {
if (categoryId && categoryName) {
onFilter({
key: [categoryId],
......@@ -102,9 +97,9 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
})
}, [layoutType])
const fetchCommodityList = () => {
const fetchCommodityList = (currentParam?: number) => {
let param: filterQuery = {
current,
current: currentParam ? currentParam : current,
pageSize
}
......@@ -130,6 +125,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
getFn(param).then(res => {
setLoading(false)
if (res.code === 1000) {
console.log(res.data.data)
setCommodityList(res.data.data)
setTotalCount(res.data.totalCount)
}
......@@ -153,6 +149,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
const handlePageChange = (page) => {
setCurrent(page)
fetchCommodityList(page)
}
/**
......
......@@ -3,15 +3,15 @@ import cx from 'classnames'
import { Input } from 'antd'
import { history } from 'umi'
import { FileTextOutlined } from '@ant-design/icons'
import { GlobalConfig } from '@/global/config'
import isEmpty from 'lodash/isEmpty'
import styles from './index.less'
interface HeaderPropsType {
logo: string,
}
const Header: React.FC<HeaderPropsType> = (props) => {
const { logo } = props
const [searchType, setSearchType] = useState<number>(1) // 1:商品; 2:店铺
const [searchValue, setSearchValue] = useState<string>("")
const { search } = history.location.query
......@@ -50,7 +50,7 @@ const Header: React.FC<HeaderPropsType> = (props) => {
<div className={styles.header}>
<div className={styles.header_container}>
<div className={styles.logo}>
<img src={GlobalConfig.global.logo} />
<img src={logo} />
</div>
<div className={styles.mall_search}>
<div className={styles.mall_search_tags}>
......
......@@ -7,9 +7,11 @@ import styles from './index.less'
interface QuickNavPropsType {
UserStore?: any;
name?: string
}
const QuickNav: React.FC<QuickNavPropsType> = (props) => {
const { name } = props
const { userInfo } = props.UserStore
const [tabType, setTabType] = useState<number>(1) // 1; 卖家服务;2:买家服务
......@@ -85,7 +87,7 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
<div className={styles.member_no_login}>
<div className={styles.welcome}>
<div className={styles.welcome_avatar}>Hi</div>
<span className={styles.welcome_text}>Hi,欢迎来到XX商城</span>
<span className={styles.welcome_text}>Hi,欢迎来到{name}</span>
</div>
{
!userInfo && (
......
......@@ -7,17 +7,18 @@ import styles from './index.less'
interface TopBarPropsType {
langComponent?: React.ReactNode;
UserStore?: any;
name?: string;
}
const TopBar: React.FC<TopBarPropsType> = (props) => {
const { langComponent } = props
const { langComponent, name } = props
const { userInfo } = props.UserStore
return (
<div className={styles.topbar}>
<div className={styles.topbar_container}>
<ul className={cx(styles.topbar_menu, styles.left)}>
<li className={cx(styles.topbar_menu_item, styles.pad_left_0)}>
<span>XX商城欢迎你!</span>
<span>{name}欢迎你!</span>
</li>
<li className={styles.topbar_menu_item}>
<EnvironmentOutlined className={styles.icon} />
......@@ -46,7 +47,7 @@ const TopBar: React.FC<TopBarPropsType> = (props) => {
</li>
<li className={styles.topbar_menu_item}>我的消息</li>
<li className={styles.topbar_menu_item}>
<a href="http://p.qiao.baidu.com/cps/chat?siteId=11220066&userId=24534830&siteToken=49f62d4365e46c0f2c81538e4d168ab9" target="_blank">客户服务</a>
客户服务
</li>
{
langComponent && (<li className={cx(styles.topbar_menu_item, styles.nopad)}>{langComponent}</li>)
......
......@@ -12,10 +12,12 @@ import { LAYOUT_TYPE } from '@/constants'
import styles from './index.less'
interface MallIndexPropsType {
SiteStore?: any
SiteStore?: any;
mallInfo: any
}
const MallIndex: React.FC<MallIndexPropsType> = (props) => {
const { mallInfo } = props
const [categoryList, setCategoryList] = useState<GetTemplatePlatformFindAllFirstCategoryResponse>([])
const { mallTemplateId } = props.SiteStore
const [firstAdvertList, setFirstAdvertList] = useState([])
......@@ -135,7 +137,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
return (
<div className={styles.mall_index}>
{
useMemo(() => <Advert type="banner" advertList={firstAdvertList} hasQuickNav={true} ><QuickNav /></Advert>, [firstAdvertList])
useMemo(() => <Advert type="banner" advertList={firstAdvertList} hasQuickNav={true} ><QuickNav name={mallInfo.name} /></Advert>, [firstAdvertList])
}
<FloorAnchor anchorList={categoryList} type="mall" />
{
......
......@@ -7,6 +7,7 @@ import SelectLang from '@/layouts/components/SelectLang'
import { useIntl } from 'umi'
import { inject, observer } from 'mobx-react'
import { LAYOUT_TYPE } from '@/constants'
import { GlobalConfig } from '@/global/config'
import TopBar from '../components/TopBar'
import Header from '../components/Header'
import MainNav from '../components/MainNav'
......@@ -28,13 +29,13 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const { children, location } = props
const [templateName] = useState<string>('theme-mall-science')
const { siteId, mallTemplateInfo, findUseMallTemplate } = props.SiteStore
const [mallInfo, setMallInfo] = useState<any>({})
const getMenuRouter = (routes: any, pathname: any) => {
let list = routes.filter((item: any) => pathname.indexOf(item.key) > -1)
return list[0] || {}
}
const { formatMessage } = useIntl();
const basicInfo = getMenuData(props.route.routes, { locale: true }, formatMessage)
const menuData = basicInfo.menuData ? basicInfo.menuData.filter(item => !item.redirect) : []
......@@ -44,8 +45,16 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
if (isEmpty(mallTemplateInfo)) {
findUseMallTemplate()
}
getWebMallInfo()
}, [])
const getWebMallInfo = () => {
const shopInfo = GlobalConfig.web.shopInfo
let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0]
console.log(webMallInfo, "webMallInfo")
setMallInfo(webMallInfo)
}
useEffect(() => {
if (!isEmpty(mallTemplateInfo)) {
let body = document.getElementsByTagName('body')[0];
......@@ -55,12 +64,12 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
return (
<div className={styles.lxmall_page}>
<TopBar langComponent={<SelectLang />} />
<TopBar langComponent={<SelectLang />} name={mallInfo.name} />
<div className={styles.content}>
{
!menuRouter?.hideHeader && (
<>
<Header />
<Header logo={mallInfo.logoUrl} />
<MainNav menuData={menuData} pathname={location.pathname} type={LAYOUT_TYPE.mall} />
</>
)
......@@ -70,6 +79,7 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
return React.cloneElement(child,
{
layoutType: LAYOUT_TYPE.mall,
mallInfo: mallInfo
},
);
})
......
......@@ -13,6 +13,7 @@ import Footer from '../components/Footer'
import { PublicApi } from '@/services/api'
import { GetTemplateShopFindShopResponse } from '@/services/TemplateApi'
import { LAYOUT_TYPE } from '@/constants'
import { GlobalConfig } from '@/global/config'
import styles from './index.less'
interface LXMallLayoutPropsType {
......@@ -36,13 +37,22 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const { shopId } = location.query
const [shopInfo, setShopInfo] = useState<GetTemplateShopFindShopResponse>()
const [query, setQuery] = useState<any>({})
const [mallInfo, setMallInfo] = useState<any>({})
useEffect(() => {
let queryParam = shopId ? atob(shopId) : undefined
queryParam = queryParam ? JSON.parse(queryParam) : {}
setQuery(queryParam)
getWebMallInfo()
}, [])
const getWebMallInfo = () => {
const shopInfo = GlobalConfig.web.shopInfo
let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0]
setMallInfo(webMallInfo)
}
useEffect(() => {
if (query.memberId) {
fetchShopInfo(query.memberId)
......@@ -71,7 +81,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
return (
<div className={styles.lxmall_page}>
<TopBar />
<TopBar name={mallInfo.name} />
<div className={styles.content}>
<ShopHeader shopId={query.shopId} shopUrlParam={shopId} shopInfo={shopInfo} />
<MainNav menuData={menuData} pathname={location.pathname} type={LAYOUT_TYPE.shop} shopId={query.shopId} shopUrlParam={shopId} />
......
......@@ -108,11 +108,16 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
result.push(
<ShopFloorLine
anchor={`floorline_${item.id}`}
linkUrl={`/shop/commodity?shopId=${shopUrlParam}&categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
key={item.id}
title={item.name}
>
<ShopFloorLine.Category categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl} categoryList={categoryDetail.categoryBOList} />
<ShopFloorLine.Goods goodsList={categoryDetail.goodsBOList} />
<ShopFloorLine.Category
categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl}
categoryList={categoryDetail.categoryBOList}
linkUrl={`/shop/commodity?shopId=${shopUrlParam}`}
/>
<ShopFloorLine.Goods goodsList={categoryDetail.goodsBOList} linkUrl={`/shop/commodity/detail?shopId=${shopUrlParam}`} />
</ShopFloorLine>
)
}
......
......@@ -33,14 +33,22 @@
}
.shop_url {
width: 572px;
color: #6B778C;
margin-top: 16px;
font-size: 14px;
display: flex;
&>label {
flex: 1;
width: 0;
display: block;
color: #172B4D;
margin-left: 8px;
margin-right: 15px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.copy_icon {
......
......@@ -37,10 +37,6 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const [shopId, setShopId] = useState<number>()
useEffect(() => {
console.log(selectCityData, "selectCityData")
}, [selectCityData])
useEffect(() => {
fetchShopInfo()
fetchAllShop()
}, [])
......@@ -68,7 +64,9 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
setShopId(data.shopId)
setWorkshopPics(data.workshopPics || [])
setHonorPics(data.honorPics || [])
setStoreUrl(data.storeUrl || "")
if (data.shopId && data.memberId) {
setStoreUrl(data.storeUrl || "")
}
form.setFieldsValue({
describe: data.describe,
customerUrl: data.customerUrl,
......@@ -209,17 +207,35 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
}
const handleMallSelectChange = (mallId: number) => {
let selectItem = allMallList.filter(item => item.id === mallId)
// let selectItem = allMallList.filter(item => item.id === mallId)
setShopId(mallId)
if (mallId) {
setStoreUrl(`${siteUrl}/shop?shopId=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
if (shopInfo.shopId && shopInfo.memberId) {
getMallItemAndSetUrl(mallId)
} else {
setStoreUrl(null)
}
}
const getMallItemAndSetUrl = (mallId) => {
let mallItem = allMallList.filter(item => item.id === mallId)[0]
if (mallItem.environment === 1) {
switch (mallItem.type) {
case 1:
setStoreUrl(`${siteUrl}/shop?shopId=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
break
case 2:
setStoreUrl(`${siteUrl}/shop/pointsMall?shopId=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
break
default:
setStoreUrl(null)
break
}
} else {
setStoreUrl(null)
}
}
const handleFormValueChange = () => {
console.log('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