| | |
| | | :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 { |
| | | extends: BaseOpera, |
| | | components: { |
| | |
| | | data () { |
| | | return { |
| | | isShowModal: false, |
| | | loadingInstance: false, |
| | | param: {}, |
| | | userInfo: this.$store.state.userInfo, |
| | | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch', |
| | |
| | | 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))) { |