Browse Source

调试修复1

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

48
pages/show/show.vue

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

Loading…
Cancel
Save