|
|
@@ -31,23 +31,25 @@
|
|
|
<img w-full :src="dialogImageUrl" alt="Preview Image" />
|
|
|
</el-dialog>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="问题视频:" prop="videos">
|
|
|
+ <el-form-item class="pic-form-item" label="问题视频:" prop="videos">
|
|
|
<p>(仅支持上传1条视频,大小50M以内)</p>
|
|
|
- <el-upload v-if="videoUrl.length === 0" class="avatar-uploader" action="/skyeye-admin-api/issue/uploadPicture"
|
|
|
- :show-file-list="false" :on-success="handleUploadVideo" :headers="getHeaders()"
|
|
|
- :data="{ bizType: 'PROBLEM_REPORT' }" :before-upload="beforeUploadVideo">
|
|
|
+ <el-upload v-if="formData.videos === undefined || formData.videos.length === 0" class="avatar-uploader"
|
|
|
+ action="/skyeye-admin-api/issue/uploadPicture" :show-file-list="false" :on-success="handleUploadVideo"
|
|
|
+ :headers="getHeaders()" :data="{ bizType: 'PROBLEM_REPORT' }" :before-upload="beforeUploadVideo">
|
|
|
<el-icon class="avatar-uploader-icon">
|
|
|
<Plus />
|
|
|
</el-icon>
|
|
|
</el-upload>
|
|
|
<div class="upload-success" v-else>
|
|
|
- <img src="@/assets/images/alert/video-play.png" @click="videoDialogVisible = true" />
|
|
|
- <el-icon class="clear-video" @click="videoUrl = []" :size="25">
|
|
|
+ <img src="@/assets/images/alert/video-play.png" @click="videoDialogVisible = true"
|
|
|
+ style="cursor: pointer;" />
|
|
|
+ <el-icon class="clear-video" @click="handleDeleteVideo" :size="15" color="#fff">
|
|
|
<CloseBold />
|
|
|
</el-icon>
|
|
|
- <el-dialog v-model="videoDialogVisible" width="500">
|
|
|
- <video width="320" height="200" type="video/mp4" muted="true" preload="auto" :controls="true" autoplay>
|
|
|
- <source :src="videoUrl[0]" />
|
|
|
+ <el-dialog v-model="videoDialogVisible">
|
|
|
+ <video type="video/mp4" muted="true" preload="auto" :controls="true" autoplay
|
|
|
+ style="height: 500px;object-fit: fill;">
|
|
|
+ <source :src="formData.videos![0]" />
|
|
|
</video>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
@@ -100,6 +102,7 @@ interface FormModel {
|
|
|
issueType?: number, // 类型
|
|
|
description?: string, // 描述
|
|
|
pictures?: string[], // 图片
|
|
|
+ videos?: string[],
|
|
|
workshopId?: number, // 车间id
|
|
|
workshopName?: string,
|
|
|
workspaceId?: number, // 工位id
|
|
|
@@ -122,6 +125,7 @@ const formData = reactive<FormModel>({
|
|
|
issueType: undefined,
|
|
|
description: '',
|
|
|
pictures: [],
|
|
|
+ videos: [],
|
|
|
workshopId: undefined,
|
|
|
workspaceId: undefined,
|
|
|
createdAt: '',
|
|
|
@@ -164,9 +168,11 @@ const handleCopyData = () => {
|
|
|
formData.issueType = props.initialData?.issueType;
|
|
|
formData.description = props.initialData?.description;
|
|
|
formData.pictures = props.initialData?.pictures;
|
|
|
+ formData.videos = props.initialData?.videos;
|
|
|
formData.workshopId = props.initialData?.workshopId;
|
|
|
formData.workspaceId = props.initialData?.workspaceId;
|
|
|
formData.createdAt = props.initialData?.createdAt;
|
|
|
+
|
|
|
switch (props.initialData?.issueState) {
|
|
|
case IssueState.toAuth0:
|
|
|
formData.issueState = 2;
|
|
|
@@ -229,12 +235,14 @@ const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
|
|
};
|
|
|
|
|
|
// 视频上传
|
|
|
-const videoUrl = ref<string[]>([]);
|
|
|
const videoDialogVisible = ref(false);
|
|
|
const handleUploadVideo = (res) => {
|
|
|
- videoUrl.value.push(res.data.url);
|
|
|
- console.log(videoUrl.value);
|
|
|
+ if (!formData.videos) formData.videos = [];
|
|
|
+ formData.videos.push(res.data.url);
|
|
|
};
|
|
|
+const handleDeleteVideo = () => {
|
|
|
+ formData.videos = [];
|
|
|
+}
|
|
|
const beforeUploadVideo: UploadProps['beforeUpload'] = (rawFile) => {
|
|
|
if (rawFile.type !== 'video/mp4') {
|
|
|
ElMessage.error('上传视频仅支持mp4格式');
|
|
|
@@ -244,7 +252,7 @@ const beforeUploadVideo: UploadProps['beforeUpload'] = (rawFile) => {
|
|
|
return false
|
|
|
}
|
|
|
return true
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
onMounted(() => {
|
|
|
handleCopyData();
|
|
|
@@ -319,10 +327,29 @@ p {
|
|
|
position: relative;
|
|
|
|
|
|
.clear-video {
|
|
|
+ width: 25px;
|
|
|
+ height: 25px;
|
|
|
position: absolute;
|
|
|
top: 0;
|
|
|
- right: 0;
|
|
|
+ left: 129px;
|
|
|
cursor: pointer;
|
|
|
+ background-color: #000;
|
|
|
+ border-radius: 0 0 0 25px;
|
|
|
+ opacity: 0.7;
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.el-dialog) {
|
|
|
+ width: 960px;
|
|
|
+ height: 540px;
|
|
|
+ padding: 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ background-color: #000;
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.el-dialog__header) {
|
|
|
+ display: none;
|
|
|
}
|
|
|
}
|
|
|
</style>
|