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

fix: 处理e账户不存在页面报错问题,修复翻译影响品牌材料上传问题

parent 6d5017e6
......@@ -115,9 +115,9 @@ const EAccountDetail: React.FC<{}> = () => {
params.endTime = endTime
}
return new Promise((resolve, reject) => {
getPayEAccountAllInPayGetEAccountTradeRecord({...params}, {ctlType: 'none'}).then(res => {
const { data } = res
resolve(data)
getPayEAccountAllInPayGetEAccountTradeRecord({...params}).then(res => {
const { data, code } = res
code === 1000 ? resolve(data) : reject(data)
})
})
}
......
......@@ -2,12 +2,7 @@ import React, { useState, useEffect } from 'react'
import { history, useIntl } from 'umi'
import { Button, Steps, Card, Space, Tooltip, Form, Input, message, Row, Col } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
QuestionCircleOutlined,
SaveOutlined,
LoadingOutlined,
} from '@ant-design/icons'
import { QuestionCircleOutlined, SaveOutlined } from '@ant-design/icons'
import { UploadFile } from 'antd/lib/upload/interface';
import ReutrnEle from '@/components/ReturnEle'
import styles from './index.less'
......@@ -27,45 +22,14 @@ const layout = {
},
};
function beforeLogoUpload(file: UploadFile) {
const intl = useIntl();
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error(intl.formatMessage({ id: 'trademark.addBrand.error.1' }));
}
const isLt2M = file.size / 1024 / 10 < 6;
if (!isLt2M) {
message.error(intl.formatMessage({ id: 'trademark.addBrand.error.2' }));
}
return isJpgOrPng && isLt2M;
}
function beforeUpload(file: UploadFile) {
const intl = useIntl();
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error(intl.formatMessage({ id: 'trademark.addBrand.error.1' }));
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error(intl.formatMessage({ id: 'trademark.addBrand.error.3' }));
}
return isJpgOrPng && isLt2M;
}
const AddBrand: React.FC<{}> = () => {
const intl = useIntl();
const [form] = Form.useForm();
const [loading, setLoading] = useState(false)
const [logoLoading, setLogoLoading] = useState(false)
const [logoUrl, setlogoUrl] = useState('')
const [currentStep, setCurrentStep] = useState(0)
const [fileList, setFileList] = useState<any[]>([])
// const [proveUrl, setProveUrl] = useState<any>({})
const [responseId, setReponseId] = useState<number>(null)
const [formValues, setFormValues] = useState<any>({})
const [banSomeField, setBanSomeField] = useState<boolean>(false)
const [isDisabledSave, setIsDisabledSave] = useState<boolean>(false)
const [isDisabledCheck, setDisabledCheck] = useState<boolean>(true)
const { roles, memberRoleId } = getAuth() || {};
......@@ -73,14 +37,12 @@ const AddBrand: React.FC<{}> = () => {
useEffect(() => {
const { id } = history.location.query
if (id) {
getProductBrandGetBrand({ id: id }).then(res => {
getProductBrandGetBrand({ id: id + '' }).then(res => {
if (res.code === 1000) {
const { data } = res
setFormValues(data)
form.setFieldsValue(data)
setlogoUrl(data.logoUrl)
// if(data.status === 4)
// setBanSomeField(true)
// 多图回显
let proveImgs = Object.values(data.proveUrl)
let files = [];
......@@ -107,31 +69,25 @@ const AddBrand: React.FC<{}> = () => {
form.setFieldsValue({ proveUrl: obj })
}, [fileList])
const handleUploadLogoChange = (data) => {
// if (info.file.status === 'uploading') {
// setLogoLoading(true)
// return;
// }
// if (info.file.status === 'done') {
// // 图片回显
// console.log(info)
// const { code, data } = info.file.response
// if (code === 1000) {
console.log(data, 'data')
setlogoUrl(data)
form.setFieldsValue({ logoUrl: data })
// }
// setLogoLoading(false)
// }
};
const beforeUpload = (file: UploadFile) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
if (!isJpgOrPng) {
message.error(intl.formatMessage({ id: 'trademark.addBrand.error.1' }));
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error(intl.formatMessage({ id: 'trademark.addBrand.error.3' }));
}
return isJpgOrPng && isLt2M;
}
const handleChange = ({ fileList }) => {
setFileList(fileList)
const handleChange = (info) => {
setFileList(info.fileList)
}
const handleSave = () => {
setIsDisabledSave(true)
form.validateFields().then((values: any) => {
form.validateFields().then((values) => {
if (history.location.query.id) {
values.id = Number(history.location.query.id)
let obj = {};
......@@ -168,20 +124,6 @@ const AddBrand: React.FC<{}> = () => {
})
}
const uploadLogoButton = (
<div>
{logoLoading ? <LoadingOutlined /> : <PlusOutlined />}
<div className="ant-upload-text">{intl.formatMessage({ id: 'trademark.addBrand.uploadText' })}</div>
</div>
);
const uploadButton = (
<div>
{loading ? <LoadingOutlined /> : <PlusOutlined />}
<div className="ant-upload-text">{intl.formatMessage({ id: 'trademark.addBrand.uploadText' })}</div>
</div>
);
const tips = <>{intl.formatMessage({ id: 'trademark.addBrand.tips' })}<Tooltip title={intl.formatMessage({ id: 'trademark.addBrand.tips.tooltip' })}><span>&nbsp;<QuestionCircleOutlined /></span></Tooltip></>
return (
......@@ -230,12 +172,11 @@ const AddBrand: React.FC<{}> = () => {
}
]}
>
<Input disabled={banSomeField} placeholder={intl.formatMessage({ id: 'trademark.addBrand.card.2.name.placeholder' })} />
<Input placeholder={intl.formatMessage({ id: 'trademark.addBrand.card.2.name.placeholder' })} />
</Form.Item>
<Form.Item
name="logoUrl"
label={<span>{intl.formatMessage({ id: 'trademark.addBrand.card.2.logoUrl' })}&nbsp;&nbsp;</span>}
// valuePropName="fileList"
extra={intl.formatMessage({ id: 'trademark.addBrand.card.2.logoUrl.extra' })}
rules={[
{
......@@ -245,15 +186,6 @@ const AddBrand: React.FC<{}> = () => {
]}
className={styles.uploadForm}
>
{/* <UploadImage
disabled={banSomeField}
listType="picture-card"
showUploadList={false}
beforeUpload={beforeLogoUpload}
onChange={handleUploadLogoChange}
imgUrl={logoUrl}
fileMaxSize={60}
/> */}
<UploadImage
imgUrl={logoUrl}
fileMaxSize={60}
......@@ -270,9 +202,6 @@ const AddBrand: React.FC<{}> = () => {
<Space direction="vertical" style={{ width: '100%' }}>
<Card headStyle={{ borderBottom: 'none' }} title={tips}>
<Row>
{/* <Col span={2}>
<div>横版</div>
</Col> */}
<Col span={24}>
<Form.Item
name="proveUrl"
......
......@@ -25,7 +25,6 @@ const BrandOpeartionLabel = [
const viewBrand: React.FC<{}> = () => {
const intl = useIntl();
const [queryId, setQueryId] = useState(null)
const [brandInfo, setBrandInfo] = useState<any>({})
const [fixStep, setFixStep] = useState(0)
const [recordData, setRecordData] = useState<any[]>([])
......@@ -33,9 +32,7 @@ const viewBrand: React.FC<{}> = () => {
useEffect(() => {
const { id } = history.location.query
if (id) {
setQueryId(id)
getProductBrandGetBrand({ id: id }).then(res => {
console.log(res.data, 'data')
getProductBrandGetBrand({ id: id + '' }).then(res => {
if (res.code === 1000) {
setBrandInfo(res.data)
if (res.data.status === 1)
......@@ -46,7 +43,7 @@ const viewBrand: React.FC<{}> = () => {
setFixStep(2)
}
})
getProductBrandGetBrandCheckRecord({ brandId: id }).then(res => {
getProductBrandGetBrandCheckRecord({ brandId: id + '' }).then(res => {
if (res.code === 1000)
setRecordData(res.data)
})
......@@ -90,7 +87,7 @@ const viewBrand: React.FC<{}> = () => {
},
];
const fixProveUrl = (proveInfo: any) => {
const fixProveUrl = (proveInfo) => {
if (proveInfo) {
let imgArray = Object.values(proveInfo)
return imgArray.map((item: string, index: number) => <Col key={index} span={3} xxl={3} xl={4} lg={4}>
......@@ -123,7 +120,7 @@ const viewBrand: React.FC<{}> = () => {
icon={<FormOutlined />}
key="1"
type="primary"
onClick={() => history.push(`/memberCenter/commodityAbility/trademark/edit?id=${brandInfo.id}`)}
onClick={() => history.push(`/memberCenter/commodityAbility/trademark/trademarkApply/edit?id=${brandInfo.id}`)}
disabled={!(brandInfo.status === 1 || brandInfo.status === 3)}
style={{ display: !(brandInfo.status === 1 || brandInfo.status === 3) ? 'none' : 'block' }}
>
......
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