我的订单+我的

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

217
mixins/barrage.js Normal file
View File

@@ -0,0 +1,217 @@
import Barrage from '@/components/barrage/barrage.vue';
import BarrageControlBar from '@/components/barrage/ControlBar.nvue';
import BarrageInput from '@/components/barrage/BarrageInput.nvue';
import BarrageSettingLayer from '@/components/barrage/SettingLayer.nvue';
const colors = ['#FFFFFF','#999999', '#E6151E', '#9D22B1', '#3D50B6', '#03A9F4', '#009688', '#259B24', '#8BC34A'];
const barrage = {
data () {
return {
barrageOpen: false, // 是否开启弹幕
barrageList: [] ,// 弹幕数据列表
pickColorMode: false, // 是否展示弹幕颜色设置视图
settingBarrageMode: false, // 是否展示弹幕设置浮层
activeColorIndex: 0, // 当前激活弹幕颜色序号
barrageColors: colors, // 颜色列表
showFixedFooter: false, //是否展示吸底输入框组件、颜色设置组件
barrageInputValue: '', // 输入框value
barrageOpacity: 100 ,// 弹幕不透明度
barrageFontSize: 28, // 弹幕字号
barrageSpeed: 10000, // 弹幕速度
barrageArea: 100 ,// 弹幕显示区域
barrageTimer: null ,// 发送弹幕倒计时
barrageSendDisabled: false, // 禁止发送弹幕
barrageSendDisabledTime: 5, // 禁止发送时间
}
},
computed: {
barrageColor () {
return `0x${colors[this.activeColorIndex].substr(1).toLocaleLowerCase()}`
}
},
components: {
Barrage,
BarrageControlBar,
BarrageInput,
BarrageSettingLayer
},
methods: {
initBarrage () {
try {
this.$refs.CCView.barrageInit();
} catch (e) {
console.log(e);
}
},
setBarrageVideoId (id) {
try {
this.$refs.CCView.setBarrageVideoId(id);
} catch (e) {
console.log(e);
}
},
postBarrageTime (time) {
// time 秒
// console.log('postBarrageTime params', time);
try {
this.$refs.CCView.associationWithTimeDidChange(time);
} catch (e) {
console.log(e);
}
},
sendBarrage (params) {
try {
this.$refs.CCView.sendBarrageWithBarrage(params);
} catch (e) {
console.log(e);
}
},
handleBarrageSend (content) {
let params = {
content,
fc: this.barrageColor, // 颜色
pt: this.currentTime * 1000 // 弹幕时间点 毫秒
}
this.barrageInputValue = content;
console.log(params);
this.handleToggleFixedFooter();
if (this.barrageInputValue == '') {
uni.showToast({
icon: "none",
title: '请输入内容'
})
return;
}
// 发送
this.sendBarrage(params);
},
barrageSendCountDown () {
if (this.barrageSendDisabledTime === 0) {
this.barrageSendDisabled = false;
this.barrageSendDisabledTime = 5;
this.barrageTimer = null;
return;
}
this.barrageSendDisabled = true;
this.barrageTimer = setTimeout(() => {
this.barrageSendDisabledTime--;
this.barrageSendCountDown()
}, 1000)
},
onBarrageError (e) {
console.log('onBarrageError:', e);
},
onBarrageList (e) {
// console.log('onBarrageList:', e);
try {
this.barrageList = e.detail && e.detail.barrageList;
} catch (e) {
console.log(e)
}
},
onSendBarrageSuccess (e) {
console.log('onSendBarrageSuccess:', e);
uni.showToast({
title: '发送成功',
icon: 'none'
})
this.$refs.Barrage.add({
content: this.barrageInputValue,
fc: this.barrageColor,
pt: this.currentTime * 1000,
self: true
});
// 清空输入框内容
this.barrageInputValue = '';
this.$refs.barrageInput.cleanTextAction();
// 开启输入倒计时
this.barrageSendCountDown();
},
onSendBarrageError (e) {
console.log('onSendBarrageError:', e);
uni.showToast({
title: '发送失败',
icon: 'none'
})
},
handleToggleBarrageOpen () {
this.barrageOpen = !this.barrageOpen;
},
handleColorPick (index) {
this.activeColorIndex = index;
},
handleToggleFixedFooter () {
if (this.barrageSendDisabled) return;
// this.showFixedFooter = !this.showFixedFooter
if (this.settingBarrageMode) this.settingBarrageMode = false;
if (!this.showFixedFooter) {
this.showFixedFooter = true;
this.toggleKeyBoard('focus');
} else {
this.toggleKeyBoard('blur', () => {
this.showFixedFooter = false;
});
}
},
toggleKeyBoard (action, callback) {
this.$nextTick(() => {
if (action === 'focus') {
setTimeout(() => {
this.$refs.barrageInput.focusAction();
}, 300)
}
if (action === 'blur') {
this.$refs.barrageInput.blurAction();
}
setTimeout(() => {
if (callback) {
callback();
}
}, 300)
})
},
togglePickColorMode () {
this.pickColorMode = !this.pickColorMode;
this.$nextTick(() => {
if (this.pickColorMode)
this.$refs.barrageInput.blurAction();
else {
this.$refs.barrageInput.focusAction();
}
})
},
handleToggleBarrageSetting () {
this.settingBarrageMode = !this.settingBarrageMode
this.isControlBarShow = !this.settingBarrageMode
if (this.showFixedFooter) this.showFixedFooter = false;
this.toggleKeyBoard();
},
handleFocus () {
this.pickColorMode = false;
},
handleBlur () {
// ...
},
handleSetBarrageOpacity (value) {
this.barrageOpacity = value;
},
handleSetBarrageFontSize (value) {
this.barrageFontSize = value;
},
handleSetBarrageSpeed (value) {
this.barrageSpeed = value;
},
handleSetBarrageArea (value) {
this.barrageArea = value;
},
resetBarrageList () {
this.barrageList = [];
if (this.$refs.barrage) {
this.$refs.barrage.clean();
}
}
}
}
export default barrage;

