Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hello_taobao
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
hello_taobao
Commits
837abb20
Commit
837abb20
authored
Sep 14, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
f738c1a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
51 deletions
+58
-51
app.json
dist/app.json
+4
-1
pagehuo_dong_ye.js
dist/pages/pagehuo_dong_ye/pagehuo_dong_ye.js
+47
-45
playBgMusic.js
dist/utils/playBgMusic.js
+7
-5
No files found.
dist/app.json
View file @
837abb20
...
...
@@ -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
dist/pages/pagehuo_dong_ye/pagehuo_dong_ye.js
View file @
837abb20
...
...
@@ -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
},
...
...
@@ -69,21 +69,21 @@ Page({
this
.
getOrderList
();
// this.screenAdapt();
},
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
()
||
{};
// 判断会员等级
...
...
@@ -178,7 +178,7 @@ Page({
grade
,
gradeName
},
})
// 判断活动时间
let
currentTime
=
new
Date
().
getTime
();
...
...
@@ -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
(
'无法购买'
)
...
...
@@ -306,7 +306,7 @@ Page({
ruleData
,
userTotalFloor
})
console
.
log
(
'zhixingcount'
);
console
.
log
(
'zhixingcount'
);
this
.
countDowning
(
end
);
}
else
{
// 错误码
...
...
@@ -319,8 +319,8 @@ Page({
countDowning
(
end
)
{
// 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
){
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
)
{
console
.
log
(
'musicSwitch'
,
musicSwitch
,
musicUrl
)
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
);
console
.
log
(
'fuck music'
)
playBgMusic
(
musicSwitch
,
musicUrl
);
//
console.log('fuck music')
}
});
\ No newline at end of file
dist/utils/playBgMusic.js
View file @
837abb20
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment