我的订单+我的

This commit is contained in:
2024-06-19 16:12:23 +08:00
parent 5d8aace5cc
commit 132e363be0
473 changed files with 65060 additions and 2742 deletions

67
utils/download.js Normal file
View File

@@ -0,0 +1,67 @@
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;

24
utils/formate.js Normal file
View File

@@ -0,0 +1,24 @@
export function secondFormate (seconds) {
let minute,second;
seconds = Math.abs(seconds)
minute = Math.floor(seconds / 60);
minute = minute > 9 ? minute : '0' + minute;
second = Math.floor(seconds % 60);
second = second > 9 ? second : '0' + second;
return `${minute}:${second}`;
}
export function range(num, min, max) {
return Math.min(Math.max(num, min), max);
}
export function addNumber(num1, num2) {
const cardinal = 10 ** 10;
return Math.round((num1 + num2) * cardinal) / cardinal;
}
export function sizeFormate (size) {
const per = 1024 * 1024;
return size >= per ? Number(size / per).toFixed(2) + 'M' : Number(size / 1024).toFixed(2) + 'KB';
}

20
utils/tool.js Normal file
View File

@@ -0,0 +1,20 @@
const { platform } = uni.getSystemInfoSync()
export function setFullScreen(isFullScreen) {
const ori = isFullScreen ? 'landscape-primary' : 'portrait-primary';
plus.screen.unlockOrientation();
if (platform === 'android') {
setTimeout(() => {
plus.screen.lockOrientation(ori);
}, 500)
} else {
plus.screen.lockOrientation(ori);
}
// 控制顶部状态栏展示
plus.navigator.setFullscreen(isFullScreen);
if (isFullScreen) {
plus.navigator.hideSystemNavigation();
} else {
plus.navigator.showSystemNavigation();
}
}