🎨 update

This commit is contained in:
2024-12-24 00:37:50 +08:00
parent 927f2d63a4
commit 69ee63ca4e
14 changed files with 63 additions and 19 deletions

4
auto-import.d.ts vendored
View File

@@ -229,12 +229,14 @@ declare global {
const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark'] const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark']
const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages'] const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages']
const usePreferredReducedMotion: typeof import('@vueuse/core')['usePreferredReducedMotion'] const usePreferredReducedMotion: typeof import('@vueuse/core')['usePreferredReducedMotion']
const usePreferredReducedTransparency: typeof import('@vueuse/core')['usePreferredReducedTransparency']
const usePrevious: typeof import('@vueuse/core')['usePrevious'] const usePrevious: typeof import('@vueuse/core')['usePrevious']
const useRafFn: typeof import('@vueuse/core')['useRafFn'] const useRafFn: typeof import('@vueuse/core')['useRafFn']
const useRefHistory: typeof import('@vueuse/core')['useRefHistory'] const useRefHistory: typeof import('@vueuse/core')['useRefHistory']
const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver'] const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver']
const useRoute: typeof import('vue-router')['useRoute'] const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter'] const useRouter: typeof import('vue-router')['useRouter']
const useSSRWidth: typeof import('@vueuse/core')['useSSRWidth']
const useScreenOrientation: typeof import('@vueuse/core')['useScreenOrientation'] const useScreenOrientation: typeof import('@vueuse/core')['useScreenOrientation']
const useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea'] const useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea']
const useScriptTag: typeof import('@vueuse/core')['useScriptTag'] const useScriptTag: typeof import('@vueuse/core')['useScriptTag']
@@ -536,12 +538,14 @@ declare module 'vue' {
readonly usePreferredDark: UnwrapRef<typeof import('@vueuse/core')['usePreferredDark']> readonly usePreferredDark: UnwrapRef<typeof import('@vueuse/core')['usePreferredDark']>
readonly usePreferredLanguages: UnwrapRef<typeof import('@vueuse/core')['usePreferredLanguages']> readonly usePreferredLanguages: UnwrapRef<typeof import('@vueuse/core')['usePreferredLanguages']>
readonly usePreferredReducedMotion: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedMotion']> readonly usePreferredReducedMotion: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedMotion']>
readonly usePreferredReducedTransparency: UnwrapRef<typeof import('@vueuse/core')['usePreferredReducedTransparency']>
readonly usePrevious: UnwrapRef<typeof import('@vueuse/core')['usePrevious']> readonly usePrevious: UnwrapRef<typeof import('@vueuse/core')['usePrevious']>
readonly useRafFn: UnwrapRef<typeof import('@vueuse/core')['useRafFn']> readonly useRafFn: UnwrapRef<typeof import('@vueuse/core')['useRafFn']>
readonly useRefHistory: UnwrapRef<typeof import('@vueuse/core')['useRefHistory']> readonly useRefHistory: UnwrapRef<typeof import('@vueuse/core')['useRefHistory']>
readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']> readonly useResizeObserver: UnwrapRef<typeof import('@vueuse/core')['useResizeObserver']>
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']> readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']> readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
readonly useSSRWidth: UnwrapRef<typeof import('@vueuse/core')['useSSRWidth']>
readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']> readonly useScreenOrientation: UnwrapRef<typeof import('@vueuse/core')['useScreenOrientation']>
readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']> readonly useScreenSafeArea: UnwrapRef<typeof import('@vueuse/core')['useScreenSafeArea']>
readonly useScriptTag: UnwrapRef<typeof import('@vueuse/core')['useScriptTag']> readonly useScriptTag: UnwrapRef<typeof import('@vueuse/core')['useScriptTag']>

View File

