Commit 431d8ca8 authored by wildfirecode13's avatar wildfirecode13

1

parent 837abb20
......@@ -32,8 +32,8 @@
width: 56rpx;
height: 56rpx;
opacity: 1;
left: 224rpx;
top: 242rpx;
left: 524rpx;
top: 262rpx;
position: absolute;
}
......
......@@ -22,8 +22,8 @@
width: 56rpx;
height: 56rpx;
opacity: 1;
left: 224rpx;
top: 242rpx;
left: 524rpx;
top: 262rpx;
position: absolute;
}
......
......@@ -5,6 +5,7 @@ import API from '../../api';
import { SHARE_CONFIG } from '/tbcc-sdk/lib/constants';
import playBgMusic from '/utils/playBgMusic';
const app = getApp();
let musicUrl = null;
Page({
data: {
prizeVisible: false,
......@@ -25,7 +26,7 @@ Page({
list: '',
totalFloor: '',
listlength: '',
musicSwitch:true
musicSwitch: true
},
onLoad(props) {
......@@ -90,13 +91,13 @@ Page({
onShareAppMessage() {
return SHARE_CONFIG;
},
onmusicSwitch(){
let {musicSwitch} = this.data;
onmusicSwitch() {
let { musicSwitch } = this.data;
this.addMusic(musicSwitch);
this.setData({
musicSwitch:!musicSwitch
musicSwitch: !musicSwitch
})
console.log('music点击后',musicSwitch);
console.log('music点击后', musicSwitch);
},
......@@ -346,15 +347,17 @@ Page({
maskVisible: false
})
},
async addMusic(musicSwitch){
const resultSrc = await app.cloud.file.getTempFileURL({
fileId: 'cloud://C7A066C702682E94326284DF8A2975CC//FILA_building_loop.mp3'
});
let musicUrl = null;
if (resultSrc[0]) musicUrl = resultSrc[0].url;
async addMusic(musicSwitch) {
if (!musicUrl) {
const resultSrc = await app.cloud.file.getTempFileURL({
fileId: 'cloud://C7A066C702682E94326284DF8A2975CC//FILA_building_loop.mp3'
});
if (resultSrc[0]) musicUrl = resultSrc[0].url;
}
// let {musicSwitch} = this.data;
// playBgMusic(true,musicUrl)
playBgMusic(musicSwitch,musicUrl);
playBgMusic(musicSwitch, musicUrl);
console.log('fuck music')
}
......
......@@ -77,7 +77,7 @@ export const playBgMusic = (isOn, src) => {//待测试
}
} else {
if (bgs[key]) {
// bgs[key].pause(); /// pause 垃圾,不能用
// bgs[key].pause(); /// pause ,不能用
bgs[key].pause();
// bgs[key].isOn = false; /// TODO 自己记一个开关,因为淘宝的玩意stop之后虽然听不到,但还是在播放,会触发loop播放和onEnded事件
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment