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

Merge branch 'task/reservation/video' into 'release'

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

See merge request com.pica.cloud.education.frontend/pica-admin-consultation!286
......@@ -68,6 +68,12 @@ export default {
},
watch: {
imgList(newv) {
// 接口返回的视频格式第一帧,作为图片显示
newv.forEach((item) => {
if (this.isVideoFormat(item?.url)) {
this.getVideoCover(item);
}
});
this.imgArr = newv;
},
},
......@@ -80,21 +86,43 @@ export default {
this.imgArr = fileList;
},
handlePictureCardPreview(file) {
const isImage = file.raw.type.startsWith('image/');
const isVideo = file.raw.type.startsWith('video/mp4');
this.dialogVisible = true;
if (file?.raw) {
const isImage = this.isImageURL(file?.raw?.name);
const isVideo = this.isVideoFormat(file?.raw?.name);
if (isVideo) {
this.isVideoStatus(file);
}
if (isVideo) {
this.isVideo = true;
this.isImage = false;
if (isImage) {
this.isImageStatus(file);
}
return;
}
if (isImage) {
this.isImage = true;
this.isVideo = false;
this.dialogImageUrl = file.url;
if (this.isImageURL(file?.url)) {
this.isImageStatus(file);
} else {
this.isVideoStatus(file);
}
},
isImageStatus(file) {
this.isImage = true;
this.isVideo = false;
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) {
this.$message.warning(
`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
......@@ -121,8 +149,8 @@ export default {
return newArr;
},
beforeUpload(file) {
const isImage = file.type.startsWith('image/');
const isVideo = file.type.startsWith('video/mp4');
const isImage = this.isImageURL(file?.name);
const isVideo = this.isVideoFormat(file?.name);
if (isImage) {
this.isImage = true;
this.isVideo = false;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册