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

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

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