@@ -22,8 +22,8 @@
"@types/node": "^22.10.2", "@types/node": "^22.10.2",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@vuepic/vue-datepicker": "^10.0.0", "@vuepic/vue-datepicker": "^10.0.0",
"@vueuse/core": "^12.0.0", "@vueuse/core": "^12.2.0",
"@vueuse/integrations": "^12.0.0", "@vueuse/integrations": "^12.2.0",
"alova": "^3.2.7", "alova": "^3.2.7",
"animejs": "^3.2.2", "animejs": "^3.2.2",
"ant-design-vue": "^4.2.6", "ant-design-vue": "^4.2.6",
@@ -61,12 +61,12 @@
"@eslint/js": "^9.17.0", "@eslint/js": "^9.17.0",
"@vitejs/plugin-vue": "^5.2.1", "@vitejs/plugin-vue": "^5.2.1",
"eslint-plugin-vue": "^9.32.0", "eslint-plugin-vue": "^9.32.0",
"globals": "^15.13.0", "globals": "^15.14.0",
"sass": "^1.83.0", "sass": "^1.83.0",
"typescript": "^5.6.3", "typescript": "^5.6.3",
"typescript-eslint": "^8.18.1", "typescript-eslint": "^8.18.1",
"unplugin-vue-components": "^0.28.0", "unplugin-vue-components": "^0.28.0",
"vite": "^6.0.3", "vite": "^6.0.5",
"vite-plugin-bundle-obfuscator": "1.4.0", "vite-plugin-bundle-obfuscator": "1.4.0",
"vite-plugin-chunk-split": "^0.5.0", "vite-plugin-chunk-split": "^0.5.0",
"vue-tsc": "2.1.10" "vue-tsc": "2.1.10"

View File

@@ -201,7 +201,7 @@ async function commentSubmit(point: any) {
message.success(t('comment.commentSuccess')); message.success(t('comment.commentSuccess'));
} else { } else {
await comment.getSlideCaptchaData(); await comment.getSlideCaptchaData();
message.warning(result.message || t('comment.commentError')); message.warning(result.msg || t('comment.commentError'));
} }
} }

View File

