提交 ff634b9a 作者: 龚洪江

Merge branch 'develop'

...@@ -9,6 +9,7 @@ interface PropsType { ...@@ -9,6 +9,7 @@ interface PropsType {
fileUpload: boolean; // 是否上传到服务器(返回文件流还是返回上传后的地址) fileUpload: boolean; // 是否上传到服务器(返回文件流还是返回上传后的地址)
fileLength?: number; // 最大上传文件数量 fileLength?: number; // 最大上传文件数量
children: React.ReactNode; // 上传按钮 children: React.ReactNode; // 上传按钮
showUploadList?: boolean; //是否隐藏上传文件列表
onChange?: ( onChange?: (
fileList: { fileList: {
id: number; id: number;
...@@ -27,6 +28,7 @@ export const Uploader: React.FC<PropsType> = (props) => { ...@@ -27,6 +28,7 @@ export const Uploader: React.FC<PropsType> = (props) => {
fileType: ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'], fileType: ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'],
onChange: () => {}, onChange: () => {},
defaultFileList: [], defaultFileList: [],
showUploadList: true,
}; };
const { const {
fileType = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/bmp'], fileType = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/bmp'],
...@@ -37,12 +39,14 @@ export const Uploader: React.FC<PropsType> = (props) => { ...@@ -37,12 +39,14 @@ export const Uploader: React.FC<PropsType> = (props) => {
fileLength, fileLength,
onChange, onChange,
defaultFileList, defaultFileList,
showUploadList,
} = props; } = props;
const [fileList, setFileList] = useState<any[]>([]); const [fileList, setFileList] = useState<any[]>([]);
// 上传文件配置 // 上传文件配置
const uploadProps: UploadProps = { const uploadProps: UploadProps = {
listType, listType,
fileList, fileList,
showUploadList,
beforeUpload: (res) => { beforeUpload: (res) => {
const isType = fileType?.includes(res.type); const isType = fileType?.includes(res.type);
const isSize = res.size / 1024 / 1024 < (fileSize || 2); const isSize = res.size / 1024 / 1024 < (fileSize || 2);
......
import { Button, Col, Divider, Form, Input, Row } from 'antd'; import { Button, Col, Divider, Form, Input, message, Row } from 'antd';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import LayoutView from '~/components/layout'; import LayoutView from '~/components/layout';
...@@ -26,7 +26,9 @@ export default function JoinPolicy() { ...@@ -26,7 +26,9 @@ export default function JoinPolicy() {
}, [router.query.tagId]); }, [router.query.tagId]);
//提交 //提交
const submitApply = () => { const submitApply = () => {
form.validateFields().then((valid) => { form
.validateFields()
.then((valid) => {
api api
.cooperationApply({ .cooperationApply({
...valid, ...valid,
...@@ -41,6 +43,9 @@ export default function JoinPolicy() { ...@@ -41,6 +43,9 @@ export default function JoinPolicy() {
}, 1500); }, 1500);
} }
}); });
})
.catch((err: any) => {
message.warning(err.errorFields[0].errors[0]);
}); });
}; };
//上传变更 //上传变更
...@@ -96,7 +101,9 @@ export default function JoinPolicy() { ...@@ -96,7 +101,9 @@ export default function JoinPolicy() {
</Form.Item> </Form.Item>
<Row> <Row>
<Col span={2}> <Col span={2}>
<div>上传资料:</div> <div>
<span style={{ color: 'red' }}>*</span>上传资料:
</div>
</Col> </Col>
<Col span={10}> <Col span={10}>
<div className={styles.uploadTip}> <div className={styles.uploadTip}>
...@@ -105,7 +112,10 @@ export default function JoinPolicy() { ...@@ -105,7 +112,10 @@ export default function JoinPolicy() {
<div> 3. 文件大小不超过10M</div> <div> 3. 文件大小不超过10M</div>
</div> </div>
<div className={styles.uploadOperate}> <div className={styles.uploadOperate}>
<Form.Item name='attachmentList'> <Form.Item
name='attachmentList'
rules={[{ required: true, message: '请上传资料' }]}
>
<Uploader <Uploader
fileUpload fileUpload
listType='text' listType='text'
......
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
import { OrderForGoodsBox } from './styled'; import { OrderForGoodsBox } from './styled';
import type { FormInstance, RadioChangeEvent } from 'antd'; import type { RadioChangeEvent } from 'antd';
import { Button, Radio, Space, Input, message, Modal, Image } from 'antd'; import { Button, Radio, Space, Input, message, Modal, Image } from 'antd';
import api, { UserAddress, GetOrderForGoods } from './api'; import api, { UserAddress, GetOrderForGoods } from './api';
import moment from 'moment'; import moment from 'moment';
......
import { Form, Input, Modal, Upload, Image, Button, Row, Col } from 'antd'; import { Form, Input, Modal, Image, Button, Row, Col } from 'antd';
import type { UploadProps } from 'antd/es/upload';
import type { UploadFile } from 'antd/es/upload/interface'; import type { UploadFile } from 'antd/es/upload/interface';
import { useContext, useEffect, useState } from 'react'; import { useContext, useState } from 'react';
import gApi from '~/api';
import NImage from 'next/image'; import NImage from 'next/image';
import api from './api'; import api from './api';
import { useGeolocation } from '~/lib/hooks'; import { useGeolocation } from '~/lib/hooks';
...@@ -10,6 +8,7 @@ import { UserContext } from '~/lib/userProvider'; ...@@ -10,6 +8,7 @@ import { UserContext } from '~/lib/userProvider';
import uploadImg from '~/assets/images/upload.png'; import uploadImg from '~/assets/images/upload.png';
import deleteIcon from '~/assets/images/delete-icon.png'; import deleteIcon from '~/assets/images/delete-icon.png';
import styles from './index.module.scss'; import styles from './index.module.scss';
import { Uploader } from '~/components/uploader';
type Props = { type Props = {
open: boolean; open: boolean;
...@@ -18,7 +17,6 @@ type Props = { ...@@ -18,7 +17,6 @@ type Props = {
}; };
const normFile = (e: any) => { const normFile = (e: any) => {
console.log('Upload event:', e);
if (Array.isArray(e)) { if (Array.isArray(e)) {
return e; return e;
} }
...@@ -29,63 +27,12 @@ export default function PublishMessage(props: Props) { ...@@ -29,63 +27,12 @@ export default function PublishMessage(props: Props) {
const [fileList, setFileList] = useState<UploadFile[]>([]); const [fileList, setFileList] = useState<UploadFile[]>([]);
const [showLoading, setShowLoad] = useState(false); const [showLoading, setShowLoad] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
const { userInfo, setNeedLogin } = useContext(UserContext); const { userInfo } = useContext(UserContext);
const position = useGeolocation(); const position = useGeolocation();
const [token, setToken] = useState('');
useEffect(() => {
setToken(window.localStorage.getItem('token') || '');
}, []);
//图片上传 //图片上传
const handleChange: UploadProps['onChange'] = (info) => { const fileUploadChange = (value: any) => {
const isSize = (info.file as any).size / 1024 / 1024 < 5; setFileList([...fileList, ...value]);
if (!isSize) {
window.messageApi.error('上传文件最大5M');
return;
}
const isType = [
'video/mp4',
'video/avi',
'video/wmv',
'video/rmvb',
'image/png',
'image/jpeg',
'image/jpg',
'image/gif',
'image/bmp',
].includes(info.file.type as string);
if (!isType) {
window.messageApi.error('上传文件类型错误');
return;
}
if (info.file.status === 'uploading') {
let find = fileList.find((item) => {
return item.uid === info.file.uid;
});
if (!find) {
setFileList([...fileList, info.file]);
}
return;
} else if (info.file.status === 'done') {
if (info.file.response.code === '200' && info.file.response.result) {
let fileList1 = fileList.map((item) => {
if (item.uid === info.file.uid) {
info.file.url = info.file.response.result;
return info.file;
}
return item;
});
setFileList([...fileList1]);
} else {
window.messageApi.error(info.file.response?.message || '上传失败');
info.fileList = fileList.filter((item) => {
return item.uid !== info.file.uid;
});
setFileList([...info.fileList]);
}
} else {
setFileList([...info.fileList]);
}
}; };
//删除媒体 //删除媒体
const deleteMedia = (file: UploadFile) => { const deleteMedia = (file: UploadFile) => {
...@@ -95,7 +42,6 @@ export default function PublishMessage(props: Props) { ...@@ -95,7 +42,6 @@ export default function PublishMessage(props: Props) {
//提交 //提交
const onFinish = (values: any) => { const onFinish = (values: any) => {
setShowLoad(true); setShowLoad(true);
if (userInfo) { if (userInfo) {
api api
.publish({ .publish({
...@@ -186,19 +132,26 @@ export default function PublishMessage(props: Props) { ...@@ -186,19 +132,26 @@ export default function PublishMessage(props: Props) {
<Col> <Col>
<Form.Item valuePropName='picture' getValueFromEvent={normFile}> <Form.Item valuePropName='picture' getValueFromEvent={normFile}>
<Upload <Uploader
name='uploadFile' fileUpload
action={gApi.fileUpload}
listType='picture-card'
onChange={handleChange}
showUploadList={false} showUploadList={false}
maxCount={1} fileSize={5}
headers={{ token: token }} fileLength={9}
fileType={[
'video/mp4',
'video/avi',
'video/wmv',
'video/rmvb',
'image/png',
'image/jpeg',
'image/jpg',
'image/gif',
'image/bmp',
]}
onChange={fileUploadChange}
> >
{fileList.length >= 9 ? null : (
<NImage src={uploadImg} alt='' width={100} height={100} /> <NImage src={uploadImg} alt='' width={100} height={100} />
)} </Uploader>
</Upload>
</Form.Item> </Form.Item>
</Col> </Col>
</Row> </Row>
......
import { Button, Image, Space, Input, Modal, Form, List, Divider, Skeleton } from 'antd'; import { Button, Image, Space, Input, Form, Divider, Skeleton } from 'antd';
import Layout from '~/components/layout'; import Layout from '~/components/layout';
import styles from './index.module.scss'; import styles from './index.module.scss';
import errImg from '~/assets/errImg'; import errImg from '~/assets/errImg';
...@@ -192,19 +192,6 @@ export default function Forum() { ...@@ -192,19 +192,6 @@ export default function Forum() {
), ),
)} )}
</Space> </Space>
{/*<Image.PreviewGroup*/}
{/*>*/}
{/* <Space size={6} wrap>*/}
{/* {item?.mediaVO*/}
{/* ?.filter((v) => v.type === 0)*/}
{/* ?.map((img, index: number) => {*/}
{/* return (*/}
{/* );*/}
{/* })}*/}
{/* </Space>*/}
{/*</Image.PreviewGroup>*/}
</div> </div>
<div className={styles.ctrls}> <div className={styles.ctrls}>
<div className={styles.ctrlsItem} onClick={() => openComment(item)}> <div className={styles.ctrlsItem} onClick={() => openComment(item)}>
......
...@@ -15,6 +15,7 @@ export interface Job { ...@@ -15,6 +15,7 @@ export interface Job {
serviceName: string; serviceName: string;
teamName: string; teamName: string;
price: number; price: number;
inspComtAmount: number;
} }
export interface ListPageJobInfoResp { export interface ListPageJobInfoResp {
......
...@@ -41,7 +41,7 @@ export default function JobServices() { ...@@ -41,7 +41,7 @@ export default function JobServices() {
</div> </div>
</div> </div>
<div className='item-bottom'> <div className='item-bottom'>
<div className='bottom-left'>{Math.round(Math.random() * (150 - 100) + 100)}条评价</div> <div className='bottom-left'>{item.inspComtAmount}条评价</div>
{/* <div className="bottom-right">专业飞手团队,精通巡航业务</div> */} {/* <div className="bottom-right">专业飞手团队,精通巡航业务</div> */}
<div className='com'>{item.teamName}</div> <div className='com'>{item.teamName}</div>
</div> </div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论