refactor(front): replace FileUploadResultView with ResultIndexView and update form field naming for consistency

This commit is contained in:
keven1024
2025-05-19 21:09:38 +08:00
parent a7c8b409c8
commit 2fff490baa
5 changed files with 36 additions and 32 deletions

View File

@@ -2,12 +2,12 @@
import VeeForm from '@/components/VeeForm.vue'
import FileUploadInputFileView from './FileUploadInputFileView.vue'
import FileUploadProgressView from './FileUploadProgressView.vue'
import FileUploadResultView from './FileUploadResultView.vue'
import ResultIndexView from '@/components/Result/ResultIndexView.vue'
const fileStepList = [
{ component: FileUploadInputFileView, key: 'input' },
{ component: FileUploadProgressView, key: 'progress' },
{ component: FileUploadResultView, key: 'result' },
{ component: ResultIndexView, key: 'result' },
]
const step = ref('input')

View File

@@ -14,7 +14,7 @@ const handleFormSubmit = async (form: any) => {
showDrawer({
render: ({ hide }) => h(FileShareDrawer, {
hide, file, onFileHandle: ({ type, config }) => {
form.setFieldValue('file_handle_type', type)
form.setFieldValue('handle_type', type)
form.setFieldValue('config', config)
emit('change', 'progress')
}

View File

@@ -1,29 +0,0 @@
<script lang="ts" setup>
import FileShareResult from '@/components/Result/FileShareResult.vue'
const props = defineProps<{
data: { file: File, config: any, file_handle_type: string, file_id: string }
}>()
const emit = defineEmits<{
(e: 'change', key: string): void
}>()
// console.log(props.data)
const handleList = [
{ component: FileShareResult, key: 'file-share' },
// { component: FileShareResult, key: 'file-share' },
]
const handleComponent = computed(() => {
return handleList.find((item) => item.key === props?.data?.file_handle_type)?.component
})
</script>
<template>
<div class="">
<component :is="handleComponent" :data="data" @change="(key: string) => {
emit('change', key)
}" />
</div>
</template>

View File

@@ -0,0 +1,33 @@
<script lang="ts" setup>
import FileShareResult from '@/components/Result/FileShareResult.vue'
type basehandleData = { config: any, handle_type: string }
type filehandleData = { file: File, file_id: string } & basehandleData
type texthandleData = { text: string } & basehandleData
const props = defineProps<{
data: filehandleData
}>()
const emit = defineEmits<{
(e: 'change', key: string): void
}>()
// console.log(props.data)
const handleList = [
{ component: FileShareResult, key: 'file-share' },
// { component: FileShareResult, key: 'file-share' },
]
const handleComponent = computed(() => {
return handleList.find((item) => item.key === props?.data?.handle_type)?.component
})
</script>
<template>
<div class="">
<component :is="handleComponent" :data="data" @change="(key: string) => {
emit('change', key)
}" />
</div>
</template>