@@ -22,7 +22,7 @@
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
border-radius: 50%; border-radius: 50%;
.reply-popover{ .reply-popover {
padding: 0; padding: 0;
} }
} }
@@ -61,8 +61,9 @@
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
} }
.reply-name:hover { .reply-name:hover {
color: rgba(15, 15, 16, 0.68); color: rgba(15, 15, 16, 0.68);
} }
.reply-tag { .reply-tag {
@@ -94,6 +95,10 @@
//margin-top: 5px; //margin-top: 5px;
.reply-text { .reply-text {
overflow: auto; overflow: auto;
white-space: normal; /* 允许自动换行 */
word-wrap: break-word; /* 在长单词内部进行换行 */
overflow-wrap: break-word; /* 在长单词内部进行换行 */
} }
.reply-images { .reply-images {

View File

@@ -206,15 +206,17 @@ async function replySubmit(point: any) {
is_liked: false, is_liked: false,
reply_nickname: props.item.nickname, 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 = []; // 初始化 comments 数组
} }
comment.replyVisibility[props.item.id].data.comments.unshift(tmpData); comment.replyVisibility[props.item.id].data.comments.unshift(tmpData);
comment.commentMap[props.item.id].reply_count++; comment.commentMap[props.item.id].reply_count++;
comment.replyVisibility[props.item.id].visible = true;
comment.closeReplyInput(); comment.closeReplyInput();
replyContent.value = ""; replyContent.value = "";
await comment.clearFileList(); await comment.clearFileList();
showSubmitCaptcha.value = false; showSubmitCaptcha.value = false;
comment.replyLoading[props.item.id] = false;
message.success(t('comment.replySuccess')); message.success(t('comment.replySuccess'));
} else { } else {
await comment.getSlideCaptchaData(); await comment.getSlideCaptchaData();

View File

@@ -60,6 +60,12 @@
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 525px; width: 525px;
.reply-text-child {
white-space: normal; /* 允许自动换行 */
word-wrap: break-word; /* 在长单词内部进行换行 */
overflow-wrap: break-word; /* 在长单词内部进行换行 */
}
.reply-action-item-child { .reply-action-item-child {
margin-top: 10px; margin-top: 10px;

View File

@@ -210,14 +210,16 @@ async function replyReplySubmit(point: any) {
reply_nickname: props.item.nickname, reply_nickname: props.item.nickname,
reply_to: result.data.reply_to, 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 = []; // 初始化 comments 数组
} }
comment.replyVisibility[props.item.id].data.comments.unshift(tmpData); comment.replyVisibility[props.item.id].data.comments.unshift(tmpData);
comment.commentMap[props.item.id].reply_count++; comment.commentMap[props.item.id].reply_count++;
comment.replyVisibility[props.item.id].visible = true;
replyReplyContent.value = ""; replyReplyContent.value = "";
await comment.clearFileList(); await comment.clearFileList();
showSubmitCaptcha.value = false; showSubmitCaptcha.value = false;
comment.replyLoading[props.item.id] = false;
// await getReplyList(); // await getReplyList();
comment.closeReplyInput(); comment.closeReplyInput();

View File

@@ -1,6 +1,6 @@
import {defineStore} from "pinia"; import {defineStore} from "pinia";
import {reactive, ref} from "vue"; 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 {cancelCommentLikeApi, commentLikeApi, commentListApi, replyListApi} from "@/api/comment";
import {message} from "ant-design-vue"; import {message} from "ant-design-vue";
import {getSlideCaptchaDataApi} from "@/api/captcha"; import {getSlideCaptchaDataApi} from "@/api/captcha";
@@ -69,6 +69,16 @@ export const useCommentStore = defineStore(
* 显示回复输入框 * 显示回复输入框
*/ */
const handleShowReplyInput = (index: any) => { 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; showReplyInput.value = showReplyInput.value === index ? null : index;
}; };
/** /**
@@ -95,7 +105,14 @@ export const useCommentStore = defineStore(
}; };
if (!replyVisibility.value[commentId]) { 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); await getReplyList(params);
} else { } else {
// 切换可见性 // 切换可见性
@@ -136,7 +153,7 @@ export const useCommentStore = defineStore(
}; };
const result: any = await commentLikeApi(params); const result: any = await commentLikeApi(params);
if (result && result.code !== 200) { if (result && result.code !== 200) {
message.error(result.message); message.error(result.msg);
return false; return false;
} }
return true; return true;
@@ -153,7 +170,7 @@ export const useCommentStore = defineStore(
}; };
const result: any = await cancelCommentLikeApi(params); const result: any = await cancelCommentLikeApi(params);
if (result && result.code !== 200) { if (result && result.code !== 200) {
message.error(result.message); message.error(result.msg);
return false; return false;
} }
return true; return true;

View File

@@ -30,7 +30,7 @@ export const useAuthStore = defineStore(
*/ */
async function getGithubRedirectUrl() { async function getGithubRedirectUrl() {
const res: any = await getGithubUrl(clientId.value); const res: any = await getGithubUrl(clientId.value);
if (res && res.code === 200 && res.data) { if (res && res.code === 200) {
githubRedirectUrl.value = res.data; githubRedirectUrl.value = res.data;
} }
} }

5
src/types/response.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
export interface Response {
code: number;
data?: any;
msg: string;
}

View File

@@ -57,7 +57,7 @@ export const service = createAlova({
// 令牌 // 令牌
method.config.headers['X-Nonce'] = CryptoJS.lib.WordArray.random(16).toString(); method.config.headers['X-Nonce'] = CryptoJS.lib.WordArray.random(16).toString();
// 签名
if (method.meta?.signature) { if (method.meta?.signature) {
method.config.headers['X-Content-Security'] = generateKeySecretSignature(0, method.type, method.url, method.config.params, method.data); method.config.headers['X-Content-Security'] = generateKeySecretSignature(0, method.type, method.url, method.config.params, method.data);
} }

View File

@@ -387,7 +387,7 @@ async function phoneLoginSubmit() {
}, 1000); }, 1000);
} else { } else {
loginLoading.value = false; loginLoading.value = false;
message.error(res.message); message.error(res.msg);
} }
}) })
.catch((error: any) => { .catch((error: any) => {
@@ -475,8 +475,9 @@ async function checkAccountLoginCaptcha(angle: number) {
router.push('/main/photo/all'); router.push('/main/photo/all');
}, 1000); }, 1000);
} else { } else {
showAccountRotateCaptcha.value = false;
loginLoading.value = false; loginLoading.value = false;
message.error(res.message); message.error(res.msg);
} }
} }
@@ -490,7 +491,7 @@ async function sendMessageByPhone(params: any): Promise<boolean> {
message.success(t('login.sendCaptchaSuccess')); message.success(t('login.sendCaptchaSuccess'));
return true; return true;
} else { } else {
message.error(res.message); message.error(res.msg);
return false; return false;
} }
} }

View File

@@ -111,6 +111,8 @@ async function handleListenMessage() {
setTimeout(() => { setTimeout(() => {
router.push('/main/photo/all'); router.push('/main/photo/all');
}, 1000); }, 1000);
} else {
message.warning(t('login.loginError'));
} }
}); });
} }

View File

@@ -154,7 +154,7 @@ const updateQrcodeSize = () => {
}; };
function generateQrCodeUrl(): string { 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;
} }
/** /**