Commit 1a3a0dea authored by 前端-许佳敏's avatar 前端-许佳敏
parents a175f7f2 7f14904a
......@@ -41,29 +41,29 @@ const shopRoute = {
key: 'shopPointsMall',
component: '@/pages/lxMall/pointsMall',
},
{
// 资讯
path: `/shop/infomation`,
name: 'shopInfomation',
key: 'shopInfomation',
component: '@/pages/lxMall/information',
},
{
// 资讯详情
path: '/shop/infomation/detail',
name: 'infomationDetail',
key: 'infomationDetail',
hide: true,
component: '@/pages/lxMall/information/detail',
},
{
// 资讯详情搜索
path: '/shop/infomation/search',
name: 'infomationSearch',
key: 'infomationSearch',
hide: true,
component: '@/pages/lxMall/information/search',
},
// {
// // 资讯
// path: `/shop/infomation`,
// name: 'shopInfomation',
// key: 'shopInfomation',
// component: '@/pages/lxMall/information',
// },
// {
// // 资讯详情
// path: '/shop/infomation/detail',
// name: 'infomationDetail',
// key: 'infomationDetail',
// hide: true,
// component: '@/pages/lxMall/information/detail',
// },
// {
// // 资讯详情搜索
// path: '/shop/infomation/search',
// name: 'infomationSearch',
// key: 'infomationSearch',
// hide: true,
// component: '@/pages/lxMall/information/search',
// },
{
// 关于我们
path: `/shop/about`,
......
......@@ -118,6 +118,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
}
setLoading(true)
let getFn;
let headers = {}
switch (layoutType) {
case LAYOUT_TYPE.mall:
getFn = PublicApi.getSearchShopEnterpriseGetCommodityList
......@@ -128,16 +129,22 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
break
case LAYOUT_TYPE.channel:
param.channelMemberId = memberId
headers = {
type: 3
}
getFn = PublicApi.getSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
param.channelMemberId = memberId
headers = {
type: 4
}
getFn = PublicApi.getSearchShopChannelGetCommodityList
break
}
//@ts-ignore
getFn && getFn(param).then(res => {
getFn && getFn(param, { headers }).then(res => {
setLoading(false)
if (res.code === 1000) {
setCommodityList(res.data.data)
......
......@@ -85,13 +85,28 @@ const CommodityDetail = (props) => {
let params: any = {
commodityId: id
}
if (layoutType === LAYOUT_TYPE.channel) {
let headers = {}
switch (layoutType) {
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
params.channelMemberId = memberId
getDetailFn = PublicApi.getSearchShopChannelGetCommodityDetail
} else {
break
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
params.channelMemberId = memberId
getDetailFn = PublicApi.getSearchShopChannelGetCommodityDetail
break
default:
getDetailFn = PublicApi.getSearchShopStoreGetCommodityDetail
break
}
getDetailFn(params).then(res => {
getDetailFn && getDetailFn(params, { headers }).then(res => {
if (res.code === 1000) {
// res.data.priceType = 3
setCommodityDetail(res.data)
......
......@@ -26,6 +26,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
useEffect(() => {
let getCategoryFn
let params: any = {}
let headers = {}
switch (type) {
case LAYOUT_TYPE.mall:
if (mallTemplateId) {
......@@ -42,11 +43,23 @@ const Category: React.FC<CategoryPropsType> = (props) => {
}
break
case LAYOUT_TYPE.channel:
if (memberId) {
headers = {
type: 3
}
params.channelMemberId = memberId
getCategoryFn = PublicApi.getSearchShopChannelGetCustomerCategoryTree
fetchCategoryList(getCategoryFn, params, type, { headers })
}
break
case LAYOUT_TYPE.ichannel:
if (memberId) {
headers = {
type: 4
}
params.channelMemberId = memberId
getCategoryFn = PublicApi.getSearchShopChannelGetCustomerCategoryTree
fetchCategoryList(getCategoryFn, params, type)
fetchCategoryList(getCategoryFn, params, type, { headers })
}
break
default:
......
......@@ -21,6 +21,7 @@ const Brand: React.FC<BrandPropsType> = (props) => {
useEffect(() => {
let getBrandFn
let param: any = {}
let headers = {}
switch (layoutType) {
case LAYOUT_TYPE.mall:
getBrandFn = PublicApi.getSearchShopEnterpriseGetBrand
......@@ -30,15 +31,28 @@ const Brand: React.FC<BrandPropsType> = (props) => {
getBrandFn = PublicApi.getSearchShopStoreGetBrand
break
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
param.channelMemberId = memberId
getBrandFn = PublicApi.getSearchShopChannelGetBrand
break
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
param.channelMemberId = memberId
getBrandFn = PublicApi.getSearchShopChannelGetBrand
break
case LAYOUT_TYPE.channelScoreMall:
headers = {
type: 5
}
param.channelMemberId = memberId
getBrandFn = PublicApi.getSearchShopChannelGetBrand
break
}
getBrandFn && getBrandFn(param).then((res) => {
getBrandFn && getBrandFn(param, { headers }).then((res) => {
if (res.code === 1000) {
setBrandList(res.data)
}
......
......@@ -47,6 +47,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
useEffect(() => {
let getCategoryListFn
let param: any = {}
let headers = {}
/**
* 根据不通过的页面类型,请求不同的品类接口
*/
......@@ -59,6 +60,23 @@ const Category: React.FC<CategoryPropsType> = (props) => {
getCategoryListFn = PublicApi.getSearchShopStoreGetCustomerCategoryTree
break
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
param.channelMemberId = memberId
getCategoryListFn = PublicApi.getSearchShopChannelGetCustomerCategoryTree
break
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
param.channelMemberId = memberId
getCategoryListFn = PublicApi.getSearchShopChannelGetCustomerCategoryTree
break
case LAYOUT_TYPE.channelScoreMall:
headers = {
type: 5
}
param.channelMemberId = memberId
getCategoryListFn = PublicApi.getSearchShopChannelGetCustomerCategoryTree
break
......@@ -74,7 +92,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
default:
break
}
getCategoryListFn && getCategoryListFn(param).then((res) => {
getCategoryListFn && getCategoryListFn(param, { headers }).then((res) => {
if (res.code === 1000) {
setCategoryList(initTreeData(res.data))
}
......
......@@ -66,6 +66,7 @@ const UseArea: React.FC<UseAreaPropsType> = (props) => {
useEffect(() => {
let getAreaFn
let param: any = {}
let headers = {}
switch (layoutType) {
case LAYOUT_TYPE.mall:
case LAYOUT_TYPE.shopList:
......@@ -76,15 +77,28 @@ const UseArea: React.FC<UseAreaPropsType> = (props) => {
getAreaFn = PublicApi.getSearchShopStoreGetArea
break
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
param.channelMemberId = memberId
getAreaFn = PublicApi.getSearchShopChannelGetArea
break
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
param.channelMemberId = memberId
getAreaFn = PublicApi.getSearchShopChannelGetArea
break
case LAYOUT_TYPE.channelScoreMall:
headers = {
type: 5
}
param.channelMemberId = memberId
getAreaFn = PublicApi.getSearchShopChannelGetArea
break
}
getAreaFn && getAreaFn(param).then((res) => {
getAreaFn && getAreaFn(param, { headers }).then((res) => {
if (res.code === 1000) {
setAreaList(initAreaData(res.data))
}
......
......@@ -56,15 +56,14 @@ const ShopHeader: React.FC<ShopHeaderPropsType> = (props) => {
<div className={styles.shop_header_info_content_about}>
<div className={styles.shop_header_info_content_about_item}>
<i className={styles.icon}><img src={shop_icon} /></i>
<span className={styles.red}>2</span>
<span className={styles.red}>{shopInfo?.registerYears}</span>
<span></span>
</div>
<div className={styles.shop_header_info_content_about_item}>
<i className={styles.icon}><img src={credit_icon} /></i>
<span>1288</span>
<span>{200}</span>
</div>
</div>
</div>
<div className={styles.shop_info}>
<div className={styles.shop_info_title}>
......@@ -75,19 +74,19 @@ const ShopHeader: React.FC<ShopHeaderPropsType> = (props) => {
<div className={styles.shop_info_list}>
<div className={styles.shop_info_list_item}>
<div className={styles.label}>满意度:</div>
<div className={styles.breif}><Rate className="star" count={4} disabled defaultValue={4} /></div>
<div className={styles.breif}><Rate className={styles.star} count={4} disabled defaultValue={4} /></div>
</div>
<div className={styles.shop_info_list_item}>
<div className={styles.label}>注册资本:</div>
<div className={styles.breif}>5000万元</div>
<div className={styles.breif}>1000万元</div>
</div>
<div className={styles.shop_info_list_item}>
<div className={styles.label}>成立日期:</div>
<div className={styles.breif}>2014-09-09</div>
<div className={styles.breif}>2020-09-01</div>
</div>
<div className={styles.shop_info_list_item}>
<div className={styles.label}>营业执照:</div>
<div className={styles.breif}><span className="certified">[已认证]</span></div>
<div className={styles.breif}><span className="certified">{shopInfo?.outerStatus === 3 ? '[已认证]' : '[未认证]'}</span></div>
</div>
</div>
<div className={styles.dashed_split}></div>
......
import React from 'react'
import React, { useState, useEffect } from 'react'
import cx from 'classnames'
import informationImg2 from '@/assets/imgs/information_2.png'
import ImageBox from '@/components/ImageBox'
import { PublicApi } from '@/services/api'
import {
GetManageContentInformationFindAllByRecommendLabelResponse,
GetManageContentLabelHotResponse
} from '@/services/PassApi'
import styles from './index.less'
const TAG_LIST = [
......@@ -49,6 +54,64 @@ const TAG_LIST = [
const InformationRight: React.FC = () => {
const [leadNews, setLeadNews] = useState<GetManageContentInformationFindAllByRecommendLabelResponse[]>([]) // 头条新闻
const [recommendNews, setRecommendNews] = useState<GetManageContentInformationFindAllByRecommendLabelResponse[]>([]) // 推荐新闻
const [hotLabel, setHotLabel] = useState<GetManageContentLabelHotResponse>([]) // 热门标签
useEffect(() => {
Promise.all([fetchLeadNews(), fetchRecommomendNews()])
}, [])
/**
* 获取头条新闻
*/
const fetchLeadNews = async () => {
try {
let data: any = await fetchNewByLabel(1)
data && setLeadNews(data)
} catch (error) {
console.log(error)
}
}
/**
* 获取推荐新闻
*/
const fetchRecommomendNews = async () => {
try {
let data: any = await fetchNewByLabel(4)
data && setRecommendNews(data)
} catch (error) {
console.log(error)
}
}
/**
* 获取热门标签
*/
const fetchHotLabl = () => {
PublicApi.getManageContentLabelHot().then(res => {
if (res.code === 1000) {
setHotLabel(res.data)
}
})
}
const fetchNewByLabel = (label) => {
// 1-头条文章 2-轮播新闻 3-图片新闻 4-推荐阅读
return new Promise((resolve, reject) => {
PublicApi.getManageContentInformationFindAllByRecommendLabel({ recommendLabel: label }).then(res => {
if (res.code === 1000) {
resolve(res.data)
} else {
reject()
}
}).catch(() => {
reject()
})
})
}
return (
<div className={styles.information_right}>
<div className={styles.information_title}>
......
import React, { Fragment } from 'react'
import React, { useState, useEffect } from 'react'
import cx from 'classnames'
import { Carousel, Pagination } from 'antd'
import { Link } from 'umi'
......@@ -8,106 +8,128 @@ import informationImg2 from '@/assets/imgs/information_2.png'
import ImageBox from '@/components/ImageBox'
import BreadCrumbs from './components/breadCrumbs'
import InformationRight from './components/informationRight'
import { PublicApi } from '@/services/api'
import {
GetManageContentInformationPageResponseDetail,
GetManageContentInformationFindAllByRecommendLabelResponse,
GetManageContentColumnAllResponse,
GetManageContentLabelHotResponse
} from '@/services/PassApi'
import styles from './index.less'
interface InformationPropsType {
interface InformationPropsType { }
}
const Information: React.FC<InformationPropsType> = (props) => {
const [carouselNews, setCarouselNews] = useState<GetManageContentInformationFindAllByRecommendLabelResponse[]>([]) // 轮播新闻
const [photoNews, setPhotoNews] = useState<GetManageContentInformationFindAllByRecommendLabelResponse[]>([]) // 图片新闻
const [allColumn, setAllColumn] = useState<GetManageContentColumnAllResponse>([]) // 所有栏目
const [newsList, setNewsList] = useState<GetManageContentInformationPageResponseDetail[]>([]) // 资讯列表
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [showColumnId, setShowColumnId] = useState<number>()
const [totalCount, setTotalCount] = useState<number>(0)
const MockList = [
{
id: new Date().getTime() + 1,
title: '今日热点',
list: [
{
id: new Date().getTime() + 11
},
{
id: new Date().getTime() + 12
},
{
id: new Date().getTime() + 13
},
{
id: new Date().getTime() + 14
},
]
},
{
id: new Date().getTime() + 2,
title: '今日热点',
list: [
{
id: new Date().getTime() + 21
},
{
id: new Date().getTime() + 22
},
{
id: new Date().getTime() + 23
},
{
id: new Date().getTime() + 24
},
]
},
{
id: new Date().getTime() + 3,
title: '行业头条',
list: [
{
id: new Date().getTime() + 31
},
{
id: new Date().getTime() + 32
},
{
id: new Date().getTime() + 33
},
{
id: new Date().getTime() + 34
},
]
},
{
id: new Date().getTime() + 4,
title: '专题报道',
list: [
{
id: new Date().getTime() + 41
},
{
id: new Date().getTime() + 42
},
{
id: new Date().getTime() + 43
},
{
id: new Date().getTime() + 44
},
]
},
{
id: new Date().getTime() + 5,
title: '政策法规',
list: [
{
id: new Date().getTime() + 51
},
{
id: new Date().getTime() + 52
},
{
id: new Date().getTime() + 53
},
{
id: new Date().getTime() + 54
},
]
},
]
useEffect(() => {
Promise.all([fetchCarouselNews(), fetchPhotoNews()])
setCurrent(1)
fetchAllColumn(true)
}, [])
const Information: React.FC<InformationPropsType> = (props) => {
/**
* 获取轮播新闻
*/
const fetchCarouselNews = async () => {
try {
let data: any = await fetchNewByLabel(2)
data && setCarouselNews(data)
} catch (error) {
console.log(error)
}
}
/**
* 获取图片新闻
*/
const fetchPhotoNews = async () => {
try {
let data: any = await fetchNewByLabel(3)
data && setPhotoNews(data)
} catch (error) {
console.log(error)
}
}
/**
* 获取所有栏目
*/
const fetchAllColumn = (state: boolean = false) => {
PublicApi.getManageContentColumnAll().then(res => {
if (res.code === 1000) {
setAllColumn(res.data)
// 是否获取第一个栏目的新闻
if (state) {
let firstColumn = res.data[0]
if (firstColumn) {
setShowColumnId(firstColumn.id)
fetchNewsByColumn(firstColumn.id)
}
}
}
})
}
const fetchNewByLabel = (label) => {
// 1-头条文章 2-轮播新闻 3-图片新闻 4-推荐阅读
return new Promise((resolve, reject) => {
PublicApi.getManageContentInformationFindAllByRecommendLabel({ recommendLabel: label }).then(res => {
if (res.code === 1000) {
resolve(res.data)
} else {
reject()
}
}).catch(() => {
reject()
})
})
}
/**
* 根据栏目获取新闻列表
*/
const fetchNewsByColumn = (columnId: number, currentPage?: number) => {
let param = {
columnId,
current: currentPage ? currentPage : current,
pageSize,
status: 2,
}
//@ts-ignore
PublicApi.getManageContentInformationPage(param).then(res => {
if (res.code === 1000) {
setNewsList(res.data.data)
setTotalCount(res.data.totalCount)
}
}).catch(() => { })
}
/**
* 切换栏目新闻
* @param columnId
*/
const handleChangeColumn = (columnId: number) => {
setShowColumnId(columnId)
setCurrent(1)
fetchNewsByColumn(columnId, 1)
}
/**
* 切换分页
* @param page
*/
const handlePageChange = (page) => {
setCurrent(page)
fetchNewsByColumn(showColumnId, page)
}
return (
<div className={styles.information}>
......@@ -115,7 +137,12 @@ const Information: React.FC<InformationPropsType> = (props) => {
<BreadCrumbs />
<div className={styles.information_focus}>
<div className={styles.information_focus_left}>
<Carousel className={styles.information_focus_carousel} autoplay={true} pauseOnDotsHover>
<Carousel
className={styles.information_focus_carousel}
autoplay={true}
pauseOnDotsHover
autoplaySpeed={3000}
>
<div className={styles.information_focus_carousel_item}>
<div className={styles.information_focus_imgbox_main}>
<div className={styles.information_focus_imgbox_main_img} style={{ backgroundImage: `url(${informationImg1})` }} />
......@@ -150,10 +177,11 @@ const Information: React.FC<InformationPropsType> = (props) => {
<div className={styles.information_wrap}>
<div className={styles.information_left}>
<div className={styles.information_tabs}>
<div className={cx(styles.information_tabs_item, styles.active)}>今日热点</div>
<div className={styles.information_tabs_item}>行业头条</div>
<div className={styles.information_tabs_item}>专题报道</div>
<div className={styles.information_tabs_item}>政策法规</div>
{
allColumn && allColumn.map(item => (
<div key={`information_tabs_item_${item.id}`} className={cx(styles.information_tabs_item, item.id === showColumnId ? styles.active : "")} onClick={() => handleChangeColumn(item.id)}>{item.name}</div>
))
}
</div>
<div className={styles.information_latest_release_list}>
<div className={styles.information_latest_release_list_item}>
......@@ -182,7 +210,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
</div>
</div>
<div className={styles.pagination_wrap}>
<Pagination showQuickJumper showSizeChanger={false} defaultCurrent={1} total={100} />
<Pagination showQuickJumper showSizeChanger={false} onChange={handlePageChange} current={current} total={totalCount} />
</div>
</div>
<InformationRight />
......
......@@ -37,6 +37,8 @@ interface filterQuery {
Max?: number;
priceType?: number;
storeId?: number;
channelMemberId?: number;
}
const PointsMall: React.FC<CommodityPropsType> = (props) => {
......@@ -79,14 +81,25 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
param = Object.assign(param, filterParam)
}
setLoading(true)
let headers = {}
let getFn = PublicApi.getSearchShopScoreGetCommodityList
if (layoutType === LAYOUT_TYPE.shop) {
switch (layoutType) {
case LAYOUT_TYPE.shop:
param.storeId = shopId
break
case LAYOUT_TYPE.channel:
case LAYOUT_TYPE.ichannel:
headers = {
type: 5
}
param.channelMemberId = memberId
param.priceType = 3
getFn = PublicApi.getSearchShopChannelGetCommodityList
break
}
//@ts-ignore
getFn(param).then(res => {
getFn(param, { headers }).then(res => {
setLoading(false)
if (res.code === 1000) {
setCommodityList(res.data.data)
......@@ -125,6 +138,7 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
result = LAYOUT_TYPE.shopScoreMall
break
case LAYOUT_TYPE.channel:
case LAYOUT_TYPE.ichannel:
result = LAYOUT_TYPE.channelScoreMall
break
}
......
......@@ -2,48 +2,6 @@ import { action, computed, observable, runInAction } from 'mobx'
import { LAYOUT_TYPE } from '@/constants'
import { PublicApi } from '@/services/api'
const defaultCategory = [
{
id: 1,
name: '成品皮',
categoryTree: [
{
id: 11,
title: '牛皮',
children: [
{
id: 111,
title: '黄牛皮'
},
{
id: 112,
title: '水牛皮'
}
]
}
]
},
{
id: 2,
name: '成品皮',
categoryTree: [
{
id: 21,
title: '牛皮',
children: [
{
id: 211,
title: '黄牛皮'
},
{
id: 212,
title: '水牛皮'
}
]
}
]
}
]
class CategoryStore {
@observable public categoryList: any = []; // 品类列表
......@@ -54,10 +12,10 @@ class CategoryStore {
* 企业商城商品分类列表
*/
@action.bound
public async fetchCategoryList(getCategoryFn, params, type) {
public async fetchCategoryList(getCategoryFn, params, type, options?) {
if (this.categoryType !== type) {
this.categoryType = type
let res = await getCategoryFn(params)
let res = await getCategoryFn(params, options || {})
runInAction(() => {
this.categoryList = res.data || []
})
......
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