From f4c324b44aadc4d8a44d4c67c588d2f76261ccaa Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期三, 30 十一月 2022 16:07:39 +0800
Subject: [PATCH] fix:消息分页 视频查询 图片查询
---
src/views/operate/video/updateInterface/index.vue | 241 +++++++++++++++++++----------------------------
1 files changed, 97 insertions(+), 144 deletions(-)
diff --git a/src/views/operate/video/updateInterface/index.vue b/src/views/operate/video/updateInterface/index.vue
index beec037..60805da 100644
--- a/src/views/operate/video/updateInterface/index.vue
+++ b/src/views/operate/video/updateInterface/index.vue
@@ -1,46 +1,47 @@
<template>
<div class="updateUser">
- <main>
- <div class="mainContent">
- <el-form :model="videoData" :rules="rules" :disabled="isDisabled" ref="user" style="width: 100%;">
- <el-form-item prop="baseId" label="鎵�灞炰簨浠剁紪鍙�">
- <el-input v-model="videoData.baseId"></el-input>
- </el-form-item>
- <el-form-item prop="eventSource" label="浜嬩欢鏉ユ簮">
- <el-input v-model="videoData.eventSource"></el-input>
- </el-form-item>
- <el-form-item prop="category" label="闂绫诲埆">
- <el-input v-model="videoData.category"></el-input>
- </el-form-item>
- <el-form-item prop="type" label="绫诲瀷">
- <el-select v-model="videoData.type">
- <el-option v-for="item in getResourceType()" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item prop="regionName" label="绀惧尯鍚嶇О">
- <el-input v-model="videoData.regionName"></el-input>
- </el-form-item>
- <el-form-item prop="id" label="瑙嗛Id">
- <el-input v-model="videoData.id"></el-input>
- </el-form-item>
- <el-form-item prop="url" label="瑙嗛" min-width="8">
- <el-upload
- class="avatar-uploader"
- action=""
- ref="image"
- :show-file-list="false"
- :auto-upload="true"
- :http-request="videoUpload">
- <video v-if="videoData.url" :src="videoData.url" class="avatar" />
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- </el-form-item>
- <div v-if="!isDisabled" class="optionBtn">
- <el-button type="primary" class="btn submit" @click.native.prevent="onSubmit">鎻愪氦</el-button>
+ <el-form label-position="right" label-width="150px" :model="videoData" :rules="rules" :disabled="isDisabled" ref="user">
+ <!-- <el-form-item prop="belongToId" label="鎵�灞炰簨浠剁紪鍙�">
+ <el-input v-model="videoData.belongToId"></el-input>
+ </el-form-item>
+ <el-form-item prop="eventSource" label="浜嬩欢鏉ユ簮">
+ <el-input v-model="videoData.eventSource"></el-input>
+ </el-form-item>
+ <el-form-item prop="category" label="闂绫诲埆">
+ <el-input v-model="videoData.category"></el-input>
+ </el-form-item>
+ <el-form-item prop="type" label="绫诲瀷">
+ <el-select v-model="videoData.type">
+ <el-option v-for="item in getResourceType()" :key="item.value" :label="item.label" :value="item.value" />
+ </el-select>
+ </el-form-item>
+ <el-form-item prop="regionName" label="绀惧尯鍚嶇О">
+ <el-input v-model="videoData.regionName"></el-input>
+ </el-form-item>
+ <el-form-item prop="id" label="瑙嗛Id">
+ <el-input v-model="videoData.id"></el-input>
+ </el-form-item> -->
+ <el-form-item prop="url" label="瑙嗛" min-width="8">
+ <template v-if="videoList" >
+ <div class="video-cover" v-for="video in videoList" :key="video">
+ <i v-if="isUpdate" @click="handleDelete(video)" class="el-icon-delete video-delete-icon"></i>
+ <video controls :src="video" width="100%" height="100%"/>
</div>
- </el-form>
- </div>
- </main>
+ </template>
+ <el-upload
+ v-if="isUpdate"
+ class="avatar-uploader"
+ action=""
+ ref="image"
+ :limit="4"
+ :show-file-list="false"
+ :auto-upload="true"
+ :http-request="videoUpload">
+ <el-button size="small" type="primary">涓婁紶瑙嗛<i class="el-icon-upload el-icon--right"></i></el-button>
+ </el-upload>
+ </el-form-item>
+ <el-button v-if="!isDisabled" class="submit-button" type="primary" @click.native.prevent="onSubmit">鎻愪氦</el-button>
+ </el-form>
</div>
</template>
<script>
@@ -48,7 +49,6 @@
import videoManagement from "@/api/operate/videoManagement";
import { FILE_ORIGINAL_URL } from "@/utils";
import imageManagement from "@/api/operate/imageManagement";
-
export default {
data() {
@@ -61,7 +61,7 @@
};
return {
videoData: {
- baseId: '',
+ belongToId: '',
eventSource: '',
regionName: '',
category: '',
@@ -70,36 +70,46 @@
type: ''
},
rules: {
- baseId: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ユ墍灞炰簨浠剁紪鍙�' }],
+ belongToId: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ユ墍灞炰簨浠剁紪鍙�' }],
eventSource: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ヤ簨浠舵潵婧�' }],
regionName: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ョぞ鍖哄悕绉�' }],
- id: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ュ浘鐗嘔d' }],
+ id: [{ required: true, trigger: 'blur', message: '璇疯緭鍏ヨ棰慖d' }],
category: [{ required: true, trigger: 'blue', message: '璇疯緭鍏ラ棶棰樼被鍨�' }],
url: [{ required: true, validator: validateVideoUrl }],
type: [{ required: true, trigger: ['blur', 'change'], message: '璇烽�夋嫨绫诲瀷' }]
},
- isDisabled: false
+ isDisabled: false,
+ videoList: []
}
},
created() {
this.videoData = deepClone(this.dialogData);
- this.videoData.url = this.videoData.url ? this.videoData.url.split(',')[0] : '';
+ if (this.videoData.url) {
+ this.videoList = this.videoData.url.split(',');
+ }
this.isDisabled = !this.isUpdate;
},
methods: {
onSubmit() {
this.$refs.user.validate(valid => {
if (valid) {
- if (this.dialogType === 'create') {
- videoManagement.addVideoResource(this.videoData)
+ const params = Object.assign({}, this.videoData);
+ delete params.regionName;
+ delete params.category;
+ delete params.eventSource;
+ delete params.id;
+ params.belongToId = +params.belongToId;
+ params.type="03"
+ if (this.isUpdate && !this.dialogData) {
+ videoManagement.addVideoResource(params)
.then(() => {
this.$message.success('鎿嶄綔鎴愬姛');
this.$emit('closeDialog');
})
.catch(err => this.$message.error(`${err}`))
} else {
- videoManagement.updateVideoResource(this.videoData)
+ videoManagement.updateVideoResource(params)
.then(() => {
this.$message.success('鎿嶄綔鎴愬姛');
this.$emit('closeDialog');
@@ -116,8 +126,10 @@
formData.append('file', file.file);
imageManagement.importImage(formData)
.then(res => {
- this.$refs.image.clearFiles();
- this.$set(this.videoData, 'url', FILE_ORIGINAL_URL + res.url1);
+ const url = res.url1 ?? res.url2 ?? res.url3 ?? res.url4;
+ const videoUrl = FILE_ORIGINAL_URL + url;
+ this.videoList.push(videoUrl);
+ this.$set(this.videoData, 'url', this.videoList.join(','));
this.$message.success('涓婁紶鎴愬姛');
})
.catch(err => {
@@ -125,6 +137,12 @@
this.$refs.image.clearFiles();
})
},
+
+ handleDelete(data) {
+ this.videoList = this.videoList.filter(item => item !== data);
+ this.videoData.url = this.videoList.join(',');
+ },
+
getResourceType(value) {
return value ? RESOURCE_TYPE.find(item => item.value === value) : RESOURCE_TYPE;
}
@@ -145,50 +163,37 @@
.updateUser {
border-radius: 1px;
background-color: #09152f;
+ display: flex;
+ justify-content: center;
+ align-items: center;
- main {
- // border: 1px solid #fff;
- text-align: left;
- padding: 0 55px;
- background-color: #09152f;
- padding-bottom: 50px;
+ .video-cover {
+ height: 169px;
+ display: flex;
+ }
- .mainContent {
- display: flex;
- justify-content: center;
- padding-top: 50px;
-
- .el-form-item__content {
- width: 400px;
-
- .el-select {
- width: 100%;
- }
- }
-
- .optionHandleSp {
- display: flex;
-
- .areaNumber,
- .moreNumber {
- flex: 1;
- }
-
- .telNumber {
- flex: 2;
- }
- }
-
- .optionBtn {
- display: flex;
- margin-top: 20px;
- justify-content: center;
-
- .btn {
- padding: 12px 50px;
- }
- }
+ .video-cover:hover {
+ background-color: #ffffff;
+ opacity: .6;
+ .video-delete-icon {
+ display: block;
+ opacity: 1;
}
+ }
+
+ .video-delete-icon {
+ position: absolute;
+ color: red;
+ left: calc(100% - 160px);
+ top: calc(100% - 150px);
+ z-index: 2;
+ height: 14px;
+ font-size: 24px;
+ display: none;
+ }
+
+ .submit-button {
+ margin-left: 200px;
}
}
@@ -229,58 +234,6 @@
width: 36px;
height: 36px;
border-radius: 50%;
-}
-
-.card {
- position: absolute;
- z-index: 2000;
- right: 0;
-
- .box-card {
- min-height: 240px;
- max-height: 260px;
- overflow: hidden;
- background-color: #09152f;
- position: relative;
- max-width: 220px;
-
- .scrollWrap {
- overflow: scroll;
- height: 180px;
- position: relative;
- color: #4b9bb7;
-
- .el-checkbox-group {
- display: flex;
- flex-direction: column;
-
- .el-checkbox {
- line-height: 20px;
- }
- }
- }
-
- .myclear {
- width: 100%;
- line-height: 20px;
- color: #4b9bb7;
- display: flex;
- justify-content: space-between;
- }
-
- .hidebar {
- position: absolute;
- top: 77px;
- right: 20px;
- width: 20px;
- height: 180px;
- background-color: #09152f;
- }
-
- .item {
- line-height: 40px;
- }
- }
}
.leader {
--
Gitblit v1.8.0