diff --git a/src/lang/package/en.ts b/src/lang/package/en.ts index 931d7a1..8cc4119 100644 --- a/src/lang/package/en.ts +++ b/src/lang/package/en.ts @@ -128,6 +128,7 @@ export default { submit:'Submit', noListOrder: "No data available", noListInvite: "No data, please invite more people to join us", + compressLoad:'Images are being compressed', }, // 商店 diff --git a/src/lang/package/zh-cn.ts b/src/lang/package/zh-cn.ts index 11fc642..20fed81 100644 --- a/src/lang/package/zh-cn.ts +++ b/src/lang/package/zh-cn.ts @@ -128,6 +128,7 @@ export default { submit:'提交', noListOrder: "暂无数据", noListInvite: "没有数据哦,快去邀请更多人加入我们吧~", + compressLoad:'图片正在压缩', }, // 商店 diff --git a/src/views/createVideo/index.vue b/src/views/createVideo/index.vue index ae5d5a6..406b9d3 100644 --- a/src/views/createVideo/index.vue +++ b/src/views/createVideo/index.vue @@ -251,6 +251,7 @@ + @@ -435,8 +436,8 @@ + + --> + {{ $t("createVideo.copy") }} + --> {{ $t("createVideo.copy") }} @@ -2151,6 +2152,7 @@ onUnmounted(() => { min-height: 100%; padding: 20px 20px 0px 20px; border-radius: 20px; + position: relative; .card1 { .text { diff --git a/src/views/myAccount/index.vue b/src/views/myAccount/index.vue index 411fa3f..adb0e62 100644 --- a/src/views/myAccount/index.vue +++ b/src/views/myAccount/index.vue @@ -175,10 +175,18 @@ {{ $t("public.avatar") }}: -
- -
+
- +
+
+ +
+
+ +
+
+ + + +
{{ $t("account.compressLoad") }}
+
@@ -239,23 +247,36 @@ function resetPassWord() { router.push({ name: "login", query: { type: 4 } }); } // 选择图片 + +const compressImgLoadIng = ref(false); async function chooseImg(e) { - if (e.target.files[0]) { - dialogAvatarUrl.value = null; - dialogAvatarData.value = null; - // 压缩配置 - const options = { - maxSizeMB: 2, // 最大压缩大小为 2MB - useWebWorker: false, // 使用 Web Worker 进行压缩,提高性能 - }; - const compressedFile = await imageCompression(e.target.files[0], options); - dialogAvatarUrl.value = URL.createObjectURL(compressedFile); - dialogAvatarData.value = compressedFile; - // 不压缩图片 - // dialogAvatarUrl.value = e.target.files[0]; - // dialogAvatarData.value = e.target.files[0]; - } else { - return; + try { + if (e.target.files[0]) { + dialogAvatarUrl.value = null; + dialogAvatarData.value = null; + compressImgLoadIng.value = true; + // 压缩配置 + const options = { + maxSizeMB: 2, // 最大压缩大小为 2MB + useWebWorker: false, // 使用 Web Worker 进行压缩,提高性能 + }; + const compressedFile = await imageCompression(e.target.files[0], options); + dialogAvatarUrl.value = URL.createObjectURL(compressedFile); + dialogAvatarData.value = compressedFile; + compressImgLoadIng.value = false; + // 不压缩图片 + // dialogAvatarUrl.value = URL.createObjectURL(e.target.files[0]); + // dialogAvatarData.value = e.target.files[0]; + } else { + return; + } + } catch (error) { + ElMessage.error( + lanChange.value == "zh-cn" + ? `上传失败,请稍后重试` + : `Upload failure. Please try again later` + ); + compressImgLoadIng.value = false; } } const submitUserInfoLoading = ref(false); @@ -271,6 +292,7 @@ async function submitUserInfo() { name: userNameinput.value, avatarUrl: res1.data.url, }; + try { const res2 = await updUserInfoApi(data); ElMessage.success( @@ -888,6 +910,21 @@ function routerTo(url) { transition: all 0.3s; } } + .compressLoadBox { + // align-items: center; + padding-top: 40px; + text-align: center; + flex: 1; + .el-icon { + font-size: 20px; + color: #909393; + } + .tips { + // display: inline-block; + flex: 1; + line-height: 50px; + } + } } // 公共类名 .bigWord { diff --git a/src/views/myCreating/index.vue b/src/views/myCreating/index.vue index bd4a433..2f52f0b 100644 --- a/src/views/myCreating/index.vue +++ b/src/views/myCreating/index.vue @@ -135,10 +135,10 @@
{{ $t("myCreating." + presentItem.statusName + "Text") }} -

+

错误原因: {{ presentItem.videoMsg }}

-

+

Error cause: {{ presentItem.videoMsg }}