Commit 3e44c706 authored by GuanHua's avatar GuanHua

feat:渠道商城装修行情资讯数据

parent 5308c476
......@@ -121,18 +121,78 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
})
}
/**
* 获取头条新闻
*/
const fetchLeadNews = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getManageContentInformationFindAllByRecommendLabel({ recommendLabel: 1 }).then(res => {
if (res.code === 1000) {
let leadNewsList: any = res.data || []
if (leadNewsList.length >= 2) {
let leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
let rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
resolve({
leadLeftNews: leftList,
leadRightNews: rightList
})
} else {
resolve({
leadNewsList,
leadRightNews: []
})
}
}
})
})
}
/**
* 获取全部栏目
*/
const fetchAllColumn = () => {
return new Promise((resolve) => {
PublicApi.getManageContentColumnAll().then(res => {
if (res.code === 1000) {
let result = ""
let allColumn = res.data
if (allColumn && allColumn.length > 0) {
let labelList = allColumn.map((item: any) => item.name)
let showCount = 4
if (labelList.length <= showCount) {
result = labelList.join(' | ')
} else {
labelList = labelList.slice(0, showCount)
result = labelList.join(' | ') + " ..."
}
}
resolve(result)
}
})
})
}
const getComponentsConfig = async () => {
// 导航栏
mainNavConfig[mainNavConfig.key].props.menuData = menuData
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.channel
mainNavConfig[mainNavConfig.key].props.categoryList = []
// 一号位广告
bannerAdvertConfig[bannerAdvertConfig.key].props.advertList = await findFirstAdvertsByType()
// 二号位广告
serviceAdvertConfig[serviceAdvertConfig.key].props.advertList = await findSecondAdvertsByType()
//店铺信息
AboutUsConfig[AboutUsConfig.key].props.shopInfo = await fetchShopInfo()
// 行情资讯
InformationConfig[InformationConfig.key].props.newsList = await fetchLeadNews()
InformationConfig[InformationConfig.key].props.allColumn = await fetchAllColumn()
let initIndex = 100
let floorLineConfig: any = {}
let floorLineKeys: any = []
......@@ -183,6 +243,7 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
}
mallLayoutConfig["0"].childNodes = [...mallLayoutConfig["0"].childNodes, ...floorLineKeys, serviceAdvertConfig.key, CommonTitle2Config.key, AboutUsConfig.key, InformationConfig.key, FooterConfig.key]
let config = {
...mallLayoutConfig,
...topBarConfig,
......
......@@ -296,6 +296,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
<UploadImage
imgUrl={item.picUrl}
size={getImgSize()}
fileMaxSize={500}
onChange={(val) => handleKeyChange(val, item.sort, 'picUrl')}
/>
</div>
......
......@@ -9,6 +9,7 @@
border: 1px solid rgba(245, 245, 245, 1);
.information_header {
display: flex;
height: 60px;
line-height: 60px;
padding-left: 20px;
......@@ -24,6 +25,12 @@
font-size: 12px;
color: #909399;
}
.more_link {
color: #999999;
padding-right: 20px;
margin-left: auto;
}
}
}
......
......@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'
import { PublicApi } from '@/services/api'
import { GetManageContentColumnAllResponse } from '@/services/PassApi'
import ImageBox from '@/components/ImageBox'
import { RightOutlined } from '@ant-design/icons'
import moment from 'moment'
import { LAYOUT_TYPE } from '@/constants'
import styles from './index.less'
......@@ -97,12 +98,24 @@ const Information: React.FC<InformationPropsType> = (props) => {
}
}
const toMoreLink = () => {
switch (layoutType) {
case LAYOUT_TYPE.channel:
return `/channelmall/infomation?channelId=${shopUrlParam}`
case LAYOUT_TYPE.ichannel:
return `/ichannelmall/infomation?channelId=${shopUrlParam}`
default:
return `/infomation`
}
}
return (
<div className={styles.information}>
<div className={styles.information_container}>
<div className={styles.information_header}>
<span>行情资讯</span>
<label>{renderColumns()}</label>
<a href={toMoreLink()} className={styles.more_link}>更多好货 <RightOutlined /></a>
</div>
<div className={styles.information_list}>
......@@ -113,7 +126,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
<>
{
index === 0 ? (
<a href={toDetailLink(item.id)}>
<a href={toDetailLink(item.id)} key={`information_recommand_${item.id}`}>
<div className={styles.information_recommand}>
<div className={styles.information_recommand_img}>
<ImageBox width={220} height={146} imgUrl={item.imageUrl} />
......@@ -126,7 +139,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
</div>
</a>
) : (
<a href={toDetailLink(item.id)}>
<a href={toDetailLink(item.id)} key={`news_list_item_${item.id}`}>
<div className={styles.news_list_item}>
<div className={styles.news_list_item_title}>{item.title}</div>
<div className={styles.news_list_item_date}>{(moment(item.createTime).format('YYYY-MM-DD HH:mm:ss'))}</div>
......@@ -134,7 +147,6 @@ const Information: React.FC<InformationPropsType> = (props) => {
</a>
)
}
</>
))
}
......@@ -147,7 +159,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
<>
{
index === 0 ? (
<a href={toDetailLink(item.id)}>
<a href={toDetailLink(item.id)} key={`information_recommand_${index}`}>
<div className={styles.information_recommand}>
<div className={styles.information_recommand_img}>
<ImageBox width={220} height={146} imgUrl={item.imageUrl} />
......@@ -160,7 +172,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
</div>
</a>
) : (
<a href={toDetailLink(item.id)}>
<a href={toDetailLink(item.id)} key={`news_list_item_${index}`}>
<div className={styles.news_list_item}>
<div className={styles.news_list_item_title}>{item.title}</div>
<div className={styles.news_list_item_date}>{(moment(item.createTime).format('YYYY-MM-DD HH:mm:ss'))}</div>
......
......@@ -111,6 +111,7 @@
&_item {
flex: 1;
text-align: center;
cursor: pointer;
&_count {
font-size: 20px;
......@@ -165,6 +166,7 @@
height: 80px;
align-items: center;
justify-content: center;
cursor: pointer;
&.bb {
border-bottom: 1px solid #F4F5F7;
......
......@@ -66,7 +66,7 @@ const baseRequest = extend({
timeout: 30 * 1000,
headers: defaultHeaders,
credentials: 'include', // 默认请求是否带上cookie
// errorHandler
errorHandler
});
const cache = {}
......
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