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(','),
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(','),
pbcBusinessVideo: values.pbcBusinessVideo && values.pbcBusinessVideo.length > 0 && values.pbcBusinessVideo[0].response && values.pbcBusinessVideo[0].response.data ? values.pbcBusinessVideo[0].response.data : '',
pbcZone: undefined
}
const msg = await addBusinessForAdminUsingPost(params)
@ -496,6 +497,52 @@ const Detail: React.FC<any> = () => {
</DndContext>
</Col>
</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>
</ProForm>
</PageContainer>

@ -16,7 +16,7 @@ import { DndContext, DragEndEvent, PointerSensor, useSensor } from '@dnd-kit/cor
import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
import { useAccess, useParams, useSearchParams } from '@umijs/max';
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 { CSS } from '@dnd-kit/utilities';
@ -115,14 +115,61 @@ const Detail: React.FC<any> = () => {
valueTypeMap={{
upload: {
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>
) : (
<span></span>
);
},
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)}>
<SortableContext items={form1.getFieldValue(props.id) ? form1.getFieldValue(props.id).map((i: any) => i.uid) : []} strategy={verticalListSortingStrategy}>
<ProFormUploadButton
@ -235,6 +282,11 @@ const Detail: React.FC<any> = () => {
pbcBusinessLogo: key === 'pbcBusinessLogo' ? pbcBusinessLogo : info.pbcBusinessLogo,
pbcBusinessImage: key === 'pbcBusinessImage' ? pbcBusinessImage.join(',') : info.pbcBusinessImage,
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) => {
if (res.retcode) {
@ -305,6 +357,14 @@ const Detail: React.FC<any> = () => {
url: e,
}
}) : [],
pbcBusinessVideo: info.pbcBusinessVideo ? [
{
uid: '-1',
name: 'video.mp4',
status: 'done',
url: info.pbcBusinessVideo,
},
] : [],
}}
columns={[
{
@ -395,6 +455,13 @@ const Detail: React.FC<any> = () => {
span: 3,
valueType: 'upload',
},
{
title: '商家视频',
key: 'pbcBusinessVideo',
dataIndex: 'pbcBusinessVideo',
span: 3,
valueType: 'upload'
}
]}
column={3}
></ProDescriptions>
@ -405,7 +472,6 @@ const Detail: React.FC<any> = () => {
valueTypeMap={{
upload: {
render: (text) => {
console.log(text)
return text.length > 0 ? text.map((e: any) =>
<Image key={e.url} width={200} src={e.url}></Image>
) : (

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

@ -185,6 +185,13 @@ const Detail: React.FC<any> = () => {
url: 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) => ({
uid: url,
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(','),
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 : '',
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(',') : '',
pbcZone: undefined,
colorItems: undefined,
@ -720,9 +728,41 @@ const Detail: React.FC<any> = () => {
<Row gutter={20}>
<Col span={24}>
<ProFormUploadButton
label="封面视频"
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}>
<ProFormUploadButton
label="封面视频"
name="pbcProductHomepagePromotion"
max={1}
fieldProps={{
name: 'file',
accept: 'video/mp4',

@ -144,7 +144,12 @@ const Detail: React.FC<any> = () => {
</Descriptions.Item>
<Descriptions.Item label="封面视频" span={3}>
{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 label="详情视频" span={3}>

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

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

Loading…
Cancel
Save