提交 3b7d13c5 作者: ZhangLingKun

Merge branch 'develop'

流水线 #9237 已通过 于阶段
in 1 分 2 秒
......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag: 375c14c25c086f65428c8e7063cad6c58f532ee9
newTag: d77b380544538a92c5eb4cdcffc1ff23c96eb5a5
......@@ -219,6 +219,7 @@ export type editUserApplyTag = InterFunction<
score?: number;
attachmentList?: any;
profileUrl?: string;
profileText?: string;
companyInfoId?: number;
},
NonNullable<unknown>
......
......@@ -212,6 +212,7 @@ export type getCompanyInfoByIdType = InterFunction<
brandLogo: string;
content: string;
profileUrl: string;
profileText: string;
backUserId: number;
cooperationTagId: number;
}
......
import React, { useEffect, useState } from 'react';
import { getCompanyInfoByIdType } from '~/api/interface/systemManageType';
import { InterDataType, InterReqType } from '~/api/interface';
import { Button, Form, Modal, message } from 'antd';
import { Uploader } from '~/components/uploader';
import { UploadOutlined } from '@ant-design/icons';
import { editUserApplyTag } from '~/api/interface/customManageType';
import { useNavigate } from 'react-router-dom';
import { CustomManageAPI } from '~/api';
import RichText from '~/components/richText';
// 店铺类型
type StoreType = InterDataType<getCompanyInfoByIdType>;
// 请求的表单类型
type ReqType = InterReqType<editUserApplyTag>;
const StoreDescView: React.FC<{
detail: StoreType;
onRefresh?: () => void;
}> = ({ detail, onRefresh }) => {
// 导航钩子
const navigate = useNavigate();
// 表单数据
const [form] = Form.useForm<ReqType>();
// 店铺视频列表
const [videoList, setVideoList] = useState<any>([]);
// 店铺视频列表上传
const videoListChange = (value: any) => {
setVideoList(value);
};
// 返回上一级
const handleBack = () => {
Modal.confirm({
title: '提示',
content: '未保存的内容将丢失,是否确认返回?',
onOk: () => {
navigate(-1);
},
});
};
// 表单验证
const handleOk = () => {
form
.validateFields()
.then(async (values) => {
await handleSubmit(values);
})
.catch((err) => {
message
.warning({
content: err.errorFields[0].errors[0],
})
.then();
});
};
// 提交数据
const handleSubmit = async (values: ReqType) => {
const profileUrl = [
...(videoList?.map((i: { url: string }) => ({ url: i.url, type: 2 })) || []),
];
const res = await CustomManageAPI.editUserApplyTag({
companyInfoId: detail?.id,
...detail,
...values,
profileUrl: JSON.stringify(profileUrl || []),
});
if (res && res.code === '200') {
message.success('操作成功');
onRefresh?.();
}
};
// 获取图片视频回显
const getImageVideo = () => {
try {
const profileUrl = JSON.parse(detail?.profileUrl || `[]`);
setVideoList(
profileUrl
?.filter((i: { type: number }) => i.type === 2)
?.map((i: { url: string }) => ({
url: i?.url,
})),
);
} catch (e) {
console.log(e);
}
};
// componentDidMount
useEffect(() => {
if (!detail?.id) return;
form.setFieldsValue({
...detail,
content: detail?.content,
address: detail?.address,
name: detail?.companyName,
attachmentList: detail?.attachmentList,
});
getImageVideo();
}, []);
return (
<div style={{ width: '880px', paddingTop: '20px' }}>
<Form form={form} labelCol={{ span: 2 }}>
<Form.Item label='企业宣传片' name='videoList'>
<Uploader
fileUpload
listType='picture-card'
defaultFileList={videoList}
onChange={videoListChange}
fileLength={1}
fileType={['video/mp4', 'video/avi', 'video/wmv', 'video/rmvb', 'video/mov']}
fileSize={100}
>
<UploadOutlined />
</Uploader>
</Form.Item>
<Form.Item
label='企业介绍'
name='profileText'
rules={[{ required: false, message: '请输入企业介绍' }]}
>
<RichText
richTextContent={form.getFieldValue('profileText')}
onChange={(e) => form.setFieldValue('profileText', e)}
height={250}
/>
</Form.Item>
</Form>
<div className={'store-title flex-center'}>
{/*<div className='title'>店铺页面</div>*/}
<div className='action flex-between' style={{ width: '120px' }}>
<Button type={'primary'} onClick={handleOk}>
保存
</Button>
<Button onClick={handleBack}>返回</Button>
</div>
</div>
</div>
);
};
export default StoreDescView;
......@@ -98,9 +98,9 @@ const StoreBusinessCase: React.FC<{
},
];
return (
<>
<div className={'store-title flex-between'}>
<div className='title'>企业业务案例</div>
<div style={{ width: '880px', paddingTop: '10px' }}>
<div className={'store-title flex-start'} style={{ marginBottom: '15px' }}>
{/*<div className='title'>企业业务案例</div>*/}
<div className='action'>
<Button icon={<PlusOutlined />} type={'primary'} onClick={() => setIsAddSolution(true)}>
添加企业案例
......@@ -125,7 +125,7 @@ const StoreBusinessCase: React.FC<{
getSolutionList().then();
}}
/>
</>
</div>
);
};
......
......@@ -115,7 +115,7 @@ const StoreFormView: React.FC<{
if (!detail?.id) return;
form.setFieldsValue({
...detail,
content: detail?.content || '航拍航测',
content: detail?.content,
address: detail?.address,
name: detail?.companyName,
attachmentList: detail?.attachmentList,
......@@ -131,16 +131,7 @@ const StoreFormView: React.FC<{
getImageVideo();
}, []);
return (
<>
<div className={'store-title flex-between'}>
<div className='title'>店铺页面</div>
<div className='action flex-between'>
<Button type={'primary'} onClick={handleOk}>
保存
</Button>
<Button onClick={handleBack}>返回</Button>
</div>
</div>
<div style={{ width: '580px', paddingTop: '20px' }}>
<Form form={form} labelCol={{ span: 3 }}>
<Form.Item
label='企业名称'
......@@ -204,7 +195,7 @@ const StoreFormView: React.FC<{
showCount
/>
</Form.Item>
<Form.Item label='企业宣传片' name='videoList'>
<Form.Item label='企业宣传片' name='videoList' style={{ visibility: 'hidden' }}>
<Uploader
fileUpload
listType='picture-card'
......@@ -220,9 +211,9 @@ const StoreFormView: React.FC<{
{/*<Form.Item label='营业执照'>*/}
{/* <Image src={detail?.licenseImg} width={45} height={45} />*/}
{/*</Form.Item>*/}
<Form.Item label='备注' name='remark'>
<Input.TextArea placeholder='请输入备注' maxLength={70} showCount rows={4} />
</Form.Item>
{/*<Form.Item label='备注' name='remark'>*/}
{/* <Input.TextArea placeholder='请输入备注' maxLength={70} showCount rows={4} />*/}
{/*</Form.Item>*/}
</Form>
<SelectMapModal
title='选择位置'
......@@ -236,7 +227,16 @@ const StoreFormView: React.FC<{
setOpenAddress(false);
}}
/>
</>
<div className={'store-title flex-center'}>
{/*<div className='title'>店铺页面</div>*/}
<div className='action flex-between' style={{ width: '120px' }}>
<Button type={'primary'} onClick={handleOk}>
保存
</Button>
<Button onClick={handleBack}>返回</Button>
</div>
</div>
</div>
);
};
......
......@@ -107,9 +107,9 @@ const StoreSolutionView: React.FC<{
},
];
return (
<>
<div className={'store-title flex-between'}>
<div className='title'>行业解决方案</div>
<div style={{ width: '880px', paddingTop: '10px' }}>
<div className={'store-title flex-start'} style={{ marginBottom: '15px' }}>
{/*<div className='title'>行业解决方案</div>*/}
<div className='action'>
<Button icon={<PlusOutlined />} type={'primary'} onClick={() => setIsAddSolution(true)}>
添加解决方案
......@@ -134,7 +134,7 @@ const StoreSolutionView: React.FC<{
getSolutionList().then();
}}
/>
</>
</div>
);
};
......
......@@ -22,7 +22,7 @@
}
.action {
width: 110px;
width: 200px;
}
}
}
......
......@@ -5,8 +5,10 @@ import { SystemManageAPI } from '~/api';
import { getCompanyInfoByIdType } from '~/api/interface/systemManageType';
import './index.scss';
import StoreFormView from '~/pages/resourceManage/storeDecorate/comp/storeFormView';
import StoreBusinessCase from '~/pages/resourceManage/storeDecorate/comp/storeBusinessCase';
import { Tabs, TabsProps } from 'antd';
import StoreSolutionView from '~/pages/resourceManage/storeDecorate/comp/storeSolutionView';
import StoreBusinessCase from '~/pages/resourceManage/storeDecorate/comp/storeBusinessCase';
import StoreDescView from '~/pages/resourceManage/storeDecorate/comp/StoreDescView';
// 店铺类型
type StoreType = InterDataType<getCompanyInfoByIdType>;
......@@ -23,29 +25,54 @@ const StoreDecoratePage: React.FC = () => {
// console.log('获取店铺数据 --->', res.result);
}
};
// 获取tab栏数据
const getTabList = (): TabsProps['items'] => {
if (!storeDetail?.id) return;
let list = [
{
label: '基本信息',
key: '1',
children: <StoreFormView detail={storeDetail} onRefresh={getStoreApplyDetail} />,
},
{
label: '企业介绍',
key: '4',
children: <StoreDescView detail={storeDetail} onRefresh={getStoreApplyDetail} />,
},
];
// 飞手团队特有
if (storeDetail?.cooperationTagId === 5) {
list = [
...list,
{
label: '解决方案',
key: '2',
children: <StoreSolutionView detail={storeDetail} />,
},
];
}
// 产品商城特有
if (storeDetail?.cooperationTagId === 1) {
list = [
...list,
{
label: '业务案例',
key: '3',
children: <StoreBusinessCase detail={storeDetail} />,
},
];
}
// 排序
return list?.sort((a, b) => Number(a.key) - Number(b.key));
};
// 页面挂载
useEffect(() => {
if (store.getState().UserInfo?.userInfo?.companyInfoVO?.id) getStoreApplyDetail().then();
// console.log('页面挂载 --->', store.getState().UserInfo?.userInfo);
}, []);
return (
<div className={'store-decorate-wrap flex-start'}>
{!!storeDetail?.id && (
<>
<div className={'store-form'}>
<StoreFormView detail={storeDetail} onRefresh={getStoreApplyDetail} />
</div>
{storeDetail?.cooperationTagId === 5 ? (
<div className={'store-solution'}>
<StoreSolutionView detail={storeDetail} />
</div>
) : (
<div className={'store-solution'}>
<StoreBusinessCase detail={storeDetail} />
</div>
)}
</>
)}
<div className={'store-decorate-wrap'}>
{!!storeDetail?.id && <Tabs items={getTabList()} />}
</div>
);
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论