feat: 新增视频组件及配置功能

- 在 config.js 中添加视频类型配置,支持视频上传和样式设置。
- 创建 video-config.vue 组件,提供视频内容和样式的配置选项。
- 更新 decorate.vue 以支持视频类型的渲染和配置。
This commit is contained in:
pikachu1995@126.com
2026-07-07 09:39:00 +08:00
parent e13ca6281d
commit c277cf1121
15 changed files with 926 additions and 317 deletions

View File

@@ -536,6 +536,7 @@ export default {
name: "",
fileKey: "",
fileType: "",
fileCategory: "",
userEnums: "STORE",
pageNumber: 1, // 当前页数
pageSize: 20, // 页面大小
@@ -574,7 +575,7 @@ export default {
width: 300,
align: "center",
render: (h, params) => {
if (params.row.fileType.includes("image") > 0) {
if (this.isImageFile(params.row)) {
return h("img", {
attrs: {
src: params.row.url || "",
@@ -593,7 +594,7 @@ export default {
},
},
});
} else if (params.row.fileType.includes("video") > 0) {
} else if (this.isVideoFile(params.row)) {
// 如果视频文件大小超过5MB不予加载video
if (params.row.fileSize < 1024 * 1024 * 5) {
return h(
@@ -775,7 +776,7 @@ export default {
// width: 150,
align: "center",
render: (h, params) => {
if (params.row.fileType.includes("image") > 0) {
if (this.isImageFile(params.row)) {
return h("img", {
attrs: {
src: params.row.url || "",
@@ -794,7 +795,7 @@ export default {
},
},
});
} else if (params.row.fileType.includes("video") > 0) {
} else if (this.isVideoFile(params.row)) {
// 如果视频文件大小超过5MB不予加载video
if (params.row.fileSize < 1024 * 1024 * 5) {
return h(
@@ -1391,16 +1392,22 @@ export default {
},
// 文件类型筛选
changeFileType() {
let name = this.fileType;
if (name == "all") {
this.searchForm.fileType = "";
} else if (name == "pic") {
this.searchForm.fileType = "image";
} else if (name == "video") {
this.searchForm.fileType = "video";
const name = this.fileType;
this.searchForm.fileType = "";
this.searchForm.fileCategory = "";
if (name === "pic") {
this.searchForm.fileCategory = "IMAGE";
} else if (name === "video") {
this.searchForm.fileCategory = "VIDEO";
}
this.handleSearch();
},
isImageFile(row) {
return row?.fileCategory === "IMAGE" || (row?.fileType && row.fileType.includes("image"));
},
isVideoFile(row) {
return row?.fileCategory === "VIDEO" || (row?.fileType && row.fileType.includes("video"));
},
// 上传文件超过大小限制
handleMaxSize() {
this.$Message.warning("所选文件大小过大,不得超过 20MB");

View File

@@ -45,14 +45,14 @@
width: 100%;
display: flex;
flex-wrap: wrap;
gap: 14px;
> .drawer-item {
cursor: pointer;
border: 1px solid #ededed;
background: #f9f0ff;
width: 170px;
margin-right: 14px;
width: calc(50% - 7px);
box-sizing: border-box;
color: #9254de;
margin-bottom: 14px;
border-radius: 0.8em;
height: 60px;
display: flex;

View File

@@ -559,6 +559,7 @@ export default {
name: "",
fileKey: "",
fileType: "",
fileCategory: "",
userEnums: "MANAGER",
pageNumber: 1, // 当前页数
pageSize: 20, // 页面大小
@@ -597,7 +598,7 @@ export default {
width: 300,
align: "center",
render: (h, params) => {
if (params.row.fileType.includes("image") > 0) {
if (this.isImageFile(params.row)) {
return h("img", {
attrs: {
src: params.row.url || "",
@@ -616,7 +617,7 @@ export default {
},
},
});
} else if (params.row.fileType.includes("video") > 0) {
} else if (this.isVideoFile(params.row)) {
// 如果视频文件大小超过5MB不予加载video
if (params.row.fileSize < 1024 * 1024 * 5) {
return h(
@@ -798,7 +799,7 @@ export default {
// width: 150,
align: "center",
render: (h, params) => {
if (params.row.fileType.includes("image") > 0) {
if (this.isImageFile(params.row)) {
return h("img", {
attrs: {
src: params.row.url || "",
@@ -817,7 +818,7 @@ export default {
},
},
});
} else if (params.row.fileType.includes("video") > 0) {
} else if (this.isVideoFile(params.row)) {
// 如果视频文件大小超过5MB不予加载video
if (params.row.fileSize < 1024 * 1024 * 5) {
return h(
@@ -1452,16 +1453,22 @@ export default {
},
// 文件类型筛选
changeFileType() {
let name = this.fileType;
if (name == "all") {
this.searchForm.fileType = "";
} else if (name == "pic") {
this.searchForm.fileType = "image";
} else if (name == "video") {
this.searchForm.fileType = "video";
const name = this.fileType;
this.searchForm.fileType = "";
this.searchForm.fileCategory = "";
if (name === "pic") {
this.searchForm.fileCategory = "IMAGE";
} else if (name === "video") {
this.searchForm.fileCategory = "VIDEO";
}
this.handleSearch();
},
isImageFile(row) {
return row?.fileCategory === "IMAGE" || (row?.fileType && row.fileType.includes("image"));
},
isVideoFile(row) {
return row?.fileCategory === "VIDEO" || (row?.fileType && row.fileType.includes("video"));
},
// 上传文件超过大小限制
handleMaxSize() {
this.$Message.warning("所选文件大小过大,不得超过 20MB");