Commit 85b2c78a authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:处理不同设置方式的商品图片显示,商品区域为空显示,优化输入搜索

parent 07afc5c4
export interface MemberType {
id: number;
typeName: string;
}
export interface BusinessType {
id: number;
typeName: string;
}
export interface UseType {
memberType: MemberType[];
businessType: BusinessType[];
}
export interface UserRegister {
useType: UseType;
useDetail?: any;
}
export interface RuleConfiguration {
value: number;
label: string;
platformType: number;
}
export interface PayWayResponse {
payType: number;
value: number;
label: string;
}
export interface PayInitializeConfig {
payType: number;
ruleConfigurations: RuleConfiguration[];
payWayResponses: PayWayResponse[];
}
export interface PayPlatformPayConfig {
id: number;
payType: number;
way: string;
isPitchOn: number;
}
export interface PayConfig {
payInitializeConfig: PayInitializeConfig[];
payPlatformPayConfig: PayPlatformPayConfig[];
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Children {
code: string;
}
export interface MenuList {
code: string;
children: Children[];
}
export interface Global {
logo: string;
countryList: CountryList[];
menuList: MenuList[];
}
export interface RootObject {
userRegister: UserRegister;
payConfig: PayConfig;
global: Global;
}
\ No newline at end of file
......@@ -30,4 +30,9 @@
margin-right: 24px;
}
}
// 处理PageHeaderWrapper外边距冲突
.ant-pro-basicLayout-content .ant-pro-page-header-wrap {
margin: 0;
}
}
\ No newline at end of file
......@@ -26,7 +26,7 @@ interface paramItem {
}
const Products: React.FC<{}> = () => {
const ref = useRef({})
const ref = useRef<any>({})
let [isHighSearch, setIsHighSearch] = useState(false)
const [filterParams, setFilterParams] = useState<paramItem>({
name: '',
......@@ -169,49 +169,36 @@ const Products: React.FC<{}> = () => {
ref.current.reload(restObj)
}
const handleBrandSearch = (value:any) => { // end value
console.log(value, 'handleBrandSearch')
if (value) {
PublicApi.getProductSelectGetSelectBrand({name: value}).then(res=>{
if(res.code === 1000)
setBrandData(res.data)
})
} else {
setBrandData([])
}
const handleBrandSearch = (value?:any) => { // end value
PublicApi.getProductSelectGetSelectBrand({name: value}).then(res=>{
if(res.code === 1000)
setBrandData(res.data)
})
}
const handleBrandChange = (value:any) => {
setBrandValue(value)
console.log(value, 'handleBrandChange')
let obj = {...filterParams, brandId: value}
setFilterParams(obj)
}
const handleClassSearch = (value:any) => {
console.log(value, 'handleClassSearch')
if (value) {
PublicApi.getProductSelectGetSelectCustomerCategory({name: value}).then(res=>{
if(res.code === 1000)
setClassData(res.data)
})
} else {
setClassData([])
}
const handleClassSearch = (value?:any) => {
PublicApi.getProductSelectGetSelectCustomerCategory({name: value}).then(res=>{
if(res.code === 1000)
setClassData(res.data)
})
}
const handleClassChange = (value:any) => {
setClassValue(value)
let obj = {...filterParams, customerCategoryId: value}
setFilterParams(obj)
console.log(value, 'handleClassChange')
}
const handleSearch = (val: string) => {
const handleSearch = (val?: string) => {
console.log(val)
let obj = val ? {...filterParams, name: val} : { ...filterParams }
setFilterParams(obj)
//@ts-ignore
ref.current.reload(obj)
}
......@@ -264,6 +251,7 @@ const Products: React.FC<{}> = () => {
filterOption={false}
onSearch={handleBrandSearch}
onChange={handleBrandChange}
onFocus={()=>handleBrandSearch(null)}
notFoundContent={null}
style={{width:'100%'}}
>
......@@ -280,6 +268,7 @@ const Products: React.FC<{}> = () => {
filterOption={false}
onSearch={handleClassSearch}
onChange={handleClassChange}
onFocus={()=>handleClassSearch(null)}
notFoundContent={null}
style={{width:'100%'}}
>
......
......@@ -402,7 +402,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={20}>
<p>
{
productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+_item.cityName}</p>)
productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+(_item.cityName||'')}</p>)
}
</p>
</Col>
......@@ -571,7 +571,8 @@ const viewProducts: React.FC<{}> = () => {
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="商品图片">
{
productDetail?.unitPriceAndPicList[0].attributeAndValueList.length === 0 ? <>
// productDetail?.unitPriceAndPicList[0].attributeAndValueList.length === 0 ? <>
productDetail?.isAllAttributePic ? <>
<Row>
<Col span={3}>
<p>设置方式:</p>
......@@ -641,7 +642,7 @@ const viewProducts: React.FC<{}> = () => {
{/* 图片区块 */}
<div className={styles.descriptionBox}>
{
productDetail?.commodityRemark?.image.length>0 ? productDetail?.commodityRemark?.image.map((_item, _index)=> <div key={_index} className={styles.imgItem}>
productDetail?.commodityRemark?.image?.length>0 ? productDetail?.commodityRemark?.image.map((_item, _index)=> <div key={_index} className={styles.imgItem}>
<img src={_item} />
</div>) : <p>暂无数据</p>
}
......
......@@ -39,7 +39,7 @@ interface paramItem {
}
const Products: React.FC<{}> = () => {
const ref = useRef({})
const ref = useRef<any>({})
let [isHighSearch, setIsHighSearch] = useState(false)
const [filterParams, setFilterParams] = useState<paramItem>({
name: '',
......@@ -168,53 +168,39 @@ const Products: React.FC<{}> = () => {
setFilterParams(restObj)
setBrandValue(undefined)
setClassValue(undefined)
//@ts-ignore
ref.current.reload(restObj)
}
const handleBrandSearch = (value:any) => { // end value
console.log(value, 'handleBrandSearch')
if (value) {
PublicApi.getProductSelectGetSelectBrand({name: value}).then(res=>{
if(res.code === 1000)
setBrandData(res.data)
})
} else {
setBrandData([])
}
const handleBrandSearch = (value?:any) => { // end value
PublicApi.getProductSelectGetSelectBrand({name: value}).then(res=>{
if(res.code === 1000)
setBrandData(res.data)
})
}
const handleBrandChange = (value:any) => {
setBrandValue(value)
console.log(value, 'handleBrandChange')
let obj = {...filterParams, brandId: value}
setFilterParams(obj)
}
const handleClassSearch = (value:any) => {
console.log(value, 'handleClassSearch')
if (value) {
PublicApi.getProductSelectGetSelectCustomerCategory({name: value}).then(res=>{
if(res.code === 1000)
setClassData(res.data)
})
} else {
setClassData([])
}
const handleClassSearch = (value?:any) => {
PublicApi.getProductSelectGetSelectCustomerCategory({name: value}).then(res=>{
if(res.code === 1000)
setClassData(res.data)
})
}
const handleClassChange = (value:any) => {
setClassValue(value)
let obj = {...filterParams, customerCategoryId: value}
setFilterParams(obj)
console.log(value, 'handleClassChange')
}
const handleSearch = (val?: string) => {
console.log(val)
let obj = val ? {...filterParams, name: val} : { ...filterParams }
setFilterParams(obj)
//@ts-ignore
ref.current.reload(obj)
}
......@@ -267,6 +253,7 @@ const Products: React.FC<{}> = () => {
filterOption={false}
onSearch={handleBrandSearch}
onChange={handleBrandChange}
onFocus={()=>handleBrandSearch(null)}
notFoundContent={null}
style={{width:'100%'}}
>
......@@ -283,6 +270,7 @@ const Products: React.FC<{}> = () => {
filterOption={false}
onSearch={handleClassSearch}
onChange={handleClassChange}
onFocus={()=>handleClassSearch(null)}
notFoundContent={null}
style={{width:'100%'}}
>
......
......@@ -369,7 +369,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={20}>
<p>
{
productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+_item.cityName}</p>)
productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+(_item.cityName||'')}</p>)
}
</p>
</Col>
......@@ -538,7 +538,8 @@ const viewProducts: React.FC<{}> = () => {
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="商品图片">
{
productDetail?.unitPriceAndPicList[0].attributeAndValueList.length === 0 ? <>
// productDetail?.unitPriceAndPicList[0].attributeAndValueList.length === 0 ? <>
productDetail?.isAllAttributePic ? <>
<Row>
<Col span={3}>
<p>设置方式:</p>
......@@ -598,7 +599,7 @@ const viewProducts: React.FC<{}> = () => {
{/* 视频区块 */}
<div className={styles.descriptionBox}>
{
productDetail?.commodityRemark?.video.length>0 ? productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}>
productDetail?.commodityRemark?.video?.length>0 ? productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}>
<video src={_item} controls={true}>
您的浏览器不支持视频标签,请及时升级。
</video>
......@@ -608,7 +609,7 @@ const viewProducts: React.FC<{}> = () => {
{/* 图片区块 */}
<div className={styles.descriptionBox}>
{
productDetail?.commodityRemark?.image.length>0 ? productDetail?.commodityRemark?.image.map((_item, _index)=> <div key={_index} className={styles.imgItem}>
productDetail?.commodityRemark?.image?.length>0 ? productDetail?.commodityRemark?.image.map((_item, _index)=> <div key={_index} className={styles.imgItem}>
<img src={_item} />
</div>) : <p>暂无数据</p>
}
......
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