Browse Source

调试修复1

dev
xuhuajiao 3 years ago
parent
commit
664c3e0e8e
  1. 52
      pages/show/show.vue

52
pages/show/show.vue

@ -121,7 +121,7 @@ export default {
touchStart(event) {
this.startX = event.touches[0].pageX;
this.startY = event.touches[0].pageY;
console.log('开始触摸:', this.startX, this.startY);
// console.log('', this.startX, this.startY);
},
touchMove(event) {
let currentX = event.touches[0].pageX;
@ -152,10 +152,10 @@ export default {
this.like_state = state;
this.moveX = moveX;
this.moveY = moveY;
console.log('开始滑动:', this.moveX, this.moveY, this.like_state);
// console.log('', this.moveX, this.moveY, this.like_state);
},
touchEnd(event) {
console.log(`移动距离:${Math.abs(this.moveX)}`);
// console.log(`:${Math.abs(this.moveX)}`);
// if (Math.abs(this.moveX) > 60 ) {
// if (this.like_state == 1) {
// this.itemIndex++;
@ -198,27 +198,43 @@ export default {
changIndex() {
const _this = this;
innerAudioContext.destroy();
_this.linkUrl = '';
console.log(this.itemLength)
// -
if (_this.itemIndex == this.show_materials.length) {
// clearInterval(_this.timer);
console.log('最后一页啦')
this.itemIndex = 0;
this.flagIndex = 0;
this.contentIndex = 0;
}
// -
if (this.itemIndex == -1) {
this.itemIndex = this.show_materials.length - 1;
this.contentIndex = this.itemLength.length - 1;
this.flagIndex = this.itemLength[this.contentIndex];
}
if (this.flagIndex == 0) {
if (this.flagIndex == -1) {
// if(this.contentIndex == -1){
// this.contentIndex = this.itemLength.length - 1;
// }
// console.log('itemIndex',this.itemIndex)
// console.log('flagIndex',this.flagIndex)
// console.log('contentIndex',this.contentIndex)
// console.log(this.materialsCont[this.contentIndex])
this.contentIndex--;
this.flagIndex = this.itemLength[this.contentIndex];
}
//
_this.duration = this.show_materials[this.itemIndex].duration;
// -/
_this.linkUrl = this.show_materials[this.itemIndex].deposit_url;
//
if (this.show_materials[this.itemIndex].bgm_url) {
_this.audioSrc = this.show_materials[this.itemIndex].bgm_url;
_this.audioName = this.show_materials[this.itemIndex].bgm_name;
} else {
//
if (this.contentIndex == this.itemLength.length) {
this.flagIndex = 0;
this.contentIndex = 0;
@ -227,18 +243,25 @@ export default {
if (this.flagIndex == this.itemLength[this.contentIndex]) {
this.flagIndex = 0;
this.contentIndex++;
if (this.contentIndex == this.itemLength.length || _this.itemIndex == this.show_materials.length) {
this.contentIndex = this.itemLength.length-1;
this.flagIndex = this.itemLength[this.contentIndex];
}
}
}
}
// - BGM - main
if (this.materialsCont[this.contentIndex].bgm_main) {
this.audioSrc = this.materialsCont[this.contentIndex].bgm_main;
this.audioName = this.materialsCont[this.contentIndex].bgm_name;
}
}
// - -
if (this.show_materials[this.itemIndex].material_type == 1) {
innerAudioContext.destroy()
innerAudioContext.src = ''
}
// --
innerAudioContext = uni.createInnerAudioContext();
this.playVoice(this.audioSrc);
},
@ -306,34 +329,33 @@ export default {
innerAudioContext.stop();
}
innerAudioContext = uni.createInnerAudioContext();
// #ifdef APP-PLUS
innerAudioContext.stop();
innerAudioContext.src = src;
innerAudioContext.autoplay = true;
innerAudioContext.loop = true;
innerAudioContext.onPlay(() => {
this.infoTxt = '';
this.infoTxt = '开始播放';
console.log('开始播放');
this.infoTxt = '音频开始播放';
// console.log('');
});
innerAudioContext.onError(res => {
console.log(res.errMsg);
console.log(res.errCode);
if(this.show_materials[this.itemIndex].material_type != 1){
console.log(res.errMsg);
console.log(res.errCode);
innerAudioContext.destroy();
}
// innerAudioContext.stop();
});
innerAudioContext.onPause(function() {
console.log('onPause');
});
innerAudioContext.onStop(() => {
//
this.infoTxt = '停止';
console.log('停止');
this.infoTxt = '音频停止';
// console.log('');
});
innerAudioContext.onEnded(() => {
this.infoTxt = '音频自然播放结束事件';
console.log('音频自然播放结束事件');
// console.log('');
});
// #endif
},
countdown() {
this.count = 6;

Loading…
Cancel
Save