提交 dadb1266 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 b4a2b124
......@@ -12,32 +12,36 @@ const form = reactive({
name: '0',
classification: ''
})
defineProps({
isShowBatchImport: {
type: Boolean
}
})
interface Emits {
(e: 'update:isShowBatchImport', isShowBatchImport: boolean): void
(e: 'update:modelValue', modelValue: boolean): void
(e: 'update'): void
}
const uploadMultipleVideoRef = ref()
const handleConfirm = () => {
emit('update:isShowBatchImport', false)
emit('update:modelValue', false)
emit('update')
}
const handleCancel = () => {
if (closeStatus.value !== false) {
emit('update:isShowBatchImport', false)
const fileList = uploadMultipleVideoRef.value?.uploader?._uploadList || []
if (fileList.length) {
for (const item of fileList) {
if (item.state === 'Uploading') {
return ElMessage.error('请先完成上传')
}
}
}
emit('update:modelValue', false)
}
// 上传视频成功
const uploadVideo = (data: any) => {
const { file, videoId } = data
const params = {
name: data.name.slice(0, data.name.lastIndexOf('.')),
name: file.name.slice(0, file.name.lastIndexOf('.')),
source: '2',
classification: form.classification,
knowledge_points: '',
source_id: data.videoId,
source_id: videoId,
cover: ''
}
createVideo(params).then(() => {
......@@ -49,7 +53,7 @@ const handleClose = (val: any) => {
}
</script>
<template>
<el-dialog :model-value="isShowBatchImport" title="批量导入视频" :before-close="handleCancel">
<el-dialog title="批量导入视频" :close-on-click-modal="false" :before-close="handleCancel">
<el-form :model="form" label-suffix=":">
<el-form-item label="视频分类" prop="classification">
<el-tree-select
......@@ -64,7 +68,7 @@ const handleClose = (val: any) => {
/>
</el-form-item>
<el-form-item label="视频文件" prop="source_id" v-if="form.classification !== ''">
<UploadMultipleVideo @upload="uploadVideo" @canClose="handleClose" />
<UploadMultipleVideo @upload="uploadVideo" @canClose="handleClose" ref="uploadMultipleVideoRef" />
</el-form-item>
<el-form-item label="视频名称" prop="name">
<el-radio-group v-model="form.name">
......@@ -73,11 +77,8 @@ const handleClose = (val: any) => {
</el-form-item>
</el-form>
<template #footer>
<span>
{{ closeStatus }}
<el-button type="primary" @click="handleConfirm" :disabled="closeStatus === false">保存</el-button>
<el-button @click="handleCancel" :disabled="closeStatus === false">取消</el-button>
</span>
<el-button type="primary" @click="handleConfirm" :disabled="closeStatus === false">保存</el-button>
<el-button @click="handleCancel" :disabled="closeStatus === false">取消</el-button>
</template>
</el-dialog>
</template>
......
<script lang="ts" setup>
const emit = defineEmits<Emits>()
interface UploadInfo {
bucket: string
checkpoint: { file: File; name: string; fileSize: number; partSize: number; uploadId: string }
endpoint: string
file: File
fileHash: string
isImage: boolean
loaded: number
object: string
region: string
retry: boolean
ri: string
state: string
userData: string
videoId: string
videoInfo: any
progress: number
}
interface Props {
videoList: UploadInfo[]
}
interface Emits {
(e: 'update:modelValue', modelValue: boolean): void
}
const props = defineProps<Props>()
const emit = defineEmits<Emits>()
const currentPage = ref(1)
const page = reactive({
size: 10,
currentPage: 1
})
interface IUpload {
id?: number
code: number
name?: string
msg?: string
progress?: number
videoId?: string
}
interface Props {
idShowMore: boolean
videoList: IUpload[]
}
interface Emits {
(e: 'update:idShowMore', isShowBatchImport: boolean): void
}
const handleCancel = () => {
emit('update:idShowMore', false)
emit('update:modelValue', false)
}
const handleSizeChange = (val: any) => {
page.size = val
......@@ -33,12 +41,12 @@ const handleCurrentChange = (val: any) => {
}
</script>
<template>
<el-dialog :model-value="idShowMore" title="更多视频文件" :before-close="handleCancel">
<el-dialog title="更多视频文件" :before-close="handleCancel">
<div
v-for="(item, index) in props.videoList.slice((page.currentPage - 1) * page.size, page.currentPage * page.size)"
:key="index"
>
{{ item.name }}
{{ item.file.name }}
</div>
<el-pagination
v-model:currentPage="currentPage"
......
......@@ -180,11 +180,7 @@ const handleBatchImport = () => {
</template>
</AppList>
</AppCard>
<BatchImportVideo
v-model:isShowBatchImport="isShowBatchImport"
v-if="isShowBatchImport === true"
@update="typeFilter"
/>
<BatchImportVideo v-model="isShowBatchImport" v-if="isShowBatchImport === true" @update="typeFilter" />
</template>
<style lang="scss" scoped>
.card-list {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论