From cbd476d1e285c378423577a0c8445da81f30d69a Mon Sep 17 00:00:00 2001 From: callmeyan Date: Tue, 15 Apr 2025 15:03:08 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=20=E8=AE=A2=E5=8D=95=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/images/error/error_img.svg | 4 +++ src/components/article/block.tsx | 6 ++-- src/components/video/video-list-item.tsx | 28 ++++++++++----- src/i18n/translations/en-US.json | 2 ++ src/i18n/translations/zh-CN.json | 2 ++ src/pages/news/components/style.module.scss | 15 +++++++- src/pages/order/index.tsx | 39 +++++++++++++-------- src/pages/recycle/index.tsx | 28 ++++++++++----- src/pages/video/index.tsx | 7 +++- vite.config.ts | 2 +- 10 files changed, 95 insertions(+), 38 deletions(-) create mode 100644 src/assets/images/error/error_img.svg diff --git a/src/assets/images/error/error_img.svg b/src/assets/images/error/error_img.svg new file mode 100644 index 0000000..d14725f --- /dev/null +++ b/src/assets/images/error/error_img.svg @@ -0,0 +1,4 @@ + + + diff --git a/src/components/article/block.tsx b/src/components/article/block.tsx index 612dbbc..b385041 100644 --- a/src/components/article/block.tsx +++ b/src/components/article/block.tsx @@ -8,6 +8,7 @@ import ImageList from "@/components/article/list.tsx"; import { BlockText} from "./item.tsx"; import styles from './article.module.scss' import {useTranslation} from "react-i18next"; +import ModalWarning from "@/components/icons/ModalWarning.tsx"; type Props = { children?: React.ReactNode; @@ -86,8 +87,9 @@ export default function ArticleBlock( rootClassName={'popconfirm-main'} placement={'left'} arrow={false} - icon={} - title={
{t('news.edit_delete_group_confirm')}
} + icon={} + title={} + description={
{t('news.edit_delete_group_confirm')}
} onConfirm={onRemove} okText={t('delete')} cancelText={t('cancel')} diff --git a/src/components/video/video-list-item.tsx b/src/components/video/video-list-item.tsx index b94a7ca..21ffd28 100644 --- a/src/components/video/video-list-item.tsx +++ b/src/components/video/video-list-item.tsx @@ -17,6 +17,7 @@ import {formatTime} from "@/util/strings.ts"; import {useTranslation} from "react-i18next"; import {saveAs} from "file-saver"; import {DeleteItemPopoverConfirm} from "@/components/message/confirm.tsx"; +import {showLoading, showToast} from "@/components/message.ts"; type Props = { video: VideoInfo | LiveVideoInfo, @@ -54,7 +55,7 @@ export const VideoListItem = ( setNodeRef, transform } = useSortable({resizeObserverConfig: {}, id}) - const {t} = useTranslation() + const {t,i18n} = useTranslation() const [state, setState] = useSetState<{ checked?: boolean }>({}) useEffect(() => { setState({checked}) @@ -65,7 +66,14 @@ export const VideoListItem = ( const handleDownloadVideo = () => { if (downloadUrl && video.status == VideoStatus.Generated) { const ext = downloadUrl.substring(downloadUrl.lastIndexOf('.')) - saveAs(downloadUrl, `${video.title || video.video_title}${ext}`) + const loading = showLoading(t('downloading')) + try{ + saveAs(downloadUrl, `${video.title || video.video_title}${ext}`) + loading.close() + }catch (e){ + loading.update(t('download_failed'),'error') + } + } } return
*/} {/* */} {/* : )}*/} -
+
{downloadUrl && video.status == VideoStatus.Generated && } {additionOperationBefore} @@ -145,7 +153,7 @@ export const VideoListItem = ( e.preventDefault() e.stopPropagation() onEdit?.() - }} style={{fontSize: '1.1em'}}> + }} style={{fontSize: '1.1em'}} title={i18n.language == 'zh-CN'?'修改':'Modify'}> } {onRegenerate && } - {onRemove && onRemove(failed ? 'rollback' : 'delete')}> - } - {hideCheckBox ? : + {hideCheckBox ? <> : { if (onCheckedChange) { onCheckedChange(!state.checked) diff --git a/src/i18n/translations/en-US.json b/src/i18n/translations/en-US.json index ac8b207..401d115 100644 --- a/src/i18n/translations/en-US.json +++ b/src/i18n/translations/en-US.json @@ -15,6 +15,8 @@ "delete_failed": "Delete failed", "delete_success": "Delete success", "download": "Download", + "downloading": "Downloading...", + "download_fail": "Download Failed", "error_401": "You do not have permission to access this page", "error_403": "You do not have permission to access this page", "error_404": "Page not found", diff --git a/src/i18n/translations/zh-CN.json b/src/i18n/translations/zh-CN.json index 13efc0f..76de84d 100644 --- a/src/i18n/translations/zh-CN.json +++ b/src/i18n/translations/zh-CN.json @@ -15,6 +15,8 @@ "delete_failed": "删除失败", "delete_success": "删除成功", "download": "下载", + "downloading": "下载中...", + "download_fail": "下载失败", "error_401": "您没有权限访问本页面", "error_403": "您没有权限访问本页面", "error_404": "访问的页面不存在", diff --git a/src/pages/news/components/style.module.scss b/src/pages/news/components/style.module.scss index 60ca092..eee4647 100644 --- a/src/pages/news/components/style.module.scss +++ b/src/pages/news/components/style.module.scss @@ -55,6 +55,9 @@ left:0; } } + .cover{ + @apply pl-2; + } .title{ @apply flex-1 pl-0; &:after{ @@ -100,13 +103,23 @@ .orderDataList{ :global { + .title{ + justify-content: left; + } .id{ @apply pl-0; - width: 120px; + width: 130px; + line-height: 1.2em; &:after{ display: none; } } + .cover{ + img{ + width: 120px; + max-height: 50px; + } + } .title { @apply flex-1 pl-4; min-width: 100px; diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 02a0c36..7059579 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -1,19 +1,19 @@ -import SearchPanel from "@/pages/news/components/search-panel.tsx"; import React, {useState} from "react"; import {useTranslation} from "react-i18next"; -import styles from "@/pages/news/components/style.module.scss"; +import {Empty, Image, Pagination} from "antd"; +import {useRequest} from "ahooks"; +import SearchPanel from "@/pages/news/components/search-panel.tsx"; +import styles from "@/pages/news/components/style.module.scss"; import {formatDurationToTime, formatTime} from "@/util/strings.ts"; -import {IconDelete, IconEdit, IconWarningCircle} from "@/components/icons"; -import {Empty, Pagination, PaginationProps, Popconfirm} from "antd"; -import {useRequest, useSetState} from "ahooks"; import {getList} from "@/service/api/order.ts"; +import ImageErr from "@/assets/images/error/error_img.svg" function OrderIndex() { const {t} = useTranslation() const [params, setParams] = useState({ - pagination: {page: 1, limit: 12}, + pagination: {page: 1, limit: 10}, time_flag: 0, }) const {data} = useRequest(() => getList(params), { @@ -33,10 +33,10 @@ function OrderIndex() {
{t('order.list.id')}
-
{t('order.list.cover')}
+
{t('order.list.cover')}
{t('order.list.title')}
{t('order.list.order_time')}
-
{t('order.list.consume_time')}
+
{t('order.list.consume_time')}
{t('order.list.operator')}
@@ -47,21 +47,24 @@ function OrderIndex() { return
-
{item.order_id}
+
{item.order_id}
-
- +
+
-
-
{item.title}
+
+
{item.title}
{formatTime(item.order_time, 'YYYY-MM-DD HH:mm')}
-
+
{formatTime(item.consumption_duration, 'YYYY-MM-DD HH:mm')}
+ className="text-sm">{formatDurationToTime(item.consumption_duration)}
{item.operator}
@@ -71,6 +74,12 @@ function OrderIndex() {
{ + setParams({ + ...params, + pagination: {page, limit} + }) + }} total={data?.pagination.total || 0} showTotal={(total) =>
{t('page.total_item', {total})}
} showSizeChanger={{ diff --git a/src/pages/recycle/index.tsx b/src/pages/recycle/index.tsx index e96980f..1c761ed 100644 --- a/src/pages/recycle/index.tsx +++ b/src/pages/recycle/index.tsx @@ -1,5 +1,5 @@ import React, {useEffect, useRef, useState} from "react"; -import {Checkbox, Modal, Space} from "antd"; +import {Checkbox, Empty, Modal, Space} from "antd"; import {useRequest, useSetState} from "ahooks"; import {useTranslation} from "react-i18next"; @@ -78,7 +78,7 @@ export default function RecycleIndex() { autoPlay: boolean }>() const handleAllCheckedChange = (checked: boolean) => { - if (!data) return; + if (!data || data.pagination.total == 0) return; setCheckedIdArray(checked ? data.list.map(v => v.id) : []) setState({ checkedAll: !state.checkedAll @@ -107,7 +107,12 @@ export default function RecycleIndex() { {contextHolder}
{ + setParams({ + ...params, + pagination: {...DEFAULT_PAGE_LIMIT} + }) + }} onBtnStartClick={handleLive} loading={loading} /> @@ -126,8 +131,10 @@ export default function RecycleIndex() { {t("select.select_all")} {/**/} - handleAllCheckedChange(e.target.checked)}/> + handleAllCheckedChange(e.target.checked)}/>
setState({showToTop: top > 30})} > + {data?.pagination.total == 0 && !loading &&
+ +
}
{data?.list?.map((it, idx) => ( } onProcess={restore} confirmMessage={} + __html: checkedIdArray.length == 1 + ? t('video.restore_confirm') + : t('video.restore_confirm_count', {count: checkedIdArray.length}) + }}>} emptyMessage={t('video.push_empty')} onError={e => { showToast(String((e as BizError).data || e.message), 'error') diff --git a/src/pages/video/index.tsx b/src/pages/video/index.tsx index c8510ea..a1625c8 100644 --- a/src/pages/video/index.tsx +++ b/src/pages/video/index.tsx @@ -306,6 +306,11 @@ export default function VideoIndex() {
- setEditId(-1)}/> + { + setEditId(-1) + if(saved) { + loadList() + } + }}/>
) } \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index bc4ad4c..66957b1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -30,7 +30,7 @@ export default defineConfig(({mode}) => { AUTH_TOKEN_KEY: process.env.AUTH_TOKEN_KEY || AUTH_TOKEN_KEY, AUTHED_PERSON_DATA_KEY: process.env.AUTHED_PERSON_DATA_KEY || 'digital-person-user-info', ONLY_LIVE: process.env.ONLY_LIVE || 'no', - APP_LANG: process.env.APP_LANGUAGE || 'multiple' + APP_LANG: process.env.APP_LANGUAGE }), AppMode: JSON.stringify(mode), AppBuildVersion: JSON.stringify(AppPackage.name + '-' + AppPackage.version + '-' + dayjs().format('YYYYMMDDHH_mmss'))