From d4f82dbc3ee8d9e0cb4dfa9724ef86f0a255ff10 Mon Sep 17 00:00:00 2001 From: rd <1344903914@qq.com> Date: Mon, 22 Sep 2025 11:23:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?refactor(material-center):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整了 `ant-table` 和 `ant-input` 的样式 - 优化了文件名截取长度和上传状态显示 - 移除了未使用的图标导入 - 更新了删除图标为 `icon-delete` 组件 - 修正了提示信息的样式和内容 - 重构了 `add-raw-material-drawer` 的样式和布局 --- src/styles/components/ant-input.scss | 2 +- src/styles/components/ant-modal.scss | 6 + src/styles/components/ant-select.scss | 33 +++- src/styles/components/ant-table.scss | 42 +++-- src/styles/components/ant-textarea.scss | 2 +- src/utils/tools.ts | 2 +- .../add-raw-material-drawer/index.vue | 32 ++-- .../add-raw-material-drawer/style.scss | 175 ++++++++++-------- .../raw-material/components/table/index.vue | 12 +- 9 files changed, 188 insertions(+), 118 deletions(-) diff --git a/src/styles/components/ant-input.scss b/src/styles/components/ant-input.scss index 945df33..5e81ba8 100644 --- a/src/styles/components/ant-input.scss +++ b/src/styles/components/ant-input.scss @@ -27,7 +27,7 @@ &:focus-within, &.ant-input-focus, &.ant-textarea-focus { - background-color: var(--color-bg-2) !important; + background-color: #fff !important; border-color: $color-primary !important; box-shadow: 0 0 0 0 var(--color-primary-light-2) !important; } diff --git a/src/styles/components/ant-modal.scss b/src/styles/components/ant-modal.scss index c968195..7ac72de 100644 --- a/src/styles/components/ant-modal.scss +++ b/src/styles/components/ant-modal.scss @@ -41,6 +41,12 @@ .ant-modal-confirm-body-wrapper { .ant-modal-confirm-title { + font-family: $font-family-medium; + font-weight: 500; + color: #211F24; + font-size: 16px; + font-style: normal; + line-height: 24px; .anticon { font-size: 24px; } diff --git a/src/styles/components/ant-select.scss b/src/styles/components/ant-select.scss index 708f987..f5794f4 100644 --- a/src/styles/components/ant-select.scss +++ b/src/styles/components/ant-select.scss @@ -27,13 +27,28 @@ .ant-select-arrow { color: #737478; - //font-size: 14px; + + .anticon { + &.anticon-down { + color: #737478; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.9629 5.5L11.1379 4.67504L7.01314 8.79983L2.88835 4.67504L2.0634 5.5L6.60063 10.0372C6.60063 10.0372 6.60066 10.0373 7.01314 9.62479L6.60063 10.0372L7.01314 10.4497L11.9629 5.5Z' fill='%23737478'/%3E%3C/svg%3E"); + background-size: 14px; + width: 14px; + height: 14px; + background-repeat: no-repeat; + background-position: center right; + + > svg { + display: none; + } + } + } } &:focus, &-focused { .ant-select-selector { - background-color: var(--color-bg-2) !important; - border-color: rgb(var(--primary-6)) !important; + background-color: #fff !important; + border-color: $color-primary !important; box-shadow: 0 0 0 0 var(--color-primary-light-2) !important; } } @@ -44,7 +59,7 @@ &:not(.ant-select-disabled) { &:hover { .ant-select-selector { - border-color: rgb(var(--primary-6)) !important; + border-color: $color-primary !important; } } } @@ -55,6 +70,16 @@ } } + &.ant-select-open { + .ant-select-arrow { + .anticon { + &.anticon-down { + transform: rotate(180deg); + } + } + } + } + } .ant-select { diff --git a/src/styles/components/ant-table.scss b/src/styles/components/ant-table.scss index a53d7a6..3198601 100644 --- a/src/styles/components/ant-table.scss +++ b/src/styles/components/ant-table.scss @@ -56,20 +56,40 @@ } .ant-table-bordered { .ant-table-container { - .ant-table-thead { - .ant-table-cell { - border-inline-end: none !important ; - border-bottom: 1px solid var(--Border-1, #d7d7d9); - } - } - .ant-table-tbody { - .ant-table-row { - .ant-table-cell { - border-inline-end: none !important; - border-bottom: 1px solid var(--Border-1, #e6e6e8); + .ant-table-content { + > table { + border-top: none !important; + + .ant-table-thead { + .ant-table-cell { + border-inline-end: none !important; + border-bottom: 1px solid var(--Border-1, #d7d7d9); + } + + .ant-table-cell-fix-right-first { + &::after { + border-inline-end: none !important; + } + } + } + + .ant-table-tbody { + .ant-table-row { + .ant-table-cell { + border-inline-end: none !important; + border-bottom: 1px solid var(--Border-1, #e6e6e8); + } + + .ant-table-cell-fix-right-first { + &::after { + border-inline-end: none !important; + } + } + } } } } + } } } diff --git a/src/styles/components/ant-textarea.scss b/src/styles/components/ant-textarea.scss index 595c3fc..1f909fd 100644 --- a/src/styles/components/ant-textarea.scss +++ b/src/styles/components/ant-textarea.scss @@ -6,7 +6,7 @@ &:not(.ant-input-textarea-disabled) { &:hover { .ant-input { - border-color: rgb(var(--primary-6)) !important; + border-color: $color-primary !important; } } } diff --git a/src/utils/tools.ts b/src/utils/tools.ts index c0f2580..ecb1196 100644 --- a/src/utils/tools.ts +++ b/src/utils/tools.ts @@ -120,7 +120,7 @@ export function formatFileSize(bytes: number): string { if (bytes === 0) return '0 Bytes'; const k = 1024; - const sizes = ['Bytes', 'kb', 'mb', 'gb', 'tb']; + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; diff --git a/src/views/material-center/components/raw-material/components/add-raw-material-drawer/index.vue b/src/views/material-center/components/raw-material/components/add-raw-material-drawer/index.vue index 985b59b..26a803c 100644 --- a/src/views/material-center/components/raw-material/components/add-raw-material-drawer/index.vue +++ b/src/views/material-center/components/raw-material/components/add-raw-material-drawer/index.vue @@ -19,7 +19,7 @@ import { documentExtensions, } from '@/views/material-center/components/raw-material/constants'; -import icon1 from '@/assets/img/media-account/icon-delete.png'; +// import icon1 from '@/assets/img/media-account/icon-delete.png'; import icon2 from '../../img/icon-no-text.png'; enum EnumUploadStatus { @@ -186,7 +186,7 @@ export default defineComponent({ const currentData = { uid, - name, + name: name.slice(0, 20), // type, type: fileType, uploadStatus: statusText ? EnumUploadStatus.error : EnumUploadStatus.uploading, @@ -263,7 +263,7 @@ export default defineComponent({ if (hasUploading) { modalRef.value = Modal.warning({ title: '上传未完成', - content:
当前原料正在上传中,关闭弹窗将导致上传失败,请等待上传完成后再点击“确定”
, + content:当前原料正在上传中,关闭弹窗将导致上传失败,请等待上传完成后再点击“确定”
, okText: '我知道了', centered: true, }); @@ -312,7 +312,7 @@ export default defineComponent({ const renderUploadStatus = (record) => { if (record.uploadStatus === EnumUploadStatus.error) { return ( -上传失败
{record.statusText}
{record.uploadStatus === EnumUploadStatus.done ? '上传成功' : '上传中'}
{`视频格式:视频格式:MP4、AVI、MOV,大小<1000MB`}
+{`视频格式:MP4、AVI、MOV,大小<1000MB`}
{`图片格式:PNG、JPG、JPEG、GIF、WEBP、BMP,大小<20MB`}
{`文本格式:TXT、DOC、DOCX、PDF,大小<20MB`}
diff --git a/src/views/material-center/components/raw-material/components/add-raw-material-drawer/style.scss b/src/views/material-center/components/raw-material/components/add-raw-material-drawer/style.scss index d3db885..79331c9 100644 --- a/src/views/material-center/components/raw-material/components/add-raw-material-drawer/style.scss +++ b/src/views/material-center/components/raw-material/components/add-raw-material-drawer/style.scss @@ -1,110 +1,133 @@ -.xt-add-raw-material-modal { - .ant-drawer-header { - height: 58px; - border-bottom: none; - } +.xt-add-raw-material-drawer { + .ant-drawer-content { + border-radius: 16px 0 0 16px; - .ant-upload { - width: 100%; - } - - .ant-select { - //.ant-select-selection-overflow-item { - // max-width: 50%; - //} - } - - .ant-drawer-body { - padding: 0; - display: flex; - flex-direction: column; - - .cts { - color: #211f24; - font-family: $font-family-regular; - font-size: 14px; - font-style: normal; - font-weight: 400; - line-height: 22px; + .ant-drawer-header { + height: 58px; + border-bottom: none; } - .content { - .upload-box { - transition: all 0.3s; + .ant-upload { + width: 100%; + } - &:hover { - border-color: #6d4cfe; + .ant-select { + //.ant-select-selection-overflow-item { + // max-width: 50%; + //} + } + + .ant-table { + .ant-table-container { + display: flex; + flex-direction: column; + } + + .ant-table-header { + .ant-table-cell { + &::before { + display: none; + } } } + } - .upload-text { - color: #000; - text-align: center; + .ant-input-textarea { + &.no-resize { + textarea { + resize: none; + } + } + } + + .ant-drawer-body { + padding: 0; + display: flex; + flex-direction: column; + + .cts { + color: #211f24; font-family: $font-family-regular; - font-size: 12px; + font-size: 14px; font-style: normal; font-weight: 400; - line-height: 20px; + line-height: 22px; } - .ant-progress { - display: flex; - align-items: center; - justify-content: center; - - .ant-progress-outer { - position: relative; - width: 100%; - height: 6px !important; - margin: 0; - padding: 0; - - .ant-progress-inner { - position: absolute; - top: 50%; - left: 0; - transform: translateY(-50%); - width: 100px; - height: 6px !important; - background: var(--BG-200, #F2F3F5); - - .ant-progress-bg { - height: 6px !important; - background-color: #6D4CFE; - } + .content { + .upload-box { + transition: all 0.3s; + &:hover { + border-color: #6d4cfe; } } - - .ant-progress-text { - color: var(--Text-1, #211F24); + .upload-text { + color: #000; + text-align: center; font-family: $font-family-regular; font-size: 12px; font-style: normal; font-weight: 400; - - .anticon { - font-size: 16px; - } - + line-height: 20px; } - &.ant-progress-status-success { + .ant-progress { + display: flex; + align-items: center; + justify-content: center; + .ant-progress-outer { - .ant-progress-bg { - background-color: #25C883; + position: relative; + width: 100px !important; + height: 6px !important; + margin: 0; + padding: 0; + + .ant-progress-inner { + position: absolute; + top: 50%; + left: 0; + transform: translateY(-50%); + height: 6px !important; + background: var(--BG-200, #f2f3f5); + + .ant-progress-bg { + height: 6px !important; + background-color: #6d4cfe; + } } } .ant-progress-text { - color: #25C883; + color: var(--Text-1, #211f24); + font-family: $font-family-regular; + font-size: 12px; + font-style: normal; + font-weight: 400; + + .anticon { + font-size: 16px; + } + } + + &.ant-progress-status-success { + .ant-progress-outer { + .ant-progress-bg { + background-color: #25c883; + } + } + + .ant-progress-text { + color: #25c883; + } } } } - } - .footer { + .footer { + } } } } diff --git a/src/views/material-center/components/raw-material/components/table/index.vue b/src/views/material-center/components/raw-material/components/table/index.vue index bb21edd..0c35c07 100644 --- a/src/views/material-center/components/raw-material/components/table/index.vue +++ b/src/views/material-center/components/raw-material/components/table/index.vue @@ -33,12 +33,12 @@当前原料正在上传中,关闭弹窗将导致上传失败,请等待上传完成后再点击“确定”
, - okText: '我知道了', - centered: true, - }); - return; - } + try { + submitLoading.value = true; + const hasUploading = uploadData.value.some((item) => item.uploadStatus === EnumUploadStatus.uploading); + if (hasUploading) { + modalRef.value = Modal.warning({ + title: '上传未完成', + content:当前原料正在上传中,关闭弹窗将导致上传失败,请等待上传完成后再点击“确定”
, + okText: '我知道了', + centered: true, + }); + return; + } - const raw_materials = uploadData.value.filter((item) => item.uploadStatus !== EnumUploadStatus.error); - const { code } = await postBatchRawMaterial({ raw_materials }); - if (code === 200) { - message.success('上传成功'); - emit('update'); - onClose(); + const raw_materials = uploadData.value.filter((item) => item.uploadStatus !== EnumUploadStatus.error); + const { code } = await postBatchRawMaterial({ raw_materials }); + if (code === 200) { + message.success('上传成功'); + emit('update'); + onClose(); + } + } finally { + submitLoading.value = false; } }; const openDeleteModal = (file) => { diff --git a/src/views/material-center/components/raw-material/components/table/delete-file-modal.vue b/src/views/material-center/components/raw-material/components/table/delete-file-modal.vue index dac48bc..0cd0b56 100644 --- a/src/views/material-center/components/raw-material/components/table/delete-file-modal.vue +++ b/src/views/material-center/components/raw-material/components/table/delete-file-modal.vue @@ -6,7 +6,7 @@