diff --git a/src/request/api.ts b/src/request/api.ts index bbb0f66..0976593 100644 --- a/src/request/api.ts +++ b/src/request/api.ts @@ -135,11 +135,14 @@ export const bigClassList = () => aiShopRequest.get(`/aishop/api/data/listbypare // 获取小类 export const smallClassList = (id:string) => aiShopRequest.get(`/aishop/api/data/listbyparentid/8abb5b58-83d2-465c-b164-a189efee28c1/${id}`) - // 下单购买APP电子软著 export const buyAppGoods = (orderMoneyId:string) => aiShopRequest.post(`/aishop/api/apporder/pay/${orderMoneyId}`) // 获取我的app电子软著订单列表 export const appOrderList = (params:any) => aiShopRequest.get(`/aishop/api/apporder/listpage-self`, { params }) // 获取app电子软著详情 export const appOrderDetail = (appOrderId:any) => aiShopRequest.get(`/aishop/api/apporder/get/${appOrderId}`) +// 生成授权书word文件 +export const authorizeWord = (appOrderId:any,companyName:string) => aiShopRequest.get(`/aishop/api/apporder/create-file/SHOP04/${appOrderId}?name=${companyName}授权书&companyName=${companyName}`) +// 企业认证 +export const companyAuth = (appOrderId:any,params:any) => aiShopRequest.post(`aishop/api/apporder/update/1/${appOrderId}`,{ params}) // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ \ No newline at end of file diff --git a/src/route/AppElectron/AppEdit.tsx b/src/route/AppElectron/AppEdit.tsx index 12267bb..e261f0e 100644 --- a/src/route/AppElectron/AppEdit.tsx +++ b/src/route/AppElectron/AppEdit.tsx @@ -304,6 +304,11 @@ export default function AppEdit() { { + setCompanyInfo(val) + } + } setEditProcess={ (num: number) => { setEditProcess(num) diff --git a/src/route/AppElectron/components/AppCompany/AppCompany.tsx b/src/route/AppElectron/components/AppCompany/AppCompany.tsx index 3c44656..fd479dc 100644 --- a/src/route/AppElectron/components/AppCompany/AppCompany.tsx +++ b/src/route/AppElectron/components/AppCompany/AppCompany.tsx @@ -1,10 +1,12 @@ import { useState, useEffect } from 'react' import './app-company.css' -import { uploadFileUrl, showImage } from '../../../../request/request' +import { uploadImageUrl, showImage } from '../../../../request/request' +import { authorizeWord, companyAuth } from '../../../../request/api' import { Button, Form, Input, message, // Select, DatePicker, Upload, Image, + Spin, // Cascader } from "antd" import { LoadingOutlined, } from '@ant-design/icons'; @@ -22,18 +24,38 @@ import type { UploadProps } from 'antd'; // // pId: string; // } export default function AppCompany(props: any) { - + const [messageApi, contextHolder] = message.useMessage(); + const [downLoading, setDownLoading] = useState(false) + const validateImageUrl = () => { + if (!imageUrl) { + return Promise.reject(new Error('请上传文件')); + } + return Promise.resolve(); + }; + const validateTextImageUrl = () => { + if (!textImageUrl) { + return Promise.reject(new Error('请上传文件')); + } + return Promise.resolve(); + }; // 定义 beforeUpload 函数 const beforeUpload = (file: any) => { const isJpgOrPng = ['image/jpeg', 'image/png', 'image/bmp'].includes(file.type); if (!isJpgOrPng) { message.error('只能上传 JPG、JPEG、PNG、BMP 格式的文件!'); + form.setFieldsValue({ + 'companyPhoto': '', + }); } const isLt4M = file.size / 1024 / 1024 < 4; if (!isLt4M) { message.error('文件大小不能超过 4MB!'); + form.setFieldsValue({ + 'companyPhoto': '', + }); } return isJpgOrPng && isLt4M; + }; // type FileType = Parameters>[0]; const [loading, setLoading] = useState(false); @@ -54,13 +76,13 @@ export default function AppCompany(props: any) { // setLoading(false); // setImageUrl(url); // }); - // console.log(info.file.response.data.fileId); + console.log(info.file.response.data.fileId); setLoading(false); const fileId = info.file.response.data.fileId; const url = showImage(fileId, false); setImageUrl(url); form.setFieldsValue({ - img: fileId, + companyPhoto: fileId, }) } if (info.file.status === 'error') { @@ -69,11 +91,11 @@ export default function AppCompany(props: any) { message.error(`上传失败`); //伤处表单name为ing的值 form.setFieldsValue({ - img: '', // 将值设置为 undefined 以清除错误状态 + companyPhoto: '', // 将值设置为 undefined 以清除错误状态 }) } }; - const[textloading, setTextLoading] = useState(false); + const [textloading, setTextLoading] = useState(false); const [textImageUrl, setTextImageUrl] = useState(''); const textHandleChange: UploadProps['onChange'] = (info) => { if (info.file.status === 'uploading') { @@ -92,7 +114,7 @@ export default function AppCompany(props: any) { const url = showImage(fileId, false); setTextImageUrl(url); form.setFieldsValue({ - textImg: fileId, + companyAuth: fileId, }) } if (info.file.status === 'error') { @@ -101,7 +123,7 @@ export default function AppCompany(props: any) { message.error(`上传失败`); //伤处表单name为ing的值 form.setFieldsValue({ - textImg: '', // 将值设置为 undefined 以清除错误状态 + companyAuth: '', // 将值设置为 undefined 以清除错误状态 }) } }; @@ -139,267 +161,319 @@ export default function AppCompany(props: any) { }; - const onFinish = (values: any) => { + const onFinish = async (values: any) => { // 处理表单提交逻辑 console.log('表单提交成功', values); - submitInfo(values) + console.log('发过来的数据', props.companyInfo); + if (values != props.companyInfo) { + try { + setDownLoading(true) + const res = await companyAuth(props.appOrderId, { + appOrderId: props.appOrderId, + ...values + }) + setDownLoading(false) + console.log(res); + } catch (error: any) { + + if (error.response) { + const data = error.response.data; + messageApi.open({ + type: 'error', + content: data.msg ? data.msg : `${data.path}(${data.status})`, + }); + } else { + console.error(error) + } + } + + + } + // submitInfo(values) + console.log('imageurl', imageUrl); + }; useEffect(() => { - // console.log('认证数据',props.companyInfo); + console.log('认证数据', props.companyInfo); if (props.companyInfo.companyName) { console.log('嘻嘻'); } }, [props.companyInfo]) return ( -
- {/* {contextHolder} */} -
-
+ + {contextHolder} +
+ {/* {contextHolder} */} +
+
-
{ - message.error('请完善信息') - }} - > -
-
-
企业/机构名称*
- - - -
- -
-
统一社会信用代码*
- - - - -
-
- -
-
-
上传证件*
-
- - - {imageUrl ? -
- -
- : } - -
-
-
{ - setImageUrl('') - form.setFieldsValue({ - img: '', // 将值设置为 undefined 以清除错误状态 - }) - }} - >删除
-
-
-
- -
- - { - }} - headers={{ 'Auth': `Bearer ${token}` }} - // disabled={!!imageUrl} - > - {textImageUrl ? -
- -
- : } - -
-
-
{ - setTextImageUrl('') - form.setFieldsValue({ - textImg: '', // 将值设置为 undefined 以清除错误状态 - }) - }} - >删除
-
-
-
-
-
上传要求:
+ { + message.error('请完善信息') + }} + >
-
1.要求不得涂改,需确保四边角完整,文字图片证件号码清晰可见
-
2.请上传小于4MB的图片(JPG、JPEG、PNG、BMP)
+
+
企业/机构名称*
+ + + +
+ +
+
统一社会信用代码*
+ + + + +
-
-
+
+
+
上传证件*
+
+ + + {imageUrl ? +
+ +
+ : } + +
+
+
{ + setImageUrl('') + form.setFieldsValue({ + companyPhoto: '', // 将值设置为 undefined 以清除错误状态 + }) + }} + >删除
+
+
+ +
+
+
上传要求:
+
+
1.要求不得涂改,需确保四边角完整,文字图片证件号码清晰可见
+
2.请上传小于4MB的图片(JPG、JPEG、PNG、BMP)
+
+
+ + + +
+ +
+
+ +
- -
-
- -
-
+ ) } diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx index ff8a4c9..da9f750 100644 --- a/src/route/index/Index.tsx +++ b/src/route/index/Index.tsx @@ -712,7 +712,7 @@ export default function Index() { const [sellBelongType, setSellBelongType] = useState(null) // 所属人类型 // 更改所属人类型 const sellBelongTypeChange = (value: string) => { - console.log(`selected ${value}`); + // console.log(`selected ${value}`); setSellBelongType(value) } const [sellDate, setSellDate] = useState(null) // 日期 @@ -1035,14 +1035,17 @@ export default function Index() { } } useEffect(() => { - nav('/app-electron', { - state: { - appKeyWords: appKeyWords, - checkStatus: appExamineStatus, - appOrderStatus: appApplyStatus - } - }) - }, [appKeyWords,appExamineStatus,appApplyStatus]) + if (location.pathname == '/app-electron') { + nav('/app-electron', { + state: { + appKeyWords: appKeyWords, + checkStatus: appExamineStatus, + appOrderStatus: appApplyStatus + } + }) + } + + }, [appKeyWords, appExamineStatus, appApplyStatus]) // 获取电子软著可选商品列表 const getAppGoodsList = async () => { try {