diff --git a/web/src/components/selectFile/selectFile.vue b/web/src/components/selectFile/selectFile.vue index 0c28df291c..bcb4322aa7 100644 --- a/web/src/components/selectFile/selectFile.vue +++ b/web/src/components/selectFile/selectFile.vue @@ -20,7 +20,6 @@ import { ref, watch } from 'vue' import { ElMessage } from 'element-plus' -import { useUserStore } from '@/pinia/modules/user' import { getBaseUrl } from '@/utils/format' defineOptions({ @@ -42,14 +41,11 @@ const props = defineProps({ }, }) -const path = ref(import.meta.env.VITE_BASE_API) - -const userStore = useUserStore() const fullscreenLoading = ref(false) const fileList = ref(props.modelValue) -const emits = defineEmits(['update:modelValue']) +const emits = defineEmits(['update:modelValue', 'on-success', 'on-error']) watch(fileList.value, (val) => { console.log(val) @@ -72,14 +68,16 @@ const uploadSuccess = (res) => { }) fullscreenLoading.value = false } + emits('on-success', res) } -const uploadError = () => { +const uploadError = (err) => { ElMessage({ type: 'error', message: '上传失败' }) fullscreenLoading.value = false + emits('on-error',err) } diff --git a/web/src/components/upload/common.vue b/web/src/components/upload/common.vue index a010e2cd9f..39308060fe 100644 --- a/web/src/components/upload/common.vue +++ b/web/src/components/upload/common.vue @@ -25,7 +25,6 @@ defineOptions({ }) const emit = defineEmits(['on-success']) -const path = ref(import.meta.env.VITE_BASE_API) const fullscreenLoading = ref(false)