dev-v2
Joe 4 months ago
parent af3bdb782c
commit 582d47975c

@ -76,6 +76,7 @@ const Detail: React.FC<any> = () => {
pbcBusinessHeadUserNoBackUrl: values.pbcBusinessHeadUserNoBackUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','), pbcBusinessHeadUserNoBackUrl: values.pbcBusinessHeadUserNoBackUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessHeadUserNoFrontUrl: values.pbcBusinessHeadUserNoFrontUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','), pbcBusinessHeadUserNoFrontUrl: values.pbcBusinessHeadUserNoFrontUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessLicenseUrl: values.pbcBusinessLicenseUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','), pbcBusinessLicenseUrl: values.pbcBusinessLicenseUrl.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcBusinessVideo: values.pbcBusinessVideo && values.pbcBusinessVideo.length > 0 && values.pbcBusinessVideo[0].response && values.pbcBusinessVideo[0].response.data ? values.pbcBusinessVideo[0].response.data : '',
pbcZone: undefined pbcZone: undefined
} }
const msg = await addBusinessForAdminUsingPost(params) const msg = await addBusinessForAdminUsingPost(params)
@ -496,6 +497,52 @@ const Detail: React.FC<any> = () => {
</DndContext> </DndContext>
</Col> </Col>
</Row> </Row>
<Row gutter={20}>
<Col span={24}>
<ProFormUploadButton
label="商家视频"
name="pbcBusinessVideo"
max={1}
fieldProps={{
name: 'file',
accept: 'video/mp4',
multiple: false,
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: process.env.BASE_URL + '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt100M = file.size / 1024 / 1024 < 100;
if (!isLt100M) {
message.error('视频大小不能超过100MB!');
}
return isLt100M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
const url = file.url || (file.response && file.response.data);
if (!url) {
message.warning('无法预览该文件');
return;
}
if (/\.mp4($|\?)/i.test(url)) {
const videoWindow = window.open('', '_blank');
if (videoWindow) {
videoWindow.document.write(`
<html>
<body style=\"margin:0;display:flex;align-items:center;justify-content:center;height:100vh;background:#000;\">
<video src=\"${url}\" controls autoplay style=\"max-width:100vw;max-height:100vh;\"></video>
</body>
</html>
`);
}
} else {
window.open(url);
}
},
}}
/>
</Col>
</Row>
</ProCard> </ProCard>
</ProForm> </ProForm>
</PageContainer> </PageContainer>

@ -16,7 +16,7 @@ import { DndContext, DragEndEvent, PointerSensor, useSensor } from '@dnd-kit/cor
import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'; import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
import { useAccess, useParams, useSearchParams } from '@umijs/max'; import { useAccess, useParams, useSearchParams } from '@umijs/max';
import { Button, Form, Image, message, Tag } from 'antd'; import { Button, Form, Image, message, Tag } from 'antd';
import { RcFile, UploadFile } from 'antd/es/upload'; import Upload, { RcFile, UploadFile } from 'antd/es/upload';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { CSS } from '@dnd-kit/utilities'; import { CSS } from '@dnd-kit/utilities';
@ -115,14 +115,61 @@ const Detail: React.FC<any> = () => {
valueTypeMap={{ valueTypeMap={{
upload: { upload: {
render: (text) => { render: (text) => {
return text.length > 0 ? text.map((e: any) => console.log(text)
return text.length > 0 ? /\.mp4($|\?)/i.test(text[0].url) ? <video width={240} height={160} controls src={text[0].url} style={{ background: '#000' }} /> : text.map((e: any) =>
<Image key={e.url} width={200} src={e.url}></Image> <Image key={e.url} width={200} src={e.url}></Image>
) : ( ) : (
<span></span> <span></span>
); );
}, },
renderFormItem: (text, props: any) => { renderFormItem: (text, props: any) => {
return ( return props.id === 'pbcBusinessVideo' ? (
<ProFormUploadButton
{...props}
{...props?.fieldProps}
max={1}
fieldProps={{
name: 'file',
accept: 'video/mp4',
multiple: false,
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: process.env.BASE_URL + '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt100M = file.size / 1024 / 1024 < 100;
if (!isLt100M) {
message.error('视频大小不能超过100MB!');
}
return isLt100M || Upload.LIST_IGNORE;
},
onChange: (a: any) => {
props?.fieldProps.onChange(a.fileList);
},
onPreview: async (file) => {
const url = file.url || (file.response && file.response.data);
if (!url) {
message.warning('无法预览该文件');
return;
}
if (/\.mp4($|\?)/i.test(url)) {
const videoWindow = window.open('', '_blank');
if (videoWindow) {
videoWindow.document.write(`
<html>
<body style=\"margin:0;display:flex;align-items:center;justify-content:center;height:100vh;background:#000;\">
<video src=\"${url}\" controls autoplay style=\"max-width:100vw;max-height:100vh;\"></video>
</body>
</html>
`);
}
} else {
window.open(url);
}
},
}}
/>
) : (
<DndContext sensors={[sensor]} onDragEnd={(event) => onDragEnd(event, props.id, 1)}> <DndContext sensors={[sensor]} onDragEnd={(event) => onDragEnd(event, props.id, 1)}>
<SortableContext items={form1.getFieldValue(props.id) ? form1.getFieldValue(props.id).map((i: any) => i.uid) : []} strategy={verticalListSortingStrategy}> <SortableContext items={form1.getFieldValue(props.id) ? form1.getFieldValue(props.id).map((i: any) => i.uid) : []} strategy={verticalListSortingStrategy}>
<ProFormUploadButton <ProFormUploadButton
@ -235,6 +282,11 @@ const Detail: React.FC<any> = () => {
pbcBusinessLogo: key === 'pbcBusinessLogo' ? pbcBusinessLogo : info.pbcBusinessLogo, pbcBusinessLogo: key === 'pbcBusinessLogo' ? pbcBusinessLogo : info.pbcBusinessLogo,
pbcBusinessImage: key === 'pbcBusinessImage' ? pbcBusinessImage.join(',') : info.pbcBusinessImage, pbcBusinessImage: key === 'pbcBusinessImage' ? pbcBusinessImage.join(',') : info.pbcBusinessImage,
pbcBusinessPosterUrl: key === 'pbcBusinessPosterUrl' ? pbcBusinessPosterUrl.join(',') : info.pbcBusinessPosterUrl, pbcBusinessPosterUrl: key === 'pbcBusinessPosterUrl' ? pbcBusinessPosterUrl.join(',') : info.pbcBusinessPosterUrl,
pbcBusinessVideo: key === 'pbcBusinessVideo' && record[key] && record[key].length > 0
? (record[key][0].response && record[key][0].response.retcode
? record[key][0].response.data
: record[key][0].url)
: info.pbcBusinessVideo,
}) })
.then((res) => { .then((res) => {
if (res.retcode) { if (res.retcode) {
@ -305,6 +357,14 @@ const Detail: React.FC<any> = () => {
url: e, url: e,
} }
}) : [], }) : [],
pbcBusinessVideo: info.pbcBusinessVideo ? [
{
uid: '-1',
name: 'video.mp4',
status: 'done',
url: info.pbcBusinessVideo,
},
] : [],
}} }}
columns={[ columns={[
{ {
@ -395,6 +455,13 @@ const Detail: React.FC<any> = () => {
span: 3, span: 3,
valueType: 'upload', valueType: 'upload',
}, },
{
title: '商家视频',
key: 'pbcBusinessVideo',
dataIndex: 'pbcBusinessVideo',
span: 3,
valueType: 'upload'
}
]} ]}
column={3} column={3}
></ProDescriptions> ></ProDescriptions>
@ -405,7 +472,6 @@ const Detail: React.FC<any> = () => {
valueTypeMap={{ valueTypeMap={{
upload: { upload: {
render: (text) => { render: (text) => {
console.log(text)
return text.length > 0 ? text.map((e: any) => return text.length > 0 ? text.map((e: any) =>
<Image key={e.url} width={200} src={e.url}></Image> <Image key={e.url} width={200} src={e.url}></Image>
) : ( ) : (

@ -47,7 +47,12 @@ const TableList: React.FC<{}> = () => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
const access: any = useAccess(); const access: any = useAccess();
const columns: ProColumns<API.PbcBusinessApproval>[] = [ const columns: ProColumns<API.PbcBusiness>[] = [
{
title: '商户ID',
dataIndex: 'pbcId',
search: false
},
{ {
title: '商户名称', title: '商户名称',
dataIndex: 'pbcBusinessName', dataIndex: 'pbcBusinessName',
@ -158,7 +163,7 @@ const TableList: React.FC<{}> = () => {
breadcrumb: {}, breadcrumb: {},
}} }}
> >
<ProTable<API.PbcBusinessApproval> <ProTable<API.PbcBusiness>
columns={columns} columns={columns}
actionRef={actionRef} actionRef={actionRef}
request={(param: any) => { request={(param: any) => {

@ -185,6 +185,13 @@ const Detail: React.FC<any> = () => {
url: data.pbcProductVideoThumbnail, url: data.pbcProductVideoThumbnail,
response: { data: data.pbcProductVideoThumbnail } response: { data: data.pbcProductVideoThumbnail }
}] : [], }] : [],
pbcProductHomepagePromotion: data.pbcProductHomepagePromotion ? [{
uid: data.pbcProductHomepagePromotion,
name: data.pbcProductHomepagePromotion.substring(data.pbcProductHomepagePromotion.lastIndexOf('/') + 1),
status: 'done',
url: data.pbcProductHomepagePromotion,
response: { data: data.pbcProductHomepagePromotion }
}] : [],
pbcProductDetailVideos: data.pbcProductDetailVideos ? data.pbcProductDetailVideos.split(',').map((url: string) => ({ pbcProductDetailVideos: data.pbcProductDetailVideos ? data.pbcProductDetailVideos.split(',').map((url: string) => ({
uid: url, uid: url,
name: url.substring(url.lastIndexOf('/') + 1), name: url.substring(url.lastIndexOf('/') + 1),
@ -327,6 +334,7 @@ const Detail: React.FC<any> = () => {
pbcProductImages: values.pbcProductImages.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','), pbcProductImages: values.pbcProductImages.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcProductDetailImages: values.pbcProductDetailImages.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','), pbcProductDetailImages: values.pbcProductDetailImages.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
pbcProductVideoThumbnail: values.pbcProductVideoThumbnail && values.pbcProductVideoThumbnail.length > 0 ? values.pbcProductVideoThumbnail[0].response.data : '', pbcProductVideoThumbnail: values.pbcProductVideoThumbnail && values.pbcProductVideoThumbnail.length > 0 ? values.pbcProductVideoThumbnail[0].response.data : '',
pbcProductHomepagePromotion: values.pbcProductHomepagePromotion && values.pbcProductHomepagePromotion.length > 0 ? values.pbcProductHomepagePromotion[0].response.data : '',
pbcProductDetailVideos: values.pbcProductDetailVideos && values.pbcProductDetailVideos.length > 0 ? values.pbcProductDetailVideos.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(',') : '', pbcProductDetailVideos: values.pbcProductDetailVideos && values.pbcProductDetailVideos.length > 0 ? values.pbcProductDetailVideos.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(',') : '',
pbcZone: undefined, pbcZone: undefined,
colorItems: undefined, colorItems: undefined,
@ -718,10 +726,42 @@ const Detail: React.FC<any> = () => {
</Col> </Col>
</Row> </Row>
<Row gutter={20}> <Row gutter={20}>
<Col span={24}>
<ProFormUploadButton
label="视频封面"
name="pbcProductVideoThumbnail"
max={1}
fieldProps={{
name: 'file',
accept: 'image/*',
multiple: false,
headers: {
authorization: localStorage.getItem('token') ?? '',
},
action: process.env.BASE_URL + '/oss/imgUpload',
beforeUpload(file: RcFile) {
const isLt2M = file.size / 1024 / 1024 < 10;
if (!isLt2M) {
message.error('图片大小不能超过10MB!');
}
return isLt2M || Upload.LIST_IGNORE;
},
onPreview: async (file) => {
if (file.response && file.response.data) {
window.open(file.response.data);
}
},
listType: 'picture-card',
}}
rules={[
{ required: false, message: '请上传视频封面' },
]}
/>
</Col>
<Col span={24}> <Col span={24}>
<ProFormUploadButton <ProFormUploadButton
label="封面视频" label="封面视频"
name="pbcProductVideoThumbnail" name="pbcProductHomepagePromotion"
max={1} max={1}
fieldProps={{ fieldProps={{
name: 'file', name: 'file',

@ -144,7 +144,12 @@ const Detail: React.FC<any> = () => {
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="封面视频" span={3}> <Descriptions.Item label="封面视频" span={3}>
{info.pbcProductVideoThumbnail ? ( {info.pbcProductVideoThumbnail ? (
<video width={240} height={160} controls src={info.pbcProductVideoThumbnail} style={{ background: '#000' }} /> <Image style={{ objectFit: 'contain' }} width={100} height={100} src={info.pbcProductVideoThumbnail} />
) : '-'}
</Descriptions.Item>
<Descriptions.Item label="封面视频" span={3}>
{info.pbcProductHomepagePromotion ? (
<video width={240} height={160} controls src={info.pbcProductHomepagePromotion} style={{ background: '#000' }} />
) : '-'} ) : '-'}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="详情视频" span={3}> <Descriptions.Item label="详情视频" span={3}>

@ -2,41 +2,41 @@
/* eslint-disable */ /* eslint-disable */
import request from '@/utils/request'; import request from '@/utils/request';
/** error GET /error */ /** errorHtml GET /error */
export async function errorUsingGet(options?: { [key: string]: any }) { export async function errorHtmlUsingGet(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', { return request<API.ModelAndView>('/error', {
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}); });
} }
/** error PUT /error */ /** errorHtml PUT /error */
export async function errorUsingPut(options?: { [key: string]: any }) { export async function errorHtmlUsingPut(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', { return request<API.ModelAndView>('/error', {
method: 'PUT', method: 'PUT',
...(options || {}), ...(options || {}),
}); });
} }
/** error POST /error */ /** errorHtml POST /error */
export async function errorUsingPost(options?: { [key: string]: any }) { export async function errorHtmlUsingPost(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', { return request<API.ModelAndView>('/error', {
method: 'POST', method: 'POST',
...(options || {}), ...(options || {}),
}); });
} }
/** error DELETE /error */ /** errorHtml DELETE /error */
export async function errorUsingDelete(options?: { [key: string]: any }) { export async function errorHtmlUsingDelete(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', { return request<API.ModelAndView>('/error', {
method: 'DELETE', method: 'DELETE',
...(options || {}), ...(options || {}),
}); });
} }
/** error PATCH /error */ /** errorHtml PATCH /error */
export async function errorUsingPatch(options?: { [key: string]: any }) { export async function errorHtmlUsingPatch(options?: { [key: string]: any }) {
return request<Record<string, any>>('/error', { return request<API.ModelAndView>('/error', {
method: 'PATCH', method: 'PATCH',
...(options || {}), ...(options || {}),
}); });

@ -1770,6 +1770,8 @@ declare namespace API {
pbcBusinessState?: number; pbcBusinessState?: number;
/** 商户类型 */ /** 商户类型 */
pbcBusinessType?: string; pbcBusinessType?: string;
/** 商户视频 */
pbcBusinessVideo?: string;
/** 创建时间 */ /** 创建时间 */
pbcCreateAt?: string; pbcCreateAt?: string;
/** 创建人 */ /** 创建人 */
@ -1847,6 +1849,8 @@ declare namespace API {
pbcBusinessStartDate?: string; pbcBusinessStartDate?: string;
/** 商户类别 */ /** 商户类别 */
pbcBusinessType?: string; pbcBusinessType?: string;
/** 商户视频 */
pbcBusinessVideo?: string;
/** 创建时间 */ /** 创建时间 */
pbcCreateAt?: string; pbcCreateAt?: string;
/** 创建人 */ /** 创建人 */
@ -1928,6 +1932,8 @@ declare namespace API {
pbcBusinessType?: string; pbcBusinessType?: string;
/** 商家唯一值 */ /** 商家唯一值 */
pbcBusinessUuid?: string; pbcBusinessUuid?: string;
/** 商户视频 */
pbcBusinessVideo?: string;
/** 创建时间 */ /** 创建时间 */
pbcCreateAt?: string; pbcCreateAt?: string;
/** 创建人 */ /** 创建人 */
@ -1985,6 +1991,8 @@ declare namespace API {
pbcBusinessPosterUrl?: string; pbcBusinessPosterUrl?: string;
/** 商户省份 */ /** 商户省份 */
pbcBusinessProvince?: string; pbcBusinessProvince?: string;
/** 商户视频 */
pbcBusinessVideo?: string;
/** 主键 */ /** 主键 */
pbcId?: number; pbcId?: number;
}; };

Loading…
Cancel
Save