fix: upload router path

pull/57/head
ROC 3 years ago
parent 804bb50bae
commit f659713872

@ -170,15 +170,18 @@ import { parsePostTag } from '@/utils/content';
import type { MentionOption, UploadFileInfo, UploadInst } from 'naive-ui'; import type { MentionOption, UploadFileInfo, UploadInst } from 'naive-ui';
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'post-success'): void (e: 'post-success'): void;
}>(); }>();
const props = withDefaults(defineProps<{ const props = withDefaults(
lock: number, defineProps<{
postId: number, lock: number;
}>(), { postId: number;
lock: 0, }>(),
postId: 0 {
}); lock: 0,
postId: 0,
}
);
const store = useStore(); const store = useStore();
@ -192,7 +195,7 @@ const uploadType = ref('public/image');
const fileQueue = ref<UploadFileInfo[]>([]); const fileQueue = ref<UploadFileInfo[]>([]);
const imageContents = ref<Item.CommentItemProps[]>([]); const imageContents = ref<Item.CommentItemProps[]>([]);
const uploadGateway = import.meta.env.VITE_HOST + '/attachment'; const uploadGateway = import.meta.env.VITE_HOST + '/v1/attachment';
const uploadToken = ref(); const uploadToken = ref();
// 加载at用户列表 // 加载at用户列表
@ -249,7 +252,10 @@ const beforeUpload = async (data: any) => {
return false; return false;
} }
if (uploadType.value === 'image' && (data.file as any).file?.size > 10485760) { if (
uploadType.value === 'image' &&
(data.file as any).file?.size > 10485760
) {
window.$message.warning('10MB'); window.$message.warning('10MB');
return false; return false;
} }

@ -248,7 +248,7 @@ import { parsePostTag } from '@/utils/content';
import type { MentionOption, UploadFileInfo, UploadInst } from 'naive-ui'; import type { MentionOption, UploadFileInfo, UploadInst } from 'naive-ui';
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'post-success', post: Item.PostProps): void (e: 'post-success', post: Item.PostProps): void;
}>(); }>();
const store = useStore(); const store = useStore();
@ -267,7 +267,7 @@ const imageContents = ref<Item.CommentItemProps[]>([]);
const videoContents = ref<Item.CommentItemProps[]>([]); const videoContents = ref<Item.CommentItemProps[]>([]);
const attachmentContents = ref<Item.AttachmentProps[]>([]); const attachmentContents = ref<Item.AttachmentProps[]>([]);
const uploadGateway = import.meta.env.VITE_HOST + '/attachment'; const uploadGateway = import.meta.env.VITE_HOST + '/v1/attachment';
const uploadToken = ref(); const uploadToken = ref();
const switchLink = () => { const switchLink = () => {

@ -261,7 +261,7 @@ import type {
InputInst, InputInst,
} from 'naive-ui'; } from 'naive-ui';
const uploadGateway = import.meta.env.VITE_HOST + '/attachment'; const uploadGateway = import.meta.env.VITE_HOST + '/v1/attachment';
const uploadToken = 'Bearer ' + localStorage.getItem('PAOPAO_TOKEN'); const uploadToken = 'Bearer ' + localStorage.getItem('PAOPAO_TOKEN');
const uploadType = ref('public/avatar'); const uploadType = ref('public/avatar');

Loading…
Cancel
Save