67
mixins/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;

53
mixins/knowledge.js Normal file
View File

@@ -0,0 +1,53 @@
const knowledge = {
data() {
return {
knowledgeData: {} ,// 知识点数据
isKnowledgeLayerShow: false, // 知识点layer是否展示
showKnowPart: false, // 是否显示知识点片段
knowLeftPercent: 0,
knowPartPercent: 0
}
},
methods: {
getKnowledgeData (params, callback) {
try {
this.$refs.CCView.getKnowledgeData(params, callback)
} catch (e) {
console.log(e)
}
},
onGetKnowledge (e) {
console.log('android get knowledge:', this.videoId, e);
this.knowledgeData = e.detail;
},
hideKnowledgeLayer() {
this.isKnowledgeLayerShow = false;
this.isControlBarShow = true;
},
handleViewPoint(starTime, endTime) {
this.seekTo(starTime);
this.start();
if (endTime) {
this.knowLeftPercent = starTime / this.totalTime;
this.knowPartPercent = (endTime - starTime) / this.totalTime;
this.showKnowPart = true;
} else {
this.showKnowPart = false;
}
// this.hideKnowledgeLayer();
},
handlePartEndPlayStatus(flag) {
this.showKnowPart = false;
if(flag) {
this.pause();
} else {
this.start();
}
},
resetKnowledge() {
this.knowledgeData = {};
this.showKnowPart = false;
}
}
}
export default knowledge

0
mixins/pip.js Normal file
View File

146
mixins/tv.js Normal file
View File

@@ -0,0 +1,146 @@
import { mapState, mapMutations } from 'vuex';
const { platform } = uni.getSystemInfoSync()
const tv = {
data () {
return {
wifiName: '', // 当前wifi名称
currentTvVolume: 0,
setScreenClicked: false
}
},
computed: {
...mapState({
devices: state => state.devices,
isPushing: state => state.isPushing,
playUrl: state => state.playUrl,
searchStatus: state => state.searchStatus,
pushStatus: state => state.pushStatus
})
},
methods: {
...mapMutations(['setIsPushingStatus', 'setSearchStatus', 'setCurrentTvVolume']),
getCurrentWifiName () {
uni.$emit('getCurrentWifiName',(name) => {
console.log('当前wifi名称:', name);
this.wifiName = name;
})
// try {
// Projection.getConnectWifiName((name) => {
// console.log('当前wifi名称:', name);
// this.setCurrentWifiName(name);
// })
// } catch (e) {
// console.log(e);
// }
},
refreshDevices () {
uni.$emit('refreshDevices');
this.searchStatus = true;
},
setScreen (item) {
if (this.setScreenClicked) return;
this.setScreenClicked = true;
try {
if ( platform === 'ios' && this.playUrl.includes('.pcm')) {
uni.showToast({
title: '请使用airplay播放',
icon: 'none'
})
return;
}
let params;
if (platform === 'ios') {
params = {
playUrl: this.playUrl,
device: item
}
} else {
params = Object.assign(item, {
playUrl: this.playUrl
})
}
console.log('set Screen params', params);
uni.$emit('startPush', params);
uni.$once('onProjectionPlay', () => {
// 投屏成功后
uni.showToast({
title: '投屏成功',
icon: 'none'
});
setTimeout(()=> {
uni.navigateBack({
success: () => {
this.setIsPushingStatus(true);
}
});
}, 1500);
})
setTimeout(() => {
this.setScreenClicked = false
}, 3000)
} catch (e) {
console.log(e)
}
},
stopPush () {
this.setIsPushingStatus(false);
uni.$emit('stopPush');
},
pausePush () {
uni.$emit('pausePush',() => {
this.isPlaying = false;
})
},
resumePush () {
this.isPlaying = true;
uni.$emit('resumePush');
},
tvVolumePlus () {
this.currentTvVolume++;
this.setTvVolume(this.currentTvVolume);
},
tvVolumeReduce () {
if (this.currentTvVolume === 0) return;
this.currentTvVolume--;
this.setTvVolume(this.currentTvVolume);
},
setTvVolume (value) {
try {
let volume;
if (platform === 'android') {
volume = {
volume: parseInt(value * 2)
}
} else {
volume = value * 2;
}
console.log('setTvVolume params', volume);
uni.$emit('setVolume', volume);
// this.setCurrentTvVolume(volume);
console.log('currentTvVolum',this.currentTvVolume);
} catch (e) {
console.error(e);
}
},
tvSeek (value) {
try {
let position;
if (platform === 'android') {
position = {
position: parseInt(value * 1000)
}
} else {
position = value
}
console.log('seek params:', position)
uni.$emit('seek', position);
} catch (e) {
console.error(e);
}
},
}
}
export default tv