Commit 431d8ca8 authored by wildfirecode13's avatar wildfirecode13

1

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