From 69ee63ca4ede2d21d71a5d1cdb63bda74a343fb6 Mon Sep 17 00:00:00 2001 From: landaiqing Date: Tue, 24 Dec 2024 00:37:50 +0800 Subject: [PATCH] :art: update --- auto-import.d.ts | 4 +++ package.json | 8 +++--- .../src/CommentInput/CommentInput.vue | 2 +- .../CommentReply/src/CommentList/index.scss | 9 +++++-- .../src/ReplyInput/ReplyInput.vue | 4 ++- .../CommentReply/src/ReplyList/index.scss | 6 +++++ .../src/ReplyReplyInput/ReplyReply.vue | 4 ++- src/store/modules/commentStore.ts | 25 ++++++++++++++++--- src/store/modules/userStore.ts | 2 +- src/types/response.d.ts | 5 ++++ src/utils/alova/service.ts | 2 +- src/views/Login/LoginPage.vue | 7 +++--- src/views/QRLogin/QRLogin.vue | 2 ++ src/views/Upscale/CompareImage.vue | 2 +- 14 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 src/types/response.d.ts diff --git a/auto-import.d.ts b/auto-import.d.ts index e8673cf..488138a 100644 --- a/auto-import.d.ts +++ b/auto-import.d.ts @@ -229,12 +229,14 @@ declare global { const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark'] const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages'] const usePreferredReducedMotion: typeof import('@vueuse/core')['usePreferredReducedMotion'] + const usePreferredReducedTransparency: typeof import('@vueuse/core')['usePreferredReducedTransparency'] const usePrevious: typeof import('@vueuse/core')['usePrevious'] const useRafFn: typeof import('@vueuse/core')['useRafFn'] const useRefHistory: typeof import('@vueuse/core')['useRefHistory'] const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver'] const useRoute: typeof import('vue-router')['useRoute'] const useRouter: typeof import('vue-router')['useRouter'] + const useSSRWidth: typeof import('@vueuse/core')['useSSRWidth'] const useScreenOrientation: typeof import('@vueuse/core')['useScreenOrientation'] const useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea'] const useScriptTag: typeof import('@vueuse/core')['useScriptTag'] @@ -536,12 +538,14 @@ declare module 'vue' { readonly usePreferredDark: UnwrapRef readonly usePreferredLanguages: UnwrapRef readonly usePreferredReducedMotion: UnwrapRef + readonly usePreferredReducedTransparency: UnwrapRef readonly usePrevious: UnwrapRef readonly useRafFn: UnwrapRef readonly useRefHistory: UnwrapRef readonly useResizeObserver: UnwrapRef readonly useRoute: UnwrapRef readonly useRouter: UnwrapRef + readonly useSSRWidth: UnwrapRef readonly useScreenOrientation: UnwrapRef readonly useScreenSafeArea: UnwrapRef readonly useScriptTag: UnwrapRef diff --git a/package.json b/package.json index 87d6a72..aa621a3 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "@types/node": "^22.10.2", "@types/nprogress": "^0.2.3", "@vuepic/vue-datepicker": "^10.0.0", - "@vueuse/core": "^12.0.0", - "@vueuse/integrations": "^12.0.0", + "@vueuse/core": "^12.2.0", + "@vueuse/integrations": "^12.2.0", "alova": "^3.2.7", "animejs": "^3.2.2", "ant-design-vue": "^4.2.6", @@ -61,12 +61,12 @@ "@eslint/js": "^9.17.0", "@vitejs/plugin-vue": "^5.2.1", "eslint-plugin-vue": "^9.32.0", - "globals": "^15.13.0", + "globals": "^15.14.0", "sass": "^1.83.0", "typescript": "^5.6.3", "typescript-eslint": "^8.18.1", "unplugin-vue-components": "^0.28.0", - "vite": "^6.0.3", + "vite": "^6.0.5", "vite-plugin-bundle-obfuscator": "1.4.0", "vite-plugin-chunk-split": "^0.5.0", "vue-tsc": "2.1.10" diff --git a/src/components/CommentReply/src/CommentInput/CommentInput.vue b/src/components/CommentReply/src/CommentInput/CommentInput.vue index 35f5814..2fcf55d 100644 --- a/src/components/CommentReply/src/CommentInput/CommentInput.vue +++ b/src/components/CommentReply/src/CommentInput/CommentInput.vue @@ -201,7 +201,7 @@ async function commentSubmit(point: any) { message.success(t('comment.commentSuccess')); } else { await comment.getSlideCaptchaData(); - message.warning(result.message || t('comment.commentError')); + message.warning(result.msg || t('comment.commentError')); } } diff --git a/src/components/CommentReply/src/CommentList/index.scss b/src/components/CommentReply/src/CommentList/index.scss index e6b2c15..5e049e1 100644 --- a/src/components/CommentReply/src/CommentList/index.scss +++ b/src/components/CommentReply/src/CommentList/index.scss @@ -22,7 +22,7 @@ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); border-radius: 50%; - .reply-popover{ + .reply-popover { padding: 0; } } @@ -61,8 +61,9 @@ font-weight: 600; cursor: pointer; } + .reply-name:hover { - color: rgba(15, 15, 16, 0.68); + color: rgba(15, 15, 16, 0.68); } .reply-tag { @@ -94,6 +95,10 @@ //margin-top: 5px; .reply-text { overflow: auto; + white-space: normal; /* 允许自动换行 */ + word-wrap: break-word; /* 在长单词内部进行换行 */ + overflow-wrap: break-word; /* 在长单词内部进行换行 */ + } .reply-images { diff --git a/src/components/CommentReply/src/ReplyInput/ReplyInput.vue b/src/components/CommentReply/src/ReplyInput/ReplyInput.vue index 0dce574..23e765c 100644 --- a/src/components/CommentReply/src/ReplyInput/ReplyInput.vue +++ b/src/components/CommentReply/src/ReplyInput/ReplyInput.vue @@ -206,15 +206,17 @@ async function replySubmit(point: any) { is_liked: false, reply_nickname: props.item.nickname, }; - if (!comment.replyVisibility[props.item.id].data.comments) { + if (!comment.replyVisibility[props.item.id].data) { comment.replyVisibility[props.item.id].data.comments = []; // 初始化 comments 数组 } comment.replyVisibility[props.item.id].data.comments.unshift(tmpData); comment.commentMap[props.item.id].reply_count++; + comment.replyVisibility[props.item.id].visible = true; comment.closeReplyInput(); replyContent.value = ""; await comment.clearFileList(); showSubmitCaptcha.value = false; + comment.replyLoading[props.item.id] = false; message.success(t('comment.replySuccess')); } else { await comment.getSlideCaptchaData(); diff --git a/src/components/CommentReply/src/ReplyList/index.scss b/src/components/CommentReply/src/ReplyList/index.scss index 197977a..303ddbc 100644 --- a/src/components/CommentReply/src/ReplyList/index.scss +++ b/src/components/CommentReply/src/ReplyList/index.scss @@ -60,6 +60,12 @@ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); width: 525px; + .reply-text-child { + white-space: normal; /* 允许自动换行 */ + word-wrap: break-word; /* 在长单词内部进行换行 */ + overflow-wrap: break-word; /* 在长单词内部进行换行 */ + } + .reply-action-item-child { margin-top: 10px; diff --git a/src/components/CommentReply/src/ReplyReplyInput/ReplyReply.vue b/src/components/CommentReply/src/ReplyReplyInput/ReplyReply.vue index b0a2b71..d68c7dc 100644 --- a/src/components/CommentReply/src/ReplyReplyInput/ReplyReply.vue +++ b/src/components/CommentReply/src/ReplyReplyInput/ReplyReply.vue @@ -210,14 +210,16 @@ async function replyReplySubmit(point: any) { reply_nickname: props.item.nickname, reply_to: result.data.reply_to, }; - if (!comment.replyVisibility[props.item.id].data.comments) { + if (!comment.replyVisibility[props.item.id].data) { comment.replyVisibility[props.item.id].data.comments = []; // 初始化 comments 数组 } comment.replyVisibility[props.item.id].data.comments.unshift(tmpData); comment.commentMap[props.item.id].reply_count++; + comment.replyVisibility[props.item.id].visible = true; replyReplyContent.value = ""; await comment.clearFileList(); showSubmitCaptcha.value = false; + comment.replyLoading[props.item.id] = false; // await getReplyList(); comment.closeReplyInput(); diff --git a/src/store/modules/commentStore.ts b/src/store/modules/commentStore.ts index 5259291..d5c7854 100644 --- a/src/store/modules/commentStore.ts +++ b/src/store/modules/commentStore.ts @@ -1,6 +1,6 @@ import {defineStore} from "pinia"; import {reactive, ref} from "vue"; -import {Comment} from "@/types/comment"; +import {Comment, CommentContent} from "@/types/comment"; import {cancelCommentLikeApi, commentLikeApi, commentListApi, replyListApi} from "@/api/comment"; import {message} from "ant-design-vue"; import {getSlideCaptchaDataApi} from "@/api/captcha"; @@ -69,6 +69,16 @@ export const useCommentStore = defineStore( * 显示回复输入框 */ const handleShowReplyInput = (index: any) => { + if (!replyVisibility.value[index]) { + replyVisibility.value[index] = { + visible: false, data: { + comments: [] as CommentContent[], + current: 0, + total: 0, + size: 0, + } as Comment + }; + } showReplyInput.value = showReplyInput.value === index ? null : index; }; /** @@ -95,7 +105,14 @@ export const useCommentStore = defineStore( }; if (!replyVisibility.value[commentId]) { // 如果不存在这个评论的状态,初始化 - replyVisibility.value[commentId] = {visible: false, data: {} as Comment}; + replyVisibility.value[commentId] = { + visible: false, data: { + comments: [] as CommentContent[], + current: 0, + total: 0, + size: 0, + } as Comment + }; await getReplyList(params); } else { // 切换可见性 @@ -136,7 +153,7 @@ export const useCommentStore = defineStore( }; const result: any = await commentLikeApi(params); if (result && result.code !== 200) { - message.error(result.message); + message.error(result.msg); return false; } return true; @@ -153,7 +170,7 @@ export const useCommentStore = defineStore( }; const result: any = await cancelCommentLikeApi(params); if (result && result.code !== 200) { - message.error(result.message); + message.error(result.msg); return false; } return true; diff --git a/src/store/modules/userStore.ts b/src/store/modules/userStore.ts index 61244a3..b661bf4 100644 --- a/src/store/modules/userStore.ts +++ b/src/store/modules/userStore.ts @@ -30,7 +30,7 @@ export const useAuthStore = defineStore( */ async function getGithubRedirectUrl() { const res: any = await getGithubUrl(clientId.value); - if (res && res.code === 200 && res.data) { + if (res && res.code === 200) { githubRedirectUrl.value = res.data; } } diff --git a/src/types/response.d.ts b/src/types/response.d.ts new file mode 100644 index 0000000..8745809 --- /dev/null +++ b/src/types/response.d.ts @@ -0,0 +1,5 @@ +export interface Response { + code: number; + data?: any; + msg: string; +} diff --git a/src/utils/alova/service.ts b/src/utils/alova/service.ts index e094634..93b8eb3 100644 --- a/src/utils/alova/service.ts +++ b/src/utils/alova/service.ts @@ -57,7 +57,7 @@ export const service = createAlova({ // 令牌 method.config.headers['X-Nonce'] = CryptoJS.lib.WordArray.random(16).toString(); - + // 签名 if (method.meta?.signature) { method.config.headers['X-Content-Security'] = generateKeySecretSignature(0, method.type, method.url, method.config.params, method.data); } diff --git a/src/views/Login/LoginPage.vue b/src/views/Login/LoginPage.vue index cbecc64..163d2de 100644 --- a/src/views/Login/LoginPage.vue +++ b/src/views/Login/LoginPage.vue @@ -387,7 +387,7 @@ async function phoneLoginSubmit() { }, 1000); } else { loginLoading.value = false; - message.error(res.message); + message.error(res.msg); } }) .catch((error: any) => { @@ -475,8 +475,9 @@ async function checkAccountLoginCaptcha(angle: number) { router.push('/main/photo/all'); }, 1000); } else { + showAccountRotateCaptcha.value = false; loginLoading.value = false; - message.error(res.message); + message.error(res.msg); } } @@ -490,7 +491,7 @@ async function sendMessageByPhone(params: any): Promise { message.success(t('login.sendCaptchaSuccess')); return true; } else { - message.error(res.message); + message.error(res.msg); return false; } } diff --git a/src/views/QRLogin/QRLogin.vue b/src/views/QRLogin/QRLogin.vue index 84bb2d5..5f130c7 100644 --- a/src/views/QRLogin/QRLogin.vue +++ b/src/views/QRLogin/QRLogin.vue @@ -111,6 +111,8 @@ async function handleListenMessage() { setTimeout(() => { router.push('/main/photo/all'); }, 1000); + } else { + message.warning(t('login.loginError')); } }); } diff --git a/src/views/Upscale/CompareImage.vue b/src/views/Upscale/CompareImage.vue index 063795b..3a7da70 100644 --- a/src/views/Upscale/CompareImage.vue +++ b/src/views/Upscale/CompareImage.vue @@ -154,7 +154,7 @@ const updateQrcodeSize = () => { }; function generateQrCodeUrl(): string { - return import.meta.env.VITE_APP_WEB_URL + "/upscale/app?user_id=" + user.user.uid + "&token=" + user.user.access_token; + return import.meta.env.VITE_APP_WEB_URL + "/upscale/app?user_id=" + user.user.uid + "&token=" + user.token.accessToken; } /**