提交 ac9c3738 编写于 作者: zhaosheng.zhang's avatar zhaosheng.zhang

feat: 预约单列表/病情照片支持上传视频优化

上级 9e350330
...@@ -68,6 +68,12 @@ export default { ...@@ -68,6 +68,12 @@ export default {
}, },
watch: { watch: {
imgList(newv) { imgList(newv) {
// 接口返回的视频格式第一帧,作为图片显示
newv.forEach((item) => {
if (this.isVideoFormat(item?.url)) {
this.getVideoCover(item);
}
});
this.imgArr = newv; this.imgArr = newv;
}, },
}, },
...@@ -80,20 +86,42 @@ export default { ...@@ -80,20 +86,42 @@ export default {
this.imgArr = fileList; this.imgArr = fileList;
}, },
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
const isImage = file.raw.type.startsWith('image/');
const isVideo = file.raw.type.startsWith('video/mp4');
this.dialogVisible = true; this.dialogVisible = true;
if (file?.raw) {
const isImage = this.isImageURL(file?.raw?.name);
const isVideo = this.isVideoFormat(file?.raw?.name);
if (isVideo) { if (isVideo) {
this.isVideo = true; this.isVideoStatus(file);
this.isImage = false;
} }
if (isImage) { if (isImage) {
this.isImageStatus(file);
}
return;
}
if (this.isImageURL(file?.url)) {
this.isImageStatus(file);
} else {
this.isVideoStatus(file);
}
},
isImageStatus(file) {
this.isImage = true; this.isImage = true;
this.isVideo = false; this.isVideo = false;
this.dialogImageUrl = file.url; this.dialogImageUrl = file?.url;
} },
isVideoStatus(file) {
this.isVideo = true;
this.isImage = false;
this.getVideoCover(file);
},
isImageURL(url) {
return /\.(jpg|jpeg|png)$/i.test(url);
},
isVideoFormat(url) {
const videoExtensions = /\.(mp4)$/i;
return videoExtensions.test(url);
}, },
handleExceed(files, fileList) { handleExceed(files, fileList) {
this.$message.warning( this.$message.warning(
...@@ -121,8 +149,8 @@ export default { ...@@ -121,8 +149,8 @@ export default {
return newArr; return newArr;
}, },
beforeUpload(file) { beforeUpload(file) {
const isImage = file.type.startsWith('image/'); const isImage = this.isImageURL(file?.name);
const isVideo = file.type.startsWith('video/mp4'); const isVideo = this.isVideoFormat(file?.name);
if (isImage) { if (isImage) {
this.isImage = true; this.isImage = true;
this.isVideo = false; this.isVideo = false;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册