|
@@ -224,7 +224,6 @@ import config from "@/config";
|
|
|
import { debounce } from "@/utils/other.js"
|
|
|
import FileInput from "@/components/shared/uploads/UploadMultiple.vue";
|
|
|
import { mapState } from "vuex";
|
|
|
-// import AudioIconCanPlay from "@/components/audio/indexForEditor.vue";
|
|
|
import RadioOrCheckbox from "@/components/shared/RadioOrCheckbox.vue";
|
|
|
import { i18n } from "@/lang"
|
|
|
|
|
@@ -241,10 +240,7 @@ export default {
|
|
|
type: Array,
|
|
|
default: function () {
|
|
|
return [
|
|
|
- 'image',
|
|
|
'pano',
|
|
|
- 'audio',
|
|
|
- 'video',
|
|
|
'3D',
|
|
|
]
|
|
|
},
|
|
@@ -264,7 +260,6 @@ export default {
|
|
|
},
|
|
|
components: {
|
|
|
FileInput,
|
|
|
- // AudioIconCanPlay,
|
|
|
RadioOrCheckbox,
|
|
|
},
|
|
|
watch: {
|
|
@@ -276,14 +271,8 @@ export default {
|
|
|
},
|
|
|
currentMaterialType: {
|
|
|
handler: function (newVal) {
|
|
|
- if (newVal === 'image' && this.imageList.length === 0) {
|
|
|
- this.refreshMaterialList('image')
|
|
|
- } else if (newVal === 'pano' && this.panoList.length === 0) {
|
|
|
+ if (newVal === 'pano' && this.panoList.length === 0) {
|
|
|
this.refreshMaterialList('pano')
|
|
|
- } else if (newVal === 'audio' && this.audioList.length === 0) {
|
|
|
- this.refreshMaterialList('audio')
|
|
|
- } else if (newVal === 'video' && this.videoList.length === 0) {
|
|
|
- this.refreshMaterialList('video')
|
|
|
} else if (newVal === '3D' && this.scene3DList.length === 0) {
|
|
|
this.refreshMaterialList('3D')
|
|
|
}
|
|
@@ -313,26 +302,11 @@ export default {
|
|
|
uploadStatusListPano: 'uploadStatusListPano',
|
|
|
uploadStatusListVideo: 'uploadStatusListVideo',
|
|
|
}),
|
|
|
- tableHeadersForImage() {
|
|
|
- return this.$MAPTABLEHEADER['image'].filter(item => {
|
|
|
- return ['icon', 'name', 'fileSize', 'dpi'].includes(item.key)
|
|
|
- })
|
|
|
- },
|
|
|
tableHeadersForPano() {
|
|
|
return this.$MAPTABLEHEADER['pano'].filter(item => {
|
|
|
return ['icon', 'name', 'fileSize'].includes(item.key)
|
|
|
})
|
|
|
},
|
|
|
- tableHeadersForAudio() {
|
|
|
- return this.$MAPTABLEHEADER['audio'].filter(item => {
|
|
|
- return ['ossPath', 'name', 'fileSize'].includes(item.key)
|
|
|
- })
|
|
|
- },
|
|
|
- tableHeadersForVideo() {
|
|
|
- return this.$MAPTABLEHEADER['video'].filter(item => {
|
|
|
- return ['icon', 'name', 'fileSize'].includes(item.key)
|
|
|
- })
|
|
|
- },
|
|
|
tableHeadersFor3D() {
|
|
|
return this.$MAPTABLEHEADER['scene'].filter(item => {
|
|
|
return ['thumb', 'sceneName', 'createTime'].includes(item.key)
|
|
@@ -344,15 +318,6 @@ export default {
|
|
|
case 'pano':
|
|
|
ret = this.$i18n.t(`gather.pano_fail`)
|
|
|
break;
|
|
|
- case 'image':
|
|
|
- ret = this.$i18n.t(`gather.img_fail`)
|
|
|
- break;
|
|
|
- case 'audio':
|
|
|
- ret = this.$i18n.t(`gather.audio_fail`)
|
|
|
- break;
|
|
|
- case 'video':
|
|
|
- ret = this.$i18n.t(`gather.video_fail`)
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -364,15 +329,6 @@ export default {
|
|
|
case 'pano':
|
|
|
ret = this.$i18n.t(`gather.pano_limit`)
|
|
|
break;
|
|
|
- case 'image':
|
|
|
- ret = this.$i18n.t(`gather.img_limit`)
|
|
|
- break;
|
|
|
- case 'audio':
|
|
|
- ret = this.$i18n.t(`gather.audio_limit`)
|
|
|
- break;
|
|
|
- case 'video':
|
|
|
- ret = this.$i18n.t(`gather.video_limit`)
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -384,15 +340,6 @@ export default {
|
|
|
case 'pano':
|
|
|
ret = 'image/jpeg'
|
|
|
break;
|
|
|
- case 'image':
|
|
|
- ret = 'image/png,image/jpeg'
|
|
|
- break;
|
|
|
- case 'audio':
|
|
|
- ret = 'audio/mp3'
|
|
|
- break;
|
|
|
- case 'video':
|
|
|
- ret = 'video/mp4'
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -404,15 +351,6 @@ export default {
|
|
|
case 'pano':
|
|
|
ret = 'image'
|
|
|
break;
|
|
|
- case 'image':
|
|
|
- ret = 'image'
|
|
|
- break;
|
|
|
- case 'audio':
|
|
|
- ret = 'audio'
|
|
|
- break;
|
|
|
- case 'video':
|
|
|
- ret = 'video'
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -424,28 +362,11 @@ export default {
|
|
|
case 'pano':
|
|
|
ret = 120
|
|
|
break;
|
|
|
- case 'image':
|
|
|
- ret = 10
|
|
|
- break;
|
|
|
- case 'audio':
|
|
|
- ret = 20
|
|
|
- break;
|
|
|
- case 'video':
|
|
|
- ret = 200
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
return ret
|
|
|
},
|
|
|
- imageListRealLength() {
|
|
|
- return this.imageList.length + this.uploadStatusListImage.filter((item) => {
|
|
|
- return item.status === 'SUCCESS'
|
|
|
- }).length
|
|
|
- },
|
|
|
- imageListLocalLength() {
|
|
|
- return this.imageList.length + this.uploadStatusListImage.length
|
|
|
- },
|
|
|
panoListRealLength() {
|
|
|
return this.panoList.length + this.uploadStatusListPano.filter((item) => {
|
|
|
return item.status === 'SUCCESS'
|
|
@@ -454,22 +375,6 @@ export default {
|
|
|
panoListLocalLength() {
|
|
|
return this.panoList.length + this.uploadStatusListPano.length
|
|
|
},
|
|
|
- audioListRealLength() {
|
|
|
- return this.audioList.length + this.uploadStatusListAudio.filter((item) => {
|
|
|
- return item.status === 'SUCCESS'
|
|
|
- }).length
|
|
|
- },
|
|
|
- audioListLocalLength() {
|
|
|
- return this.audioList.length + this.uploadStatusListAudio.length
|
|
|
- },
|
|
|
- videoListRealLength() {
|
|
|
- return this.videoList.length + this.uploadStatusListVideo.filter((item) => {
|
|
|
- return item.status === 'SUCCESS'
|
|
|
- }).length
|
|
|
- },
|
|
|
- videoListLocalLength() {
|
|
|
- return this.videoList.length + this.uploadStatusListVideo.length
|
|
|
- },
|
|
|
needLongPolling() {
|
|
|
return this.uploadStatusListPano.some((item) => {
|
|
|
return item.status === 'LOADING' && item.ifKnowProgress === false
|
|
@@ -481,24 +386,15 @@ export default {
|
|
|
no_serch_result: i18n.t("gather.no_serch_result"),
|
|
|
no_material_result: i18n.t("gather.no_material_result"),
|
|
|
panorama: i18n.t("gather.panorama"),
|
|
|
- image: i18n.t("gather.image"),
|
|
|
- audio: i18n.t("gather.audio"),
|
|
|
- video: i18n.t("gather.video"),
|
|
|
scene: i18n.t("gather.scene"),
|
|
|
keywords: i18n.t("gather.keywords"),
|
|
|
how_to_shoot: i18n.t("gather.how_to_shoot"),
|
|
|
upload_material: i18n.t("gather.upload_material"),
|
|
|
- img_size: i18n.t("gather.img_size"),
|
|
|
pano_size: i18n.t("gather.pano_size"),
|
|
|
- audio_size: i18n.t("gather.audio_size"),
|
|
|
- video_size: i18n.t("gather.video_size"),
|
|
|
cancel: i18n.t("gather.cancel"),
|
|
|
comfirm: i18n.t("gather.comfirm"),
|
|
|
|
|
|
- imageList: [],
|
|
|
panoList: [],
|
|
|
- audioList: [],
|
|
|
- videoList: [],
|
|
|
scene3DList: [],
|
|
|
|
|
|
select: [],
|
|
@@ -507,15 +403,9 @@ export default {
|
|
|
|
|
|
currentMaterialType: this.initialMaterialType,
|
|
|
|
|
|
- isRequestingMoreImageData: false,
|
|
|
isRequestingMorePanoData: false,
|
|
|
- isRequestingMoreAudioData: false,
|
|
|
- isRequestingMoreVideoData: false,
|
|
|
isRequestingMore3DData: false,
|
|
|
- hasMoreImageData: true,
|
|
|
hasMorePanoData: true,
|
|
|
- hasMoreAudioData: true,
|
|
|
- hasMoreVideoData: true,
|
|
|
hasMore3DData: true,
|
|
|
|
|
|
longPollingIntervalId: null,
|
|
@@ -527,9 +417,6 @@ export default {
|
|
|
]),
|
|
|
selectItem(item, v) {
|
|
|
item.materialType = this.currentMaterialType // 三维场景数据没有type字段来表明自己是三维场景。所以统一加一个字段。
|
|
|
- if (false) {
|
|
|
- // 对于图片,大于600kb的,压缩?
|
|
|
- } else {
|
|
|
if (this.isMultiSelection) {
|
|
|
if (v) {
|
|
|
this.select.push(item)
|
|
@@ -548,37 +435,6 @@ export default {
|
|
|
this.select = []
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- requestMoreImageData() {
|
|
|
- this.isRequestingMoreImageData = true
|
|
|
- const latestUsedSearchKey = this.searchKey
|
|
|
- getMaterialList(
|
|
|
- {
|
|
|
- pageNum: Math.floor(this.imageListRealLength / config.PAGE_SIZE) + 1,
|
|
|
- pageSize: config.PAGE_SIZE,
|
|
|
- searchKey: this.searchKey,
|
|
|
- type: 'image',
|
|
|
- },
|
|
|
- (data) => {
|
|
|
- const newData = data.data.list.map((i) => {
|
|
|
- i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
- i.createTime = i.createTime.substring(0, i.createTime.length - 3)
|
|
|
- i.updateTime = i.updateTime.substring(0, i.updateTime.length - 3)
|
|
|
- return i;
|
|
|
- });
|
|
|
- this.imageList = this.imageList.concat(newData)
|
|
|
- if (this.imageListRealLength === data.data.total) {
|
|
|
- this.hasMoreImageData = false
|
|
|
- }
|
|
|
- this.isRequestingMoreImageData = false
|
|
|
- this.latestUsedSearchKey = latestUsedSearchKey
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.isRequestingMoreImageData = false
|
|
|
- this.latestUsedSearchKey = latestUsedSearchKey
|
|
|
- }
|
|
|
- );
|
|
|
},
|
|
|
requestMorePanoData() {
|
|
|
this.isRequestingMorePanoData = true
|
|
@@ -610,67 +466,6 @@ export default {
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
- requestMoreAudioData() {
|
|
|
- this.isRequestingMoreAudioData = true
|
|
|
- const latestUsedSearchKey = this.searchKey
|
|
|
- getMaterialList(
|
|
|
- {
|
|
|
- pageNum: Math.floor(this.audioListRealLength / config.PAGE_SIZE) + 1,
|
|
|
- pageSize: config.PAGE_SIZE,
|
|
|
- searchKey: this.searchKey,
|
|
|
- type: 'audio',
|
|
|
- },
|
|
|
- (data) => {
|
|
|
- const newData = data.data.list.map((i) => {
|
|
|
- i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
- i.createTime = i.createTime.substring(0, i.createTime.length - 3)
|
|
|
- i.updateTime = i.updateTime.substring(0, i.updateTime.length - 3)
|
|
|
- return i;
|
|
|
- });
|
|
|
- this.audioList = this.audioList.concat(newData)
|
|
|
- if (this.audioListRealLength === data.data.total) {
|
|
|
- this.hasMoreAudioData = false
|
|
|
- }
|
|
|
- this.isRequestingMoreAudioData = false
|
|
|
- this.latestUsedSearchKey = latestUsedSearchKey
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.isRequestingMoreAudioData = false
|
|
|
- this.latestUsedSearchKey = latestUsedSearchKey
|
|
|
- }
|
|
|
- );
|
|
|
- },
|
|
|
- requestMoreVideoData() {
|
|
|
- this.isRequestingMoreVideoData = true
|
|
|
- const latestUsedSearchKey = this.searchKey
|
|
|
- getMaterialList(
|
|
|
- {
|
|
|
- pageNum: Math.floor(this.videoListReallength / config.PAGE_SIZE) + 1,
|
|
|
- pageSize: config.PAGE_SIZE,
|
|
|
- searchKey: this.searchKey,
|
|
|
- type: 'video',
|
|
|
- },
|
|
|
- (data) => {
|
|
|
- const newData = data.data.list.map((i) => {
|
|
|
- i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
- i.icon = process.env.VUE_APP_ORIGIN=='aws'?i.icon:(i.ossPath + '?x-oss-process=video/snapshot,t_0,f_jpg,w_89,h_50,m_fast,ar_auto');
|
|
|
- i.createTime = i.createTime.substring(0, i.createTime.length - 3)
|
|
|
- i.updateTime = i.updateTime.substring(0, i.updateTime.length - 3)
|
|
|
- return i;
|
|
|
- });
|
|
|
- this.videoList = this.videoList.concat(newData)
|
|
|
- if (this.videoListReallength === data.data.total) {
|
|
|
- this.hasMoreVideoData = false
|
|
|
- }
|
|
|
- this.isRequestingMoreVideoData = false
|
|
|
- this.latestUsedSearchKey = latestUsedSearchKey
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.isRequestingMoreVideoData = false
|
|
|
- this.latestUsedSearchKey = latestUsedSearchKey
|
|
|
- }
|
|
|
- );
|
|
|
- },
|
|
|
requestMore3DData() {
|
|
|
this.isRequestingMore3DData = true
|
|
|
const latestUsedSearchKey = this.searchKey
|
|
@@ -699,16 +494,7 @@ export default {
|
|
|
)
|
|
|
},
|
|
|
refreshMaterialList: debounce(function (type) {
|
|
|
- if (type === 'image') {
|
|
|
- this.isRequestingMoreImageData = false
|
|
|
- this.hasMoreImageData = true
|
|
|
- this.imageList = []
|
|
|
- let filterResult = this.uploadStatusListImage.filter((item) => {
|
|
|
- return item.status === 'LOADING'
|
|
|
- })
|
|
|
- this.$store.commit('setUploadStatusListImage', filterResult)
|
|
|
- this.requestMoreImageData()
|
|
|
- } else if (type === 'pano') {
|
|
|
+ if (type === 'pano') {
|
|
|
this.isRequestingMorePanoData = false
|
|
|
this.hasMorePanoData = true
|
|
|
this.panoList = []
|
|
@@ -717,24 +503,6 @@ export default {
|
|
|
})
|
|
|
this.$store.commit('setUploadStatusListPano', filterResult)
|
|
|
this.requestMorePanoData()
|
|
|
- } else if (type === 'audio') {
|
|
|
- this.isRequestingMoreAudioData = false
|
|
|
- this.hasMoreAudioData = true
|
|
|
- this.audioList = []
|
|
|
- let filterResult = this.uploadStatusListAudio.filter((item) => {
|
|
|
- return item.status === 'LOADING'
|
|
|
- })
|
|
|
- this.$store.commit('setUploadStatusListAudio', filterResult)
|
|
|
- this.requestMoreAudioData()
|
|
|
- } else if (type === 'video') {
|
|
|
- this.isRequestingMoreVideoData = false
|
|
|
- this.hasMoreVideoData = true
|
|
|
- this.videoList = []
|
|
|
- let filterResult = this.uploadStatusListVideo.filter((item) => {
|
|
|
- return item.status === 'LOADING'
|
|
|
- })
|
|
|
- this.$store.commit('setUploadStatusListVideo', filterResult)
|
|
|
- this.requestMoreVideoData()
|
|
|
} else if (type === '3D') {
|
|
|
this.isRequestingMore3DData = false
|
|
|
this.hasMore3DData = true
|
|
@@ -747,15 +515,6 @@ export default {
|
|
|
case 'pano':
|
|
|
this.onPanoFileInputChange(e)
|
|
|
break;
|
|
|
- case 'image':
|
|
|
- this.onImageFileInputChange(e)
|
|
|
- break;
|
|
|
- case 'audio':
|
|
|
- this.onAudioFileInputChange(e)
|
|
|
- break;
|
|
|
- case 'video':
|
|
|
- this.onVideoFileInputChange(e)
|
|
|
- break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -855,231 +614,6 @@ export default {
|
|
|
this.uploadStatusListPano.unshift(itemInUploadList);
|
|
|
})
|
|
|
},
|
|
|
- onImageFileInputChange(e) {
|
|
|
- console.log('tableHeadersForImage: ', this.tableHeadersForImage);
|
|
|
-
|
|
|
- e.files.forEach((eachFile, i) => {
|
|
|
- if (
|
|
|
- eachFile.type.indexOf("jpeg") <= -1 &&
|
|
|
- eachFile.type.indexOf("png") <= -1
|
|
|
- ) {
|
|
|
- setTimeout(() => {
|
|
|
- this.$msg({
|
|
|
- message: `“${eachFile.name}”${this.$i18n.t(`gather.img_fail`)}`,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- }, i * 100);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (eachFile.name.substring(0, eachFile.name.lastIndexOf(".")).length > 50) {
|
|
|
- setTimeout(() => {
|
|
|
- this.$msg({
|
|
|
- message: `“${eachFile.name}”${this.$i18n.t(`gather.too_long_word`)}`,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- }, i * 100);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- let itemInUploadList = {
|
|
|
- title: eachFile.name,
|
|
|
- ifKnowProgress: true,
|
|
|
- progress: 0,
|
|
|
- status: 'LOADING',
|
|
|
- statusText: this.$i18n.t(`gather.uploading_material`),
|
|
|
- uid: `u_${this.$randomWord(true, 8, 8)}`,
|
|
|
- abortHandler: null,
|
|
|
- successInfo: null,
|
|
|
- };
|
|
|
-
|
|
|
- itemInUploadList.abortHandler = uploadMaterial(
|
|
|
- {
|
|
|
- file: eachFile
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'image',
|
|
|
- uid: itemInUploadList.uid,
|
|
|
- },
|
|
|
- (result) => { // 上传成功
|
|
|
- const index = this.uploadStatusListImage.findIndex((eachItem) => {
|
|
|
- return eachItem.uid === itemInUploadList.uid
|
|
|
- })
|
|
|
- result.data.fileSize = changeByteUnit(Number(result.data.fileSize));
|
|
|
- result.data.createTime = result.data.createTime.substring(0, result.data.createTime.length - 3)
|
|
|
- result.data.updateTime = result.data.updateTime.substring(0, result.data.updateTime.length - 3)
|
|
|
- this.uploadStatusListImage[index].status = 'SUCCESS'
|
|
|
- this.uploadStatusListImage[index].successInfo = result.data
|
|
|
- return i;
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- if (err.statusText === 'abort') { // 用户取消了上传任务。
|
|
|
- console.log('用户取消了任务!');
|
|
|
- const index = this.uploadStatusListImage.findIndex((eachItem) => {
|
|
|
- return eachItem.uid === itemInUploadList.uid
|
|
|
- })
|
|
|
- this.uploadStatusListImage.splice(index, 1)
|
|
|
- } else {
|
|
|
- console.log('失败!');
|
|
|
- itemInUploadList.status = 'FAIL'
|
|
|
- itemInUploadList.statusText = this.$i18n.t(`gather.material_upload_fail`)
|
|
|
- }
|
|
|
- },
|
|
|
- (progress) => {
|
|
|
- console.log('进度:', progress);
|
|
|
- itemInUploadList.progress = progress
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- this.uploadStatusListImage.unshift(itemInUploadList);
|
|
|
- });
|
|
|
- },
|
|
|
- onAudioFileInputChange(e) {
|
|
|
- e.files.forEach((eachFile, i) => {
|
|
|
- if (eachFile.name.toLowerCase().indexOf("mp3") <= -1) {
|
|
|
- setTimeout(() => {
|
|
|
- this.$msg({
|
|
|
- message: `“${eachFile.name}”${this.$i18n.t(`gather.audio_fail`)}`,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- }, i * 100);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (eachFile.name.substring(0, eachFile.name.lastIndexOf(".")).length > 50) {
|
|
|
- setTimeout(() => {
|
|
|
- this.$msg({
|
|
|
- message: `“${eachFile.name}”${this.$i18n.t(`gather.too_long_word_audio`)}`,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- }, i * 100);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- let itemInUploadList = {
|
|
|
- title: eachFile.name,
|
|
|
- ifKnowProgress: true,
|
|
|
- progress: 0,
|
|
|
- status: 'LOADING',
|
|
|
- statusText: this.$i18n.t(`gather.uploading_material`),
|
|
|
- uid: `u_${this.$randomWord(true, 8, 8)}`,
|
|
|
- abortHandler: null,
|
|
|
- };
|
|
|
-
|
|
|
- itemInUploadList.abortHandler = uploadMaterial(
|
|
|
- {
|
|
|
- file: eachFile
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'audio',
|
|
|
- uid: itemInUploadList.uid,
|
|
|
- },
|
|
|
- (result) => { // 上传成功
|
|
|
- console.log('success');
|
|
|
- const index = this.uploadStatusListAudio.findIndex((eachItem) => {
|
|
|
- return eachItem.uid === itemInUploadList.uid
|
|
|
- })
|
|
|
- result.data.fileSize = changeByteUnit(Number(result.data.fileSize));
|
|
|
- result.data.createTime = result.data.createTime.substring(0, result.data.createTime.length - 3)
|
|
|
- result.data.updateTime = result.data.updateTime.substring(0, result.data.updateTime.length - 3)
|
|
|
- this.uploadStatusListAudio[index].status = 'SUCCESS'
|
|
|
- this.uploadStatusListAudio[index].successInfo = result.data
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- console.log('error');
|
|
|
- if (err.statusText === 'abort') { // 用户取消了上传任务。
|
|
|
- console.log('用户取消了');
|
|
|
- const index = this.uploadStatusListAudio.findIndex((eachItem) => {
|
|
|
- return eachItem.uid === itemInUploadList.uid
|
|
|
- })
|
|
|
- this.uploadStatusListAudio.splice(index, 1)
|
|
|
- } else {
|
|
|
- console.log('上传失败');
|
|
|
- itemInUploadList.status = 'FAIL'
|
|
|
- itemInUploadList.statusText = this.$i18n.t(`gather.material_upload_fail`)
|
|
|
- }
|
|
|
- },
|
|
|
- (progress) => {
|
|
|
- console.log('progress');
|
|
|
- itemInUploadList.progress = progress
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- this.uploadStatusListAudio.unshift(itemInUploadList);
|
|
|
- });
|
|
|
- },
|
|
|
- onVideoFileInputChange(e) {
|
|
|
- e.files.forEach((eachFile, i) => {
|
|
|
- if (eachFile.name.toLowerCase().indexOf("mp4") <= -1) {
|
|
|
- setTimeout(() => {
|
|
|
- this.$msg({
|
|
|
- message: `“${eachFile.name}”${this.$i18n.t(`gather.video_fail`)}`,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- }, i * 100);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (eachFile.name.substring(0, eachFile.name.lastIndexOf(".")).length > 50) {
|
|
|
- setTimeout(() => {
|
|
|
- this.$msg({
|
|
|
- message: `“${eachFile.name}”${this.$i18n.t(`gather.too_long_word_video`)}`,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- }, i * 100);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- let itemInUploadList = {
|
|
|
- title: eachFile.name,
|
|
|
- ifKnowProgress: true,
|
|
|
- progress: 0,
|
|
|
- status: 'LOADING',
|
|
|
- statusText: this.$i18n.t(`gather.uploading_material`),
|
|
|
- uid: `u_${this.$randomWord(true, 8, 8)}`,
|
|
|
- abortHandler: null,
|
|
|
- };
|
|
|
-
|
|
|
- itemInUploadList.abortHandler = uploadMaterial(
|
|
|
- {
|
|
|
- file: eachFile
|
|
|
- },
|
|
|
- {
|
|
|
- type: 'video',
|
|
|
- uid: itemInUploadList.uid,
|
|
|
- },
|
|
|
- (result) => { // 上传成功
|
|
|
- console.log('成功!');
|
|
|
- const index = this.uploadStatusListVideo.findIndex((eachItem) => {
|
|
|
- return eachItem.uid === itemInUploadList.uid
|
|
|
- })
|
|
|
- result.data.fileSize = changeByteUnit(Number(result.data.fileSize));
|
|
|
- result.data.createTime = result.data.createTime.substring(0, result.data.createTime.length - 3)
|
|
|
- result.data.updateTime = result.data.updateTime.substring(0, result.data.updateTime.length - 3)
|
|
|
- result.data.icon = process.env.VUE_APP_ORIGIN=='aws'?result.data.icon:(result.data.ossPath + '?x-oss-process=video/snapshot,t_0,f_jpg,w_89,h_50,m_fast,ar_auto');
|
|
|
- this.uploadStatusListVideo[index].status = 'SUCCESS'
|
|
|
- this.uploadStatusListVideo[index].successInfo = result.data
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- if (err.statusText === 'abort') { // 用户取消了上传任务。
|
|
|
- const index = this.uploadStatusListVideo.findIndex((eachItem) => {
|
|
|
- return eachItem.uid === itemInUploadList.uid
|
|
|
- })
|
|
|
- this.uploadStatusListVideo.splice(index, 1)
|
|
|
- } else {
|
|
|
- itemInUploadList.status = 'FAIL'
|
|
|
- itemInUploadList.statusText = this.$i18n.t(`gather.material_upload_fail`)
|
|
|
- }
|
|
|
- },
|
|
|
- (progress) => {
|
|
|
- console.log('进度:', progress);
|
|
|
- itemInUploadList.progress = progress
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- this.uploadStatusListVideo.unshift(itemInUploadList);
|
|
|
- });
|
|
|
- },
|
|
|
_checkMStatus() {
|
|
|
let needPollingTaskList = this.uploadStatusListPano.filter((item) => item.status === 'LOADING' && item.ifKnowProgress === false);
|
|
|
if (needPollingTaskList.length > 0) {
|
|
@@ -1134,23 +668,12 @@ export default {
|
|
|
}, 250),
|
|
|
},
|
|
|
mounted() {
|
|
|
- console.log('tableHeadersForAudio: ', this.tableHeadersForAudio);
|
|
|
- console.log('tableHeadersForVideo: ', this.tableHeadersForVideo);
|
|
|
this.clearUploadStatusLists()
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- this.$store.commit('setUploadStatusListImage', this.uploadStatusListImage.filter((item) => {
|
|
|
- return item.status === 'LOADING'
|
|
|
- }))
|
|
|
this.$store.commit('setUploadStatusListPano', this.uploadStatusListPano.filter((item) => {
|
|
|
return item.status === 'LOADING'
|
|
|
}))
|
|
|
- this.$store.commit('setUploadStatusListAudio', this.uploadStatusListAudio.filter((item) => {
|
|
|
- return item.status === 'LOADING'
|
|
|
- }))
|
|
|
- this.$store.commit('setUploadStatusListVideo', this.uploadStatusListVideo.filter((item) => {
|
|
|
- return item.status === 'LOADING'
|
|
|
- }))
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -1362,31 +885,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.table-image .table-head,
|
|
|
-.table-image .table-data {
|
|
|
- &:nth-of-type(1) {
|
|
|
- width: 50px;
|
|
|
- color: transparent;
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(2) {
|
|
|
- width: calc(146px - 50px);
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(3) {
|
|
|
- width: calc(316px - 146px);
|
|
|
- padding-right: 30px;
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(4) {
|
|
|
- width: calc(380px - 316px);
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(5) {
|
|
|
- width: calc(100% - 380px);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
.table-pano .table-head,
|
|
|
.table-pano .table-data {
|
|
|
&:nth-of-type(1) {
|
|
@@ -1408,48 +906,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.table-audio .table-head,
|
|
|
-.table-audio .table-data {
|
|
|
- &:nth-of-type(1) {
|
|
|
- width: 50px;
|
|
|
- color: transparent;
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(2) {
|
|
|
- width: calc(146px - 50px);
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(3) {
|
|
|
- width: calc(380px - 146px);
|
|
|
- padding-right: 30px;
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(4) {
|
|
|
- width: calc(100% - 380px);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.table-video .table-head,
|
|
|
-.table-video .table-data {
|
|
|
- &:nth-of-type(1) {
|
|
|
- width: 50px;
|
|
|
- color: transparent;
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(2) {
|
|
|
- width: calc(146px - 50px);
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(3) {
|
|
|
- width: calc(380px - 146px);
|
|
|
- padding-right: 30px;
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-of-type(4) {
|
|
|
- width: calc(100% - 380px);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
.table-3D .table-head,
|
|
|
.table-3D .table-data {
|
|
|
&:nth-of-type(1) {
|