67 lines
1.2 KiB
JavaScript
67 lines
1.2 KiB
JavaScript
import { mapState, mapMutations } from 'vuex'
|
|
import { sizeFormate } from '@/utils/formate.js'
|
|
const downloadStates = [
|
|
{
|
|
androidCode: 0,
|
|
iosCode: 0,
|
|
text: '未下载'
|
|
},
|
|
{
|
|
androidCode: 100,
|
|
iosCode: 1,
|
|
text: '等待中'
|
|
},
|
|
{
|
|
androidCode: 200,
|
|
iosCode: 2,
|
|
text: '下载中'
|
|
},
|
|
{
|
|
androidCode: 300,
|
|
iosCode: 3,
|
|
text: '已暂停'
|
|
},
|
|
{
|
|
androidCode: 400,
|
|
iosCode: 4,
|
|
text: '已完成'
|
|
},
|
|
{
|
|
androidCode: 500,
|
|
iosCode: 5,
|
|
text: '下载失败'
|
|
},
|
|
]
|
|
|
|
const { platform } = uni.getSystemInfoSync()
|
|
|
|
const download = {
|
|
data () {
|
|
return {
|
|
syncCount: 3, // 同时下载的视频个数
|
|
downLoadListQueue: [] , // 视频队列
|
|
}
|
|
},
|
|
computed: {
|
|
...mapState({
|
|
downLoadListQueueInit: state => state.downLoadListQueueInit,
|
|
// userId: state => state.baseInfo.userId,
|
|
// apiKey: state => state.baseInfo.apiKey,
|
|
verificationCode: state => state.baseInfo.verificationCode,
|
|
downloadList: state => state.downloadList,
|
|
finishedDownloadList: state => state.finishedDownloadList
|
|
}),
|
|
},
|
|
methods: {
|
|
...mapMutations([
|
|
'initDownLoadListQueue',
|
|
'makeDownloadList',
|
|
'addDownloadItem',
|
|
'addFinishedDownloadItem',
|
|
'removeDownloadItem',
|
|
'setPlayLocalVideoInfo'
|
|
])
|
|
}
|
|
}
|
|
|
|
export default download; |