Update index.vue

parent 68388f04
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
@SetFilePDF="SetFilePDF($event)" @SetFilePDF="SetFilePDF($event)"
@deleteAvatar="deleteAvatar" @deleteAvatar="deleteAvatar"
@savePostInfo="addNewPost" @savePostInfo="addNewPost"
@shape="handlecheckShape"
/> />
<AddUpdatePostDialog <AddUpdatePostDialog
...@@ -282,7 +283,8 @@ export default defineComponent({ ...@@ -282,7 +283,8 @@ export default defineComponent({
sortable: false, sortable: false,
}, },
]; ];
const shape = ref('0');
const shape = ref(0);
const pageIndex = ref(1); const pageIndex = ref(1);
const pageSize = ref(20); const pageSize = ref(20);
const totalPage = ref(1); const totalPage = ref(1);
...@@ -377,8 +379,13 @@ export default defineComponent({ ...@@ -377,8 +379,13 @@ export default defineComponent({
avatarUploaded.value = await callApiUploadAvatar( avatarUploaded.value = await callApiUploadAvatar(
avatarFile.value as File avatarFile.value as File
); );
filePDFUploaded.value = await callApiUploadAvatar(filePDF.value as File); if(shape.value === 1){
filePDFUploaded.value = await callApiUploadAvatar(filePDF.value as File);
} else {
filePDFUploaded.value = ''
}
const data = { const data = {
image: avatarUploaded.value, image: avatarUploaded.value,
status: status.value, status: status.value,
...@@ -462,7 +469,8 @@ export default defineComponent({ ...@@ -462,7 +469,8 @@ export default defineComponent({
void updatePost(avatarUploaded.value, filePDFUploaded.value); void updatePost(avatarUploaded.value, filePDFUploaded.value);
}; };
const updatePost = async (image: string, filePost: string) => { const updatePost = async (image: string, filePost: string) => {
const data = { const data = {
id: postId.value, id: postId.value,
image, image,
...@@ -575,7 +583,8 @@ export default defineComponent({ ...@@ -575,7 +583,8 @@ export default defineComponent({
} }
}; };
const handlecheckShape = (value: any) => { const handlecheckShape = (value: number) => {
shape.value = value
if (value === 1) { if (value === 1) {
const data = []; const data = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment