diff --git a/src/components/Upload/UploadVideo.vue b/src/components/Upload/UploadVideo.vue index 8a1a9cc..5ece24d 100644 --- a/src/components/Upload/UploadVideo.vue +++ b/src/components/Upload/UploadVideo.vue @@ -73,6 +73,7 @@ import { config } from '@/config' defineOptions({ name: 'XUploadVideo', }) + defineProps({ modelValue: { type: [String, Array], @@ -114,7 +115,8 @@ const fileList = ref([]) const uploadVideoRef = ref() const loading = computed(() => fileList.value.some((o) => STATUS_ENUM.is('uploading', o.status))) -const showUploadBtn = computed(() => props.multiple || !fileList.value.length) +const showUploadBtn = computed(() =>true) +//const showUploadBtn = computed(() => props.multiple || !fileList.value.length) watch(() => props.modelValue, () => init()) onMounted(() => init()) @@ -141,7 +143,6 @@ function onBeforeUpload(file) { return true } - function customRequest(file) { const record = getItem({ key: file.uid, @@ -150,10 +151,11 @@ function customRequest(file) { file, }) - // 预览地址设置 const reader = new FileReader() reader.onload = (e) => { record.src = e.target.result + console.log('Preview loaded:', record.src) + fileList.value = [...fileList.value] // 强制响应式更新 } reader.readAsDataURL(file) @@ -168,6 +170,39 @@ function customRequest(file) { } } +// function customRequest(file) { +// const record = getItem({ +// key: file.uid, +// status: STATUS_ENUM.getValue('wait'), +// percent: 0, +// file, +// }) +// +// // 预览地址设置 +// const reader = new FileReader() +// // reader.onload = (e) => { +// // record.src = e.target.result +// // } +// reader.onload = (e) => { +// record.src = e.target.result +// fileList.value = [...fileList.value] // 触发响应式更新 +// } +// +// reader.readAsDataURL(file) +// +// if (props.multiple) { +// fileList.value.push(record) +// console.log('customRequest called:', file) +// +// } else { +// fileList.value = [record] +// } +// +// if (!loading.value) { +// doUpload() +// } +// } + async function doUpload() { const index = findIndex(fileList.value, { status: STATUS_ENUM.getValue('wait') }) if (index === -1) return diff --git a/src/views/dynamic/videoCenter/components/EditDialog.vue b/src/views/dynamic/videoCenter/components/EditDialog.vue index 99b2218..d45d2cb 100644 --- a/src/views/dynamic/videoCenter/components/EditDialog.vue +++ b/src/views/dynamic/videoCenter/components/EditDialog.vue @@ -9,12 +9,12 @@ - - - - - - + + + + + + @@ -36,17 +36,17 @@ - + - + - + @@ -127,8 +127,6 @@ function handleCreate() { }) formData.value.status = 'enabled' } - - /** * 编辑 */ @@ -145,11 +143,10 @@ async function handleEdit(record = {}) { formData.value = { ...data } formData.value.pushAt = dayjs(data.pushAt) console.log(formData.value) - formData.value.fullImg = config('http.apiBasic') + data.fullImg - formData.value.smallImg = config('http.apiBasic') + data.smallImg - formData.value.videoUrl = config('http.apiBasic') + data.videoUrl + fullImg.value = config('http.apiBasic') + data.fullImg + smallImg.value = config('http.apiBasic') + data.smallImg + videoUrl.value = config('http.apiBasic') + data.videoUrl } - /** * 确定 */ @@ -161,7 +158,6 @@ function handleOk() { showLoading() const params = { ...values, - //img: formData.value.img, fullImg: formData.value.fullImg, smallImg: formData.value.smallImg, videoUrl: formData.value.videoUrl, diff --git a/src/views/dynamic/videoCenter/index.vue b/src/views/dynamic/videoCenter/index.vue index 09b5968..8cf3986 100644 --- a/src/views/dynamic/videoCenter/index.vue +++ b/src/views/dynamic/videoCenter/index.vue @@ -52,18 +52,18 @@ - + + + + +