|  |  |  | 
|---|
|  |  |  | :action="uploadImgUrl" | 
|---|
|  |  |  | :show-file-list="false" | 
|---|
|  |  |  | :on-success="uploadAvatarSuccess" | 
|---|
|  |  |  | :on-error="uploadError" | 
|---|
|  |  |  | :before-upload="beforeUpload" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <div class="upload_wrap"> | 
|---|
|  |  |  | 
|---|
|  |  |  | import dayjs from 'dayjs' | 
|---|
|  |  |  | import { allList, memberList } from '@/api/business/hiddenDangerParam' | 
|---|
|  |  |  | import { create } from '@/api/business/hiddenDanger' | 
|---|
|  |  |  | import { Loading } from 'element-ui' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'OperaVisitsHkWindow', | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | components: { | 
|---|
|  |  |  | GlobalWindow | 
|---|
|  |  |  | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | isShowModal: false, | 
|---|
|  |  |  | loadingInstance: false, | 
|---|
|  |  |  | param: {}, | 
|---|
|  |  |  | userInfo: this.$store.state.userInfo, | 
|---|
|  |  |  | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch', | 
|---|
|  |  |  | 
|---|
|  |  |  | const memberNames = item.memberNames.split(',') | 
|---|
|  |  |  | if (memberIds && memberIds.length === 1) { | 
|---|
|  |  |  | this.$set(this.param, 'checkUserId', memberIds[0]) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$set(this.param, 'checkUserId', '') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | memberIds.forEach((mem, i) => { | 
|---|
|  |  |  | arr.push({ | 
|---|
|  |  |  | 
|---|
|  |  |  | this.memberList = arr | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | beforeUpload (file) { | 
|---|
|  |  |  | if (['video/mp4', 'video/ogg', 'video/flv', 'video/avi', 'video/wmv', 'video/rmvb', 'image/jpeg', 'image/png', 'image/gif'].indexOf(file.type) == -1) { | 
|---|
|  |  |  | if (['video/mp4', 'video/ogg', 'video/flv', 'video/avi', 'video/wmv', 'video/rmvb', 'image/jpeg','image/jpg', 'image/png', 'image/gif'].indexOf(file.type) == -1) { | 
|---|
|  |  |  | this.$message.error('请上传正确的视频/图片格式') | 
|---|
|  |  |  | return false | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.loadingInstance = Loading.service({ | 
|---|
|  |  |  | lock: true, | 
|---|
|  |  |  | text: 'Loading', | 
|---|
|  |  |  | spinner: 'el-icon-loading', | 
|---|
|  |  |  | background: 'rgba(0, 0, 0, 0.7)' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | uploadError() { | 
|---|
|  |  |  | this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭 | 
|---|
|  |  |  | if(this.loadingInstance){ | 
|---|
|  |  |  | this.loadingInstance.close() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | uploadAvatarSuccess (file) { | 
|---|
|  |  |  | this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭 | 
|---|
|  |  |  | if(this.loadingInstance){ | 
|---|
|  |  |  | this.loadingInstance.close() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | console.log('file', file) | 
|---|
|  |  |  | const item = file.data[0] | 
|---|
|  |  |  | if (['.mp4', '.avi', '.flv', '.wmv'].some(char => item.imgaddr.includes(char))) { | 
|---|
|  |  |  | 
|---|
|  |  |  | display: flex; | 
|---|
|  |  |  | flex-wrap: wrap; | 
|---|
|  |  |  | .item { | 
|---|
|  |  |  | width: 140px; | 
|---|
|  |  |  | max-height: 140px; | 
|---|
|  |  |  | width: 92px; | 
|---|
|  |  |  | max-height: 92px; | 
|---|
|  |  |  | margin-left: 10px; | 
|---|
|  |  |  | position: relative; | 
|---|
|  |  |  | border: 1px dashed #d9d9d9; | 
|---|
|  |  |  | border-radius: 4px; | 
|---|
|  |  |  | display: flex; | 
|---|
|  |  |  | align-items: center; | 
|---|
|  |  |  | justify-content: center; | 
|---|
|  |  |  | .close{ | 
|---|
|  |  |  | font-size: 20px; | 
|---|
|  |  |  | position: absolute; | 
|---|
|  |  |  | 
|---|
|  |  |  | cursor: pointer; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .img { | 
|---|
|  |  |  | width: 140px; | 
|---|
|  |  |  | max-height: 90px; | 
|---|
|  |  |  | width: 92px; | 
|---|
|  |  |  | max-height: 92px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|