diff --git a/components.d.ts b/components.d.ts index 0590af2..a9443dd 100644 --- a/components.d.ts +++ b/components.d.ts @@ -45,6 +45,7 @@ declare module 'vue' { ATooltip: typeof import('ant-design-vue/es')['Tooltip'] AUpload: typeof import('ant-design-vue/es')['Upload'] AUploadDragger: typeof import('ant-design-vue/es')['UploadDragger'] + Badge: typeof import('./src/components/MyUI/Badge/Badge.vue')['default'] BoxDog: typeof import('./src/components/BoxDog/BoxDog.vue')['default'] Card3D: typeof import('./src/components/Card3D/Card3D.vue')['default'] CloseCircleOutlined: typeof import('@ant-design/icons-vue')['CloseCircleOutlined'] diff --git a/public/level_icon/1/1.png b/public/level_icon/1/1.png new file mode 100644 index 0000000..ac9e3d4 Binary files /dev/null and b/public/level_icon/1/1.png differ diff --git a/public/level_icon/1/2.png b/public/level_icon/1/2.png new file mode 100644 index 0000000..51924d3 Binary files /dev/null and b/public/level_icon/1/2.png differ diff --git a/public/level_icon/1/3.png b/public/level_icon/1/3.png new file mode 100644 index 0000000..c503ca3 Binary files /dev/null and b/public/level_icon/1/3.png differ diff --git a/public/level_icon/1/4.png b/public/level_icon/1/4.png new file mode 100644 index 0000000..3f4ac61 Binary files /dev/null and b/public/level_icon/1/4.png differ diff --git a/public/level_icon/1/5.png b/public/level_icon/1/5.png new file mode 100644 index 0000000..12f315d Binary files /dev/null and b/public/level_icon/1/5.png differ diff --git a/public/level_icon/1/6.png b/public/level_icon/1/6.png new file mode 100644 index 0000000..b7806a6 Binary files /dev/null and b/public/level_icon/1/6.png differ diff --git a/public/level_icon/1/7.png b/public/level_icon/1/7.png new file mode 100644 index 0000000..48253c4 Binary files /dev/null and b/public/level_icon/1/7.png differ diff --git a/public/level_icon/1/8.png b/public/level_icon/1/8.png new file mode 100644 index 0000000..4f63ab1 Binary files /dev/null and b/public/level_icon/1/8.png differ diff --git a/public/level_icon/1/9.png b/public/level_icon/1/9.png new file mode 100644 index 0000000..d13d03a Binary files /dev/null and b/public/level_icon/1/9.png differ diff --git a/public/level_icon/2/lv1.svg b/public/level_icon/2/lv1.svg new file mode 100644 index 0000000..a656257 --- /dev/null +++ b/public/level_icon/2/lv1.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LV1 + \ No newline at end of file diff --git a/public/level_icon/2/lv10.svg b/public/level_icon/2/lv10.svg new file mode 100644 index 0000000..89272c0 --- /dev/null +++ b/public/level_icon/2/lv10.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + LV10 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/level_icon/2/lv2.svg b/public/level_icon/2/lv2.svg new file mode 100644 index 0000000..dc7aeb3 --- /dev/null +++ b/public/level_icon/2/lv2.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + LV2 + + + + + + + + + \ No newline at end of file diff --git a/public/level_icon/2/lv3.svg b/public/level_icon/2/lv3.svg new file mode 100644 index 0000000..e2a3f5f --- /dev/null +++ b/public/level_icon/2/lv3.svg @@ -0,0 +1,56 @@ + + + + + + + + + + + LV3 + + + + + \ No newline at end of file diff --git a/public/level_icon/2/lv4.svg b/public/level_icon/2/lv4.svg new file mode 100644 index 0000000..8b3d6f9 --- /dev/null +++ b/public/level_icon/2/lv4.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + LV4 + + + + + + + + \ No newline at end of file diff --git a/public/level_icon/2/lv5.svg b/public/level_icon/2/lv5.svg new file mode 100644 index 0000000..b67d82b --- /dev/null +++ b/public/level_icon/2/lv5.svg @@ -0,0 +1,72 @@ + + + + + + + + + + + LV5 + + + + + + + + + + \ No newline at end of file diff --git a/public/level_icon/2/lv6.svg b/public/level_icon/2/lv6.svg new file mode 100644 index 0000000..3c2f08d --- /dev/null +++ b/public/level_icon/2/lv6.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + LV6 + + + + + + \ No newline at end of file diff --git a/public/level_icon/2/lv7.svg b/public/level_icon/2/lv7.svg new file mode 100644 index 0000000..0d214a7 --- /dev/null +++ b/public/level_icon/2/lv7.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + LV7 + + + + + + + + + + + + \ No newline at end of file diff --git a/public/level_icon/2/lv8.svg b/public/level_icon/2/lv8.svg new file mode 100644 index 0000000..297fb69 --- /dev/null +++ b/public/level_icon/2/lv8.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + LV8 + + + + + + + + + \ No newline at end of file diff --git a/public/level_icon/2/lv9.svg b/public/level_icon/2/lv9.svg new file mode 100644 index 0000000..856daa2 --- /dev/null +++ b/public/level_icon/2/lv9.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + LV9 + + + + + + + + + \ No newline at end of file diff --git a/public/level_icon/3/lv1.png b/public/level_icon/3/lv1.png new file mode 100644 index 0000000..f519bcc Binary files /dev/null and b/public/level_icon/3/lv1.png differ diff --git a/public/level_icon/3/lv10.png b/public/level_icon/3/lv10.png new file mode 100644 index 0000000..c6c4394 Binary files /dev/null and b/public/level_icon/3/lv10.png differ diff --git a/public/level_icon/3/lv2.png b/public/level_icon/3/lv2.png new file mode 100644 index 0000000..6c103c9 Binary files /dev/null and b/public/level_icon/3/lv2.png differ diff --git a/public/level_icon/3/lv3.png b/public/level_icon/3/lv3.png new file mode 100644 index 0000000..06f7e63 Binary files /dev/null and b/public/level_icon/3/lv3.png differ diff --git a/public/level_icon/3/lv4.png b/public/level_icon/3/lv4.png new file mode 100644 index 0000000..fdf1651 Binary files /dev/null and b/public/level_icon/3/lv4.png differ diff --git a/public/level_icon/3/lv5.png b/public/level_icon/3/lv5.png new file mode 100644 index 0000000..838b6d3 Binary files /dev/null and b/public/level_icon/3/lv5.png differ diff --git a/public/level_icon/3/lv6.png b/public/level_icon/3/lv6.png new file mode 100644 index 0000000..5bcf703 Binary files /dev/null and b/public/level_icon/3/lv6.png differ diff --git a/public/level_icon/3/lv7.png b/public/level_icon/3/lv7.png new file mode 100644 index 0000000..5539fcd Binary files /dev/null and b/public/level_icon/3/lv7.png differ diff --git a/public/level_icon/3/lv8.png b/public/level_icon/3/lv8.png new file mode 100644 index 0000000..aea1ee7 Binary files /dev/null and b/public/level_icon/3/lv8.png differ diff --git a/public/level_icon/3/lv9.png b/public/level_icon/3/lv9.png new file mode 100644 index 0000000..602585f Binary files /dev/null and b/public/level_icon/3/lv9.png differ diff --git a/public/level_icon/4/1.png b/public/level_icon/4/1.png new file mode 100644 index 0000000..a134656 Binary files /dev/null and b/public/level_icon/4/1.png differ diff --git a/public/level_icon/4/2.png b/public/level_icon/4/2.png new file mode 100644 index 0000000..5d8cde0 Binary files /dev/null and b/public/level_icon/4/2.png differ diff --git a/public/level_icon/4/3.png b/public/level_icon/4/3.png new file mode 100644 index 0000000..8c27073 Binary files /dev/null and b/public/level_icon/4/3.png differ diff --git a/public/level_icon/4/4.png b/public/level_icon/4/4.png new file mode 100644 index 0000000..550e752 Binary files /dev/null and b/public/level_icon/4/4.png differ diff --git a/public/level_icon/4/5.png b/public/level_icon/4/5.png new file mode 100644 index 0000000..282039c Binary files /dev/null and b/public/level_icon/4/5.png differ diff --git a/public/level_icon/4/6.png b/public/level_icon/4/6.png new file mode 100644 index 0000000..d351c0b Binary files /dev/null and b/public/level_icon/4/6.png differ diff --git a/public/level_icon/4/7.png b/public/level_icon/4/7.png new file mode 100644 index 0000000..800e863 Binary files /dev/null and b/public/level_icon/4/7.png differ diff --git a/public/level_icon/4/8.png b/public/level_icon/4/8.png new file mode 100644 index 0000000..f2edc5f Binary files /dev/null and b/public/level_icon/4/8.png differ diff --git a/public/level_icon/4/9.png b/public/level_icon/4/9.png new file mode 100644 index 0000000..1ac877d Binary files /dev/null and b/public/level_icon/4/9.png differ diff --git a/public/level_icon/5/1.png b/public/level_icon/5/1.png new file mode 100644 index 0000000..359e352 Binary files /dev/null and b/public/level_icon/5/1.png differ diff --git a/public/level_icon/5/2.png b/public/level_icon/5/2.png new file mode 100644 index 0000000..0ad9388 Binary files /dev/null and b/public/level_icon/5/2.png differ diff --git a/public/level_icon/5/3.png b/public/level_icon/5/3.png new file mode 100644 index 0000000..5ddcd28 Binary files /dev/null and b/public/level_icon/5/3.png differ diff --git a/public/level_icon/5/4.png b/public/level_icon/5/4.png new file mode 100644 index 0000000..98bed89 Binary files /dev/null and b/public/level_icon/5/4.png differ diff --git a/public/level_icon/5/5.png b/public/level_icon/5/5.png new file mode 100644 index 0000000..c15f04b Binary files /dev/null and b/public/level_icon/5/5.png differ diff --git a/public/level_icon/5/6.png b/public/level_icon/5/6.png new file mode 100644 index 0000000..57981e5 Binary files /dev/null and b/public/level_icon/5/6.png differ diff --git a/public/level_icon/5/7.png b/public/level_icon/5/7.png new file mode 100644 index 0000000..fdb8d26 Binary files /dev/null and b/public/level_icon/5/7.png differ diff --git a/public/level_icon/5/8.png b/public/level_icon/5/8.png new file mode 100644 index 0000000..1310fe8 Binary files /dev/null and b/public/level_icon/5/8.png differ diff --git a/public/level_icon/5/9.png b/public/level_icon/5/9.png new file mode 100644 index 0000000..b9189ad Binary files /dev/null and b/public/level_icon/5/9.png differ diff --git a/public/level_icon/up.svg b/public/level_icon/up.svg new file mode 100644 index 0000000..d17abff --- /dev/null +++ b/public/level_icon/up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/styles/theme.scss b/src/assets/styles/theme.scss index f55352b..54c0352 100644 --- a/src/assets/styles/theme.scss +++ b/src/assets/styles/theme.scss @@ -7,6 +7,16 @@ --comment-text-color: #767779; // 评论子评论背景颜色 --comment-child-background-color: #f5f5f5; + + // 评论列表背景颜色 + --comment-list-background-color: #fafafa; + + // 举报弹窗文字颜色 + --comment-report-text-color: rgba(15, 15, 16, 0.58); + // 评论框边框颜色 + --comment-child-box-border-color: #90d952; + + } [data-dark="dark"] { @@ -18,6 +28,14 @@ --comment-text-color: #ffffff; // 评论子评论背景颜色 --comment-child-background-color: rgb(0, 0, 0); + + // 评论列表背景颜色 + --comment-list-background-color: rgba(15, 15, 16, 0.3); + + // 举报弹窗文字颜色 + --comment-report-text-color: #ffffff; + // 评论框边框颜色 + --comment-child-box-border-color: #ffffff; } #app { diff --git a/src/components/CommentReply/index.scss b/src/components/CommentReply/index.scss index 6b4e596..38c7398 100644 --- a/src/components/CommentReply/index.scss +++ b/src/components/CommentReply/index.scss @@ -1,9 +1,9 @@ .comment-main { display: flex; flex-direction: column; - border: 1px solid #ccc; + //border: 1px solid #ccc; margin-top: 20px; - width: 650px; + width: 700px; padding: 50px; .comment-header-title { diff --git a/src/components/CommentReply/src/CommentInput/index.scss b/src/components/CommentReply/src/CommentInput/index.scss index df4f062..cc25a0a 100644 --- a/src/components/CommentReply/src/CommentInput/index.scss +++ b/src/components/CommentReply/src/CommentInput/index.scss @@ -7,7 +7,7 @@ margin-left: 20px; .comment-text { - width: 600px; + width: 630px; } .comment-editor { diff --git a/src/components/CommentReply/src/CommentList/CommentList.vue b/src/components/CommentReply/src/CommentList/CommentList.vue index 085be44..7abf083 100644 --- a/src/components/CommentReply/src/CommentList/CommentList.vue +++ b/src/components/CommentReply/src/CommentList/CommentList.vue @@ -8,12 +8,12 @@ {{ t('comment.hot') }} {{ t('comment.latest') }} @@ -25,16 +25,22 @@
- - - + + + + + + {{ item.nickname }} - Lv.5 - UP + lv1 + lv2 + @@ -75,8 +81,10 @@ comment.handleShowCommentReply(item.id); replyListThrottled(item.id)}" type="text" size="small" :icon="h(MessageOutlined)" + :disabled="item.reply_count === 0" + v-show="item.reply_count > 0" class="reply-action-btn"> - {{ item.reply_count }} + 查看{{ item.reply_count >= 99 ? '99+' : item.reply_count }}条回复 - + - +
- { + router.push({ + path: "/main", + query: { + type: "hot", + page: router.currentRoute.value.query.page, + } + }); + comment.commentLoading = false; }); + } /** * 最新评论 */ async function getLatestCommentList() { - await getCommentList(1, 5, false); - await router.push({ - path: "/main", - query: { - type: "latest", - page: router.currentRoute.value.query.page, - } + comment.commentList = {} as Comment; + comment.commentLoading = true; + getCommentList(1, 5, false).then(() => { + router.push({ + path: "/main", + query: { + type: "latest", + page: router.currentRoute.value.query.page, + } + }); + comment.commentLoading = false; }); + } onMounted(() => { diff --git a/src/components/CommentReply/src/CommentList/index.scss b/src/components/CommentReply/src/CommentList/index.scss index 6d30055..ff2167c 100644 --- a/src/components/CommentReply/src/CommentList/index.scss +++ b/src/components/CommentReply/src/CommentList/index.scss @@ -7,7 +7,21 @@ } .reply-list { - margin-top: 30px; + margin-top: 10px; + border: 1px dashed #e9e9e9; + border-radius: 10px; + background-color: var(--comment-list-background-color); + padding: 10px; + min-width: 650px; + + .reply-item { + margin-top: 10px; + } + + .reply-avatar { + box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); + border-radius: 50%; + } .reply-avatar-img { cursor: pointer; @@ -27,6 +41,9 @@ font-weight: 600; cursor: pointer; } + .reply-name:hover { + color: rgba(15, 15, 16, 0.68); + } .reply-tag { font-size: 10px; @@ -35,6 +52,12 @@ cursor: pointer; } + .reply-level-icon { + width: 40px; + margin-left: 5px; + cursor: pointer; + } + .reply-ip { font-size: 12px; color: var(--comment-text-color); @@ -46,6 +69,7 @@ } .reply-card { + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); width: 600px; //margin-top: 5px; .reply-text { diff --git a/src/components/CommentReply/src/MessageReport/MessageReport.vue b/src/components/CommentReply/src/MessageReport/MessageReport.vue index 1bcbdf9..bf8ac14 100644 --- a/src/components/CommentReply/src/MessageReport/MessageReport.vue +++ b/src/components/CommentReply/src/MessageReport/MessageReport.vue @@ -66,7 +66,7 @@ import useStore from "@/store"; const {t} = useI18n(); const comment = useStore().comment; const radioStyle = reactive({ - color: 'rgba(15,15,16,0.66)', + color: 'var(--comment-report-text-color)', fontSize: '13px', fontWeight: 'bold' }); diff --git a/src/components/CommentReply/src/MessageReport/index.scss b/src/components/CommentReply/src/MessageReport/index.scss index 3dcd511..db0273e 100644 --- a/src/components/CommentReply/src/MessageReport/index.scss +++ b/src/components/CommentReply/src/MessageReport/index.scss @@ -5,13 +5,13 @@ .message-report-title { font-size: 13px; - color: rgba(15, 15, 16, 0.58); + color: var(--comment-report-text-color); font-weight: bolder; } .message-report-content { border: 1px dashed #e9e9e9; border-radius: 10px; - background-color: #fafafa; + background-color: var(--comment-list-background-color); min-height: 20px; padding: 10px; } diff --git a/src/components/CommentReply/src/ReplyList/ReplyList.vue b/src/components/CommentReply/src/ReplyList/ReplyList.vue index 518d12f..bc52ef1 100644 --- a/src/components/CommentReply/src/ReplyList/ReplyList.vue +++ b/src/components/CommentReply/src/ReplyList/ReplyList.vue @@ -4,8 +4,8 @@ - - + + @@ -96,7 +96,7 @@ - +import { computed } from 'vue'; +import type { CSSProperties } from 'vue'; +import { useSlotsExist } from '../utils/index.ts'; +enum PresetColor { + pink = 'pink', + red = 'red', + yellow = 'yellow', + orange = 'orange', + cyan = 'cyan', + green = 'green', + blue = 'blue', + purple = 'purple', + geekblue = 'geekblue', + magenta = 'magenta', + volcano = 'volcano', + gold = 'gold', + lime = 'lime' +} +enum Status { + success = 'success', + processing = 'processing', + default = 'default', + error = 'error', + warning = 'warning' +} +interface Props { + color?: PresetColor | string // 自定义小圆点的颜色,优先级高于 status + value?: number | string // 展示的数字或文字,为数字时大于 max 显示为 max+,为 0 时隐藏 number | string | slot + max?: number // 展示封顶的数字值 + showZero?: boolean // 当数值为 0 时,是否展示 Badge + dot?: boolean // 不展示数字,只有一个小红点 + offset?: [number | string, number | string] // 设置状态点的位置偏移,距默认位置左侧、上方的偏移量 [x, y]: [水平偏移, 垂直偏移] + status?: Status // 设置 Badge 为状态点 + text?: string // 在设置了 status 或 color 的前提下有效,设置状态点的文本 string | slot + valueStyle?: CSSProperties // 设置徽标的样式 + zIndex?: number // 设置徽标的 z-index + title?: string // 设置鼠标放在状态点上时显示的文字 + ripple?: boolean // 是否开启涟漪动画效果 +} +const props = withDefaults(defineProps(), { + color: undefined, + value: undefined, + max: 99, + showZero: false, + dot: false, + offset: undefined, + status: undefined, + text: undefined, + valueStyle: () => ({}), + zIndex: 9, + title: undefined, + ripple: true +}); +const slotsExist = useSlotsExist(['default', 'value']); +const customStyle = computed(() => { + if (props.color && !Object.keys(PresetColor).includes(props.color)) { + if ((props.value !== undefined && props.value !== 0) || (props.showZero && props.value === 0)) { + return { + backgroundColor: props.color + }; + } else { + return { + color: props.color, + backgroundColor: props.color + }; + } + } + return {}; +}); +const presetClass = computed(() => { + if (props.color) { + if (Object.keys(PresetColor).includes(props.color)) { + if ((props.value !== undefined && props.value !== 0) || (props.showZero && props.value === 0)) { + return `color-${props.color} white`; + } else { + return `color-${props.color}`; + } + } + } + if (props.status) { + if ((props.value !== undefined && props.value !== 0) || (props.showZero && props.value === 0)) { + return `status-${props.status} white`; + } else { + return `status-${props.status}`; + } + } + return {}; +}); +const showContent = computed(() => { + if (props.value !== undefined || props.dot || (!props.color && !props.status)) { + return slotsExist.default; + } + return false; +}); +const showValue = computed(() => { + if (!props.color && !props.status) { + return slotsExist.value; + } + return false; +}); +const showBadge = computed(() => { + if ((props.value !== undefined && props.value !== 0) || (props.showZero && props.value === 0) || props.dot) { + return true; + } + return false; +}); +const showDot = computed(() => { + return props.value === undefined || (props.value === 0 && !props.showZero) || props.dot; +}); +const dotOffestStyle = computed(() => { + if (props.offset?.length) { + return { + right: isNumber(props.offset[0]) ? -props.offset[0] + 'px' : handleOffset(props.offset[0] as string), + marginTop: isNumber(props.offset[1]) ? props.offset[1] + 'px' : props.offset[1] + }; + } + return {}; +}); +function isNumber(value: number | string): boolean { + return typeof value === 'number'; +} +function handleOffset(value: string): string { + if (value.includes('-')) { + return value.replace('-', ''); + } else { + return `-${value}`; + } +} + + + diff --git a/src/components/MyUI/utils/index.ts b/src/components/MyUI/utils/index.ts new file mode 100644 index 0000000..8eff2f8 --- /dev/null +++ b/src/components/MyUI/utils/index.ts @@ -0,0 +1,50 @@ +/** + * 组合式函数 + * 监听给定名称或名称数组的插槽是否存在,支持监听单个插槽或一组插槽的存在 + * + * @param slotsName - 插槽的名称或名称数组,默认为 'default' + * @returns 如果是单个插槽名称,则返回一个计算属性,表示该插槽是否存在 + * 如果是插槽名称数组,则返回一个 reactive 对象,其中的每个属性对应该插槽是否存在 + */ +import { useSlots, reactive, computed } from 'vue'; +export function useSlotsExist(slotsName: string | string[] = 'default') { + const slots = useSlots(); // 获取当前组件的所有插槽 + // 检查特定名称的插槽是否存在且不为空 + const checkSlotsExist = (slotsName: string): boolean => { + const slotsContent = slots[slotsName]?.(); + const checkExist = (slotContent: any) => { + if (typeof slotContent.children === 'string') { + // 排除 v-if="false" 的插槽内容 + if (slotContent.children === 'v-if') { + return false; + } + return slotContent.children.trim() !== ''; + } else { + if (slotContent.children === null) { + if (slotContent.type === 'img' || typeof slotContent.type !== 'string') { + return true; + } + } else { + return Boolean(slotContent.children); + } + } + }; + if (slotsContent && slotsContent?.length) { + const result = slotsContent.some((slotContent) => { + return checkExist(slotContent); + }); + return result; + } + return false; + }; + if (Array.isArray(slotsName)) { + const slotsExist = reactive({}); + slotsName.forEach((item) => { + const exist = computed(() => checkSlotsExist(item)); + slotsExist[item] = exist; // 将一个 ref 赋值给一个 reactive 属性时,该 ref 会自动解包 + }); + return slotsExist; + } else { + return computed(() => checkSlotsExist(slotsName)); + } +} diff --git a/src/layout/default/Header/index.scss b/src/layout/default/Header/index.scss index 93a9028..8992961 100644 --- a/src/layout/default/Header/index.scss +++ b/src/layout/default/Header/index.scss @@ -11,7 +11,7 @@ transition: background-color 0.3s; z-index: 3; box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); - border-radius: 20px; + //border-radius: 20px; .header-logo-container { min-width: 280px; diff --git a/src/store/modules/commentStore.ts b/src/store/modules/commentStore.ts index c75b303..a66052e 100644 --- a/src/store/modules/commentStore.ts +++ b/src/store/modules/commentStore.ts @@ -4,7 +4,6 @@ import {Comment} from "@/types/comment"; import {cancelCommentLikeApi, commentLikeApi, commentListApi, replyListApi} from "@/api/comment"; import {message} from "ant-design-vue"; import {getSlideCaptchaDataApi} from "@/api/captcha"; -import imageCompression from "browser-image-compression"; import QQ_EMOJI from "@/constant/qq_emoji.ts"; import {initNSFWJs, predictNSFW} from "@/utils/nsfw/nsfw.ts"; import {NSFWJS} from "nsfwjs"; @@ -180,17 +179,15 @@ export const useCommentStore = defineStore( async function beforeUpload(file: any) { uploadLoading.value = true; // 压缩图片配置 - const options = { - maxSizeMB: 0.4, - maxWidthOrHeight: 750, - maxIteration: 2 - }; - - + // const options = { + // maxSizeMB: 0.4, + // maxWidthOrHeight: 750, + // maxIteration: 2 + // }; if (!window.FileReader) return false; // 判断是否支持FileReader - const compressedFile = await imageCompression(file, options); + // const compressedFile = await imageCompression(file, options); const reader = new FileReader(); - reader.readAsDataURL(compressedFile); // 文件转换 + reader.readAsDataURL(file); // 文件转换 reader.onloadend = async function () { if (fileList.value.length < 3) { const img: HTMLImageElement = document.createElement('img');