🚸 optimized error response
This commit is contained in:
@@ -4,7 +4,7 @@ VITE_NODE_ENV='production'
|
||||
VITE_APP_BASE_API='/sys'
|
||||
|
||||
# 网站域名
|
||||
VITE_APP_WEB_URL='http://localhost:5173'
|
||||
VITE_APP_WEB_URL='https://www.landaiqing.cn'
|
||||
|
||||
# 网络请求公用地址
|
||||
VITE_API_BASE_URL='https://landaiqing.cn'
|
||||
@@ -15,11 +15,11 @@ VITE_TITLE_NAME='五味子云相册'
|
||||
VITE_APP_TOKEN_KEY='Bearer'
|
||||
|
||||
# the websocket url
|
||||
VITE_QR_SOCKET_URL='wss://landaiqing.cn/api/ws/qr_ws'
|
||||
VITE_QR_SOCKET_URL='wss://landaiqing.cn/api/ws/qrcode'
|
||||
|
||||
VITE_MESSAGE_SOCKET_URL='wss://landaiqing.cn/api/ws/message_ws'
|
||||
VITE_MESSAGE_SOCKET_URL='wss://landaiqing.cn/api/ws/message'
|
||||
|
||||
VITE_FILE_SOCKET_URL='ws://127.0.0.1:80/api/ws/file'
|
||||
VITE_FILE_SOCKET_URL='wss://landaiqing.cn/api/ws/file'
|
||||
|
||||
# 签名密钥
|
||||
VITE_FINGERPRINT_KEY='idm0jdoau38lwourb4pbjk4dxkat0kcx'
|
||||
|
BIN
public/nsfw/inception_v3/group1-shard1of6
Normal file
BIN
public/nsfw/inception_v3/group1-shard1of6
Normal file
Binary file not shown.
2
public/nsfw/inception_v3/group1-shard2of6
Normal file
2
public/nsfw/inception_v3/group1-shard2of6
Normal file
File diff suppressed because one or more lines are too long
3
public/nsfw/inception_v3/group1-shard3of6
Normal file
3
public/nsfw/inception_v3/group1-shard3of6
Normal file
File diff suppressed because one or more lines are too long
3
public/nsfw/inception_v3/group1-shard4of6
Normal file
3
public/nsfw/inception_v3/group1-shard4of6
Normal file
File diff suppressed because one or more lines are too long
18
public/nsfw/inception_v3/group1-shard5of6
Normal file
18
public/nsfw/inception_v3/group1-shard5of6
Normal file
File diff suppressed because one or more lines are too long
3
public/nsfw/inception_v3/group1-shard6of6
Normal file
3
public/nsfw/inception_v3/group1-shard6of6
Normal file
File diff suppressed because one or more lines are too long
1
public/nsfw/inception_v3/model.json
Normal file
1
public/nsfw/inception_v3/model.json
Normal file
File diff suppressed because one or more lines are too long
BIN
public/nsfw/mobilenet_v2/group1-shard1of1
Normal file
BIN
public/nsfw/mobilenet_v2/group1-shard1of1
Normal file
Binary file not shown.
1
public/nsfw/mobilenet_v2/model.json
Normal file
1
public/nsfw/mobilenet_v2/model.json
Normal file
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@ export const uploadImage = (data: uploadImageRequest) => {
|
||||
}, {
|
||||
meta: {
|
||||
ignoreToken: false,
|
||||
signature: true
|
||||
signature: false,
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@@ -171,7 +171,7 @@ async function commentSubmit(point: any) {
|
||||
key: comment.slideCaptchaData.captKey,
|
||||
};
|
||||
const result: any = await commentSubmitApi(commentParams);
|
||||
if (result.code === 200) {
|
||||
if (result && result.code === 200) {
|
||||
const tmpData: any = {
|
||||
user_id: user.user.uid,
|
||||
content: result.data.content,
|
||||
|
@@ -172,7 +172,6 @@ import {
|
||||
} from "@ant-design/icons-vue";
|
||||
import {useThrottleFn} from "@vueuse/core";
|
||||
import useStore from "@/store";
|
||||
import {useRouter} from "vue-router";
|
||||
import ReplyInput from "@/components/CommentReply/src/ReplyInput/ReplyInput.vue";
|
||||
import ReplyList from "@/components/CommentReply/src/ReplyList/ReplyList.vue";
|
||||
import MessageReport from "@/components/CommentReply/src/MessageReport/MessageReport.vue";
|
||||
@@ -181,6 +180,7 @@ import UserInfoCard from "@/components/CommentReply/src/UserInfoCard/UserInfoCar
|
||||
|
||||
const {t} = useI18n();
|
||||
const router = useRouter();
|
||||
const route =useRoute();
|
||||
const comment = useStore().comment;
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ async function cancelCommentLike(item: any) {
|
||||
*/
|
||||
async function paginationCommentChange(page: number, pageSize: number) {
|
||||
router.push({
|
||||
path: "/main",
|
||||
path: route.path,
|
||||
query: {
|
||||
type: router.currentRoute.value.query.type,
|
||||
page: page,
|
||||
@@ -290,7 +290,7 @@ async function getHotCommentList() {
|
||||
comment.commentLoading = true;
|
||||
getCommentList(1, 5, true).then(() => {
|
||||
router.push({
|
||||
path: "/main",
|
||||
path: route.path,
|
||||
query: {
|
||||
type: "hot",
|
||||
page: router.currentRoute.value.query.page,
|
||||
@@ -308,7 +308,7 @@ async function getLatestCommentList() {
|
||||
comment.commentLoading = true;
|
||||
getCommentList(1, 5, false).then(() => {
|
||||
router.push({
|
||||
path: "/main",
|
||||
path: route.path,
|
||||
query: {
|
||||
type: "latest",
|
||||
page: router.currentRoute.value.query.page,
|
||||
|
@@ -186,7 +186,7 @@ async function replySubmit(point: any) {
|
||||
key: comment.slideCaptchaData.captKey,
|
||||
};
|
||||
const result: any = await replySubmitApi(replyParams);
|
||||
if (result.code === 200) {
|
||||
if (result && result.code === 200) {
|
||||
const tmpData: any = {
|
||||
id: result.data.id,
|
||||
content: result.data.content,
|
||||
|
@@ -189,7 +189,7 @@ async function replyReplySubmit(point: any) {
|
||||
key: comment.slideCaptchaData.captKey,
|
||||
};
|
||||
const result: any = await replyReplySubmitApi(replyParams);
|
||||
if (result.code === 200) {
|
||||
if (result && result.code === 200) {
|
||||
const tmpData: any = {
|
||||
id: result.data.id,
|
||||
content: result.data.content,
|
||||
|
@@ -53,7 +53,7 @@ export const useCommentStore = defineStore(
|
||||
commentList.value = {} as Comment;
|
||||
// 获取评论列表
|
||||
const result: any = await commentListApi(data);
|
||||
if (result.code === 200 && result.data) {
|
||||
if (result && result.code === 200) {
|
||||
commentList.value = result.data;
|
||||
if (Array.isArray(commentList.value.comments)) {
|
||||
commentList.value.comments.map((item: any) => {
|
||||
@@ -116,7 +116,7 @@ export const useCommentStore = defineStore(
|
||||
async function getReplyList(data: any) {
|
||||
// 获取评论列表
|
||||
const result: any = await replyListApi(data);
|
||||
if (result.code === 200 && result.data) {
|
||||
if (result && result.code === 200) {
|
||||
if (replyVisibility.value[data.comment_id].data !== result.data) {
|
||||
replyVisibility.value[data.comment_id].data = result.data;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ export const useCommentStore = defineStore(
|
||||
topic_id: data.topic_id,
|
||||
};
|
||||
const result: any = await commentLikeApi(params);
|
||||
if (result.code !== 200) {
|
||||
if (result && result.code !== 200) {
|
||||
message.error(result.message);
|
||||
return false;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ export const useCommentStore = defineStore(
|
||||
topic_id: data.topic_id,
|
||||
};
|
||||
const result: any = await cancelCommentLikeApi(params);
|
||||
if (result.code !== 200) {
|
||||
if (result && result.code !== 200) {
|
||||
message.error(result.message);
|
||||
return false;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ export const useCommentStore = defineStore(
|
||||
*/
|
||||
async function getSlideCaptchaData(): Promise<boolean> {
|
||||
const res: any = await getSlideCaptchaDataApi();
|
||||
if (res.code == 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
const {key, image, thumb, thumb_width, thumb_height, thumb_x, thumb_y} = res.data;
|
||||
slideCaptchaData.captKey = key;
|
||||
slideCaptchaData.image = image;
|
||||
|
@@ -31,7 +31,7 @@ export const useAuthStore = defineStore(
|
||||
*/
|
||||
async function getGithubRedirectUrl() {
|
||||
const res: any = await getGithubUrl(clientId.value);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200 && res.data) {
|
||||
githubRedirectUrl.value = res.data;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export const useAuthStore = defineStore(
|
||||
*/
|
||||
async function getGiteeRedirectUrl() {
|
||||
const res: any = await getGiteeUrl();
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
giteeRedirectUrl.value = res.data;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export const useAuthStore = defineStore(
|
||||
*/
|
||||
async function getQQRedirectUrl() {
|
||||
const res: any = await getQQUrl(clientId.value);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
qqRedirectUrl.value = res.data;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export const useAuthStore = defineStore(
|
||||
*/
|
||||
async function getClientId() {
|
||||
const res: any = await generateClientId();
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
clientId.value = res.data;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ export const useAuthStore = defineStore(
|
||||
const messageHandler = async (e: any) => {
|
||||
if (typeof e.data === 'string') {
|
||||
const res: any = JSON.parse(e.data);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
user.uid = res.data.uid;
|
||||
user.access_token = res.data.access_token;
|
||||
user.username = res.data.username;
|
||||
@@ -84,7 +84,7 @@ export const useAuthStore = defineStore(
|
||||
message.success(t('login.loginSuccess'));
|
||||
window.removeEventListener("message", messageHandler);
|
||||
setTimeout(() => {
|
||||
router.push('/main');
|
||||
router.push('/main/photo/all');
|
||||
}, 1000);
|
||||
} else {
|
||||
message.error(t('login.loginError'));
|
||||
|
@@ -27,7 +27,7 @@ const {onAuthRequired, onResponseRefreshToken} = createServerTokenAuthentication
|
||||
// 刷新token
|
||||
const user = useStore().user;
|
||||
const res: any = await refreshToken();
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
user.user.access_token = res.data;
|
||||
}
|
||||
}
|
||||
|
@@ -263,7 +263,7 @@ async function resetPasswordSubmit() {
|
||||
.validate()
|
||||
.then(async () => {
|
||||
const res: any = await resetPasswordApi(ResetPasswordForm);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
message.success(t('login.resetPasswordSuccess'));
|
||||
router.push('/login');
|
||||
} else {
|
||||
@@ -285,7 +285,7 @@ const refreshCaptcha = useDebounceFn(getRotateCaptcha, 3000);
|
||||
*/
|
||||
async function getRotateCaptcha() {
|
||||
const data: any = await getRotatedCaptchaData();
|
||||
if (data.code === 200 && data.data) {
|
||||
if (data && data.code === 200) {
|
||||
const {image, thumb, key} = data.data;
|
||||
captchaData.image = image;
|
||||
captchaData.thumb = thumb;
|
||||
@@ -300,7 +300,7 @@ async function getRotateCaptcha() {
|
||||
*/
|
||||
async function sendMessageByPhone(param: any): Promise<boolean> {
|
||||
const res: any = await sendMessage(param);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
message.success(t('login.sendCaptchaSuccess'));
|
||||
return true;
|
||||
} else {
|
||||
|
@@ -372,7 +372,7 @@ async function phoneLoginSubmit() {
|
||||
.then(async () => {
|
||||
loginLoading.value = true;
|
||||
const res: any = await phoneLoginApi(phoneLoginForm);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
userStore.user.uid = res.data.uid;
|
||||
userStore.user.access_token = res.data.access_token;
|
||||
userStore.user.username = res.data.username;
|
||||
@@ -382,7 +382,7 @@ async function phoneLoginSubmit() {
|
||||
message.success(t('login.loginSuccess'));
|
||||
loginLoading.value = false;
|
||||
setTimeout(() => {
|
||||
router.push('/main');
|
||||
router.push('/main/photo/all');
|
||||
}, 1000);
|
||||
} else {
|
||||
loginLoading.value = false;
|
||||
@@ -410,7 +410,7 @@ async function getRotateCaptcha() {
|
||||
accountLoginRotateRef.value?.clear();
|
||||
}
|
||||
const data: any = await getRotatedCaptchaData();
|
||||
if (data.code === 200 && data.data) {
|
||||
if (data && data.code === 200) {
|
||||
const {image, thumb, key} = data.data;
|
||||
captchaData.image = image;
|
||||
captchaData.thumb = thumb;
|
||||
@@ -459,7 +459,7 @@ async function checkAccountLoginCaptcha(angle: number) {
|
||||
};
|
||||
loginLoading.value = true;
|
||||
const res: any = await accountLoginApi(params);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
userStore.user.uid = res.data.uid;
|
||||
userStore.user.access_token = res.data.access_token;
|
||||
userStore.user.username = res.data.username;
|
||||
@@ -470,7 +470,7 @@ async function checkAccountLoginCaptcha(angle: number) {
|
||||
loginLoading.value = false;
|
||||
showAccountRotateCaptcha.value = false;
|
||||
setTimeout(() => {
|
||||
router.push('/main');
|
||||
router.push('/main/photo/all');
|
||||
}, 1000);
|
||||
} else {
|
||||
loginLoading.value = false;
|
||||
@@ -484,7 +484,7 @@ async function checkAccountLoginCaptcha(angle: number) {
|
||||
*/
|
||||
async function sendMessageByPhone(params: any): Promise<boolean> {
|
||||
const res: any = await sendMessage(params);
|
||||
if (res.code === 200) {
|
||||
if (res && res.code === 200) {
|
||||
message.success(t('login.sendCaptchaSuccess'));
|
||||
return true;
|
||||
} else {
|
||||
|
@@ -84,7 +84,7 @@ async function sendImage() {
|
||||
user_id: route.query.user_id as string,
|
||||
};
|
||||
const res: any = await uploadImage(data);
|
||||
if (res && res.code === 200) {
|
||||
if (res && res && res.code === 200) {
|
||||
message.success(t('upload.uploadSuccess'));
|
||||
} else {
|
||||
message.error(res.message);
|
||||
|
@@ -70,7 +70,7 @@ const userStore = useStore().user;
|
||||
*/
|
||||
async function getQrCode() {
|
||||
const res: any = await generateQrCode(userStore.clientId);
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
status.value = 'active';
|
||||
qrcode.value = res.data;
|
||||
await handleListenMessage();
|
||||
@@ -92,7 +92,7 @@ async function handleListenMessage() {
|
||||
websocket.initialize(wsOptions);
|
||||
// 注册消息接收处理函数
|
||||
websocket.on('message', async (res: any) => {
|
||||
if (res.code === 200 && res.data) {
|
||||
if (res && res.code === 200) {
|
||||
userStore.user.uid = res.data.uid;
|
||||
userStore.user.access_token = res.data.access_token;
|
||||
userStore.user.username = res.data.username;
|
||||
@@ -103,7 +103,7 @@ async function handleListenMessage() {
|
||||
await getUserDevice();
|
||||
message.success(t('login.loginSuccess'));
|
||||
setTimeout(() => {
|
||||
router.push('/main');
|
||||
router.push('/main/photo/all');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
@@ -35,7 +35,7 @@ const wsOptions = {
|
||||
onMounted(() => {
|
||||
websocket.initialize(wsOptions);
|
||||
websocket.on("message", async (res: any) => {
|
||||
if (res && res.code === 200) {
|
||||
if (res && res && res.code === 200) {
|
||||
const {data} = res;
|
||||
img.src = data;
|
||||
await upscale.loadImg(img);
|
||||
|
Reference in New Issue
Block a user