From a47ab30f19fe09180e48d323122e4ceb811063a8 Mon Sep 17 00:00:00 2001
From: qingyu <14049064+qingyuya123@user.noreply.gitee.com>
Date: Thu, 26 Jun 2025 15:23:34 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=86=E9=A2=91=E9=83=A8?=
=?UTF-8?q?=E5=88=86=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Upload/UploadVideo.vue | 41 +++++++++++++++++--
.../videoCenter/components/EditDialog.vue | 28 ++++++-------
src/views/dynamic/videoCenter/index.vue | 14 +++----
3 files changed, 57 insertions(+), 26 deletions(-)
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 @@
- imgChange(val, 'fullImg')" />
+ imgChange(val, 'fullImg')" />
- imgChange(val, 'smallImg')" />
+ imgChange(val, 'smallImg')" />
- imgChange(val, 'videoUrl')" />
+ imgChange(val, 'videoUrl')" />
@@ -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 @@
-
+
{{ record.title }}
-
-
- {{ record.subheading }}
-
-
+
+
+
+
+
{{
@@ -115,7 +115,7 @@ const columns = [
{ title: '小图片', dataIndex: 'smallImg', width: 100, align: 'center' },
{ title: '视频', dataIndex: 'videoUrl', width: 100, align: 'center' },
{ title: '标题', dataIndex: 'title', key: 'title' },
- { title: '简介', dataIndex: 'subheading', key: 'subheading' },
+ // { title: '简介', dataIndex: 'subheading', key: 'subheading' },
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
{ title: '发布日期', dataIndex: 'pushAt', width: 120, align: 'center' },
{ title: '链接', dataIndex: 'link', align: 'center' },