Commit 837abb20 authored by wildfirecode13's avatar wildfirecode13

1

parent f738c1a5
......@@ -6,5 +6,8 @@
"pages/myprize/myprize",
"pages/pagewo_de_jiang_pin_ye_mian1/pagewo_de_jiang_pin_ye_mian1"
],
"window": {}
"window": {
"allowsBounceVertical":"NO"
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import playBgMusic from '/utils/playBgMusic';
const app = getApp();
const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
let musicUrl = null;
Page({
data: {
resList: resList,
......@@ -35,7 +35,7 @@ Page({
end: '',
// 活动结束时间props
endTime:'',
endTime: '',
// 会员消耗积分
vipCredits: '',
......@@ -45,16 +45,16 @@ Page({
totalFloor: '',
// 单人最多购买楼层
eachBuyMostFloor: '',
userTotalFloor:'',
userTotalFloor: '',
countDown: '',
ruleModalVisible: false,
myPrizeBtnVisible: false,
ruleData: '',
screentop:'',
maskVisible:false,
musicSwitch:true
screentop: '',
maskVisible: false,
musicSwitch: true
},
......@@ -73,17 +73,17 @@ Page({
},
onReady(){
onReady() {
this.onmusicSwitch();
},
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);
},
......@@ -103,13 +103,13 @@ Page({
showRuleModal() {
this.setData({
ruleModalVisible: true,
maskVisible:true
maskVisible: true
})
},
ruleModalClose() {
this.setData({
ruleModalVisible: false,
maskVisible:false
maskVisible: false
})
},
......@@ -119,7 +119,7 @@ Page({
// 更新购买记录
// 总楼层数更新
this.setData({
maskVisible:false
maskVisible: false
})
this.getUserCredits();
this.getOrderList();
......@@ -153,21 +153,21 @@ Page({
console.log('click', this.data)
this.setData({
orderModalVisible: true,
maskVisible:true
maskVisible: true
})
},
// 关闭弹窗
orderModalClose() {
this.setData({
orderModalVisible: false,
maskVisible:false
maskVisible: false
})
},
// 购买楼层
async buyFloors() {
// 购买楼层数
let { canBuyFloor, end, userTotalFloor,eachBuyMostFloor } = this.data;
let { canBuyFloor, end, userTotalFloor, eachBuyMostFloor } = this.data;
let { data: { isVip, grade, gradeName, gradeCredits } } = await API.getVipInfo() || {};
// 判断会员等级
......@@ -186,17 +186,17 @@ Page({
let reduced = eachBuyMostFloor - userTotalFloor;
if (currentTime < end) {
if(reduced <= 0){
if (reduced <= 0) {
commonToast('已购买的楼层达到最大值');
}else if(canBuyFloor <= reduced){
} else if (canBuyFloor <= reduced) {
// 可以买
// 显示
this.setData({
orderNowModalVisible: true,
maskVisible:true
maskVisible: true
})
} else{
commonToast('当前最多可购买'+ reduced +'层');
} else {
commonToast('当前最多可购买' + reduced + '层');
}
} else {
commonToast('无法购买')
......@@ -320,7 +320,7 @@ Page({
// console.log('执行时间count')
if(end.length == 0){
if (end.length == 0) {
this.setData({
endingTime: {
d: '00',
......@@ -363,9 +363,9 @@ Page({
// 每1000ms刷新一次
if (time > 0) {
this.setData({
countDown:true
countDown: true
})
timer = setTimeout(this.countDowning.bind(this,end), 1000);
timer = setTimeout(this.countDowning.bind(this, end), 1000);
} else {
clearTimeout(timer);
this.setData({
......@@ -409,17 +409,17 @@ Page({
top: 50 * i + 'rpx',
position: 'absolute',
color: 'white',
width:260+'rpx',
textAlign:'center'
width: 260 + 'rpx',
textAlign: 'center'
},
orderCredits: {
left: 370 + 'rpx',
top: 50 * i + 'rpx',
position: 'absolute',
color: 'white',
width:140+'rpx',
textAlign:'center',
overflow:'hidden'
width: 140 + 'rpx',
textAlign: 'center',
overflow: 'hidden'
}
}
data[i].order = orderStyle;
......@@ -454,14 +454,14 @@ Page({
this.setData({
userCredits: data
})
console.log(data,'更新')
console.log(data, '更新')
},
// 关闭立即购买
orderNowModalClose() {
this.setData({
orderNowModalVisible: false,
maskVisible:false
maskVisible: false
})
},
......@@ -500,15 +500,17 @@ Page({
// console.log(SHARE_CONFIG)
return SHARE_CONFIG;
},
async addMusic(musicSwitch){
async addMusic(musicSwitch) {
console.log('musicSwitch', musicSwitch,musicUrl)
if (!musicUrl) {
const resultSrc = await app.cloud.file.getTempFileURL({
fileId: 'cloud://C7A066C702682E94326284DF8A2975CC//FILA_building_loop.mp3'
});
let musicUrl = null;
if (resultSrc[0]) musicUrl = resultSrc[0].url;
}
// let {musicSwitch} = this.data;
// playBgMusic(true,musicUrl)
playBgMusic(musicSwitch,musicUrl);
console.log('fuck music')
playBgMusic(musicSwitch, musicUrl);
// console.log('fuck music')
}
});
\ No newline at end of file
......@@ -27,11 +27,11 @@ const createAudio = opts => {
};
let bgs = {
}
const playBgMusic = (isOn, src) => {//待测试
export const playBgMusic = (isOn, src) => {//待测试
for (let k in bgs) {
if (bgs[k].isOn) {
bgs[k].stop();
bgs[k].pause();
}
// bgs[k].isOn = false; /// TODO 自己记一个开关,因为淘宝的玩意stop之后虽然听不到,但还是在播放,会触发loop播放和onEnded事件
}
......@@ -53,14 +53,15 @@ const playBgMusic = (isOn, src) => {//待测试
bgs[key].onStop(() => {
bgs[key].isOn = false;
});
bgs[key].onPause(() => {
bgs[key].isOn = false;
});
/// TODO监听结束,因为loop无效 2020.08.12 loop有效,这个操作是为了解决stop之后还会跑音频数据的问题
bgs[key].onEnded(() => {
if (bgs[key].isOn) { // 判断自己记录的开关
bgs[key].play();
console.log('bgs[key].onEnded')
// bgs[key].isOn = true;
}
});
......@@ -77,9 +78,10 @@ const playBgMusic = (isOn, src) => {//待测试
} else {
if (bgs[key]) {
// bgs[key].pause(); /// pause 垃圾,不能用
bgs[key].stop();
bgs[key].pause();
// bgs[key].isOn = false; /// TODO 自己记一个开关,因为淘宝的玩意stop之后虽然听不到,但还是在播放,会触发loop播放和onEnded事件
}
}
}
export default playBgMusic
\ No newline at end of file
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