Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new_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
new_taobao
Commits
3cf797be
Commit
3cf797be
authored
Oct 02, 2020
by
AU-Pro-mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new code --08
parent
dac3ef34
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
197 additions
and
108 deletions
+197
-108
Main.ts
project/src/canvas/game/src/Main.ts
+2
-2
Root.ts
project/src/canvas/game/src/chuansongdai/Root.ts
+6
-3
ScoreBoard.ts
project/src/canvas/game/src/chuansongdai/game/ScoreBoard.ts
+39
-20
myprize.js
taobao_mini/client/pages/myprize/myprize.js
+3
-0
pagecanvas.js
taobao_mini/client/pages/pagecanvas/pagecanvas.js
+1
-1
turnTablePage.acss
taobao_mini/client/pages/turnTablePage/turnTablePage.acss
+3
-3
turnTablePage.axml
taobao_mini/client/pages/turnTablePage/turnTablePage.axml
+11
-10
turnTablePage.js
taobao_mini/client/pages/turnTablePage/turnTablePage.js
+120
-69
resList.js
taobao_mini/client/resconfig/resList.js
+12
-0
No files found.
project/src/canvas/game/src/Main.ts
View file @
3cf797be
...
...
@@ -157,9 +157,9 @@ export class Main {
await
this
.
loadImageTexturesCsd01
(
resCanvasList
)
await
this
.
loadImageTexturesCsd02
(
resCanvasList
)
//
changeScene(OpenAni)
changeScene
(
OpenAni
)
// changeScene(CsdScene)
changeScene
(
XxlScene
)
//
changeScene(XxlScene)
})
await
InitLottie
.
initLottieList
(
resLottieList
);
...
...
project/src/canvas/game/src/chuansongdai/Root.ts
View file @
3cf797be
...
...
@@ -118,12 +118,14 @@ export default class Root extends FYGE.Container {
GDispatcher
.
removeEventListener
(
'MatchCompelete'
,
this
.
gameStart
,
this
)
this
.
gameStartFlag
=
true
this
.
touchArea
.
mouseEnable
=
true
}
// 结束游戏
async
gameOver
()
{
this
.
time
=
60
this
.
gameStartFlag
=
false
this
.
touchArea
.
mouseEnable
=
false
if
(
!
this
.
userInfo
.
win
)
this
.
scoreBoard
.
scoreRight
+=
3
this
.
goodsContainer
.
removeAllGoods
()
...
...
@@ -161,10 +163,10 @@ export default class Root extends FYGE.Container {
// 创建 触摸层
createTouchRect
()
{
this
.
touchArea
=
Tools
.
getRect
(
750
,
5
74
,
0xff22ff
,
0
)
this
.
touchArea
=
Tools
.
getRect
(
750
,
8
74
,
0xff22ff
,
0
)
this
.
touchArea
.
x
=
0
this
.
touchArea
.
y
=
10
50
this
.
touchArea
.
mouseEnable
=
tru
e
this
.
touchArea
.
y
=
7
50
this
.
touchArea
.
mouseEnable
=
fals
e
this
.
addChild
(
this
.
touchArea
)
this
.
touchArea
.
addEventListener
(
FYGE
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onMouseDownArea
,
this
)
...
...
@@ -199,6 +201,7 @@ export default class Root extends FYGE.Container {
this
.
guide
.
visible
=
false
setTimeout
(()
=>
{
showPanel
(
MatchingPanel
,
this
.
userInfo
)
this
.
guide
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
guideFunc
,
this
)
},
200
)
}
else
{
this
.
guide
.
texture
=
Ins
.
getRes
(
this
.
guideRes
[
i
])
...
...
project/src/canvas/game/src/chuansongdai/game/ScoreBoard.ts
View file @
3cf797be
...
...
@@ -11,10 +11,8 @@ export default class Catecher extends FYGE.Container {
// 右用户分
scoreRight
;
// 时间
timerNumer
:
60
;
timerNumer
=
60
;
timeText
;
// 倒计时函数
timerFunc
;
// 左 用户板
userBoard_left
;
// 右 用户板
...
...
@@ -96,8 +94,7 @@ export default class Catecher extends FYGE.Container {
// 销毁 事件和循环
destroy
()
{
clearInterval
(
this
.
timerFunc
)
this
.
timerFunc
=
null
this
.
removeEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
timerFunc
,
this
)
}
// 分数更新
...
...
@@ -157,8 +154,7 @@ export default class Catecher extends FYGE.Container {
}
stopTime
()
{
clearInterval
(
this
.
timerFunc
)
this
.
timerFunc
=
null
this
.
removeEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
timerFunc
,
this
)
}
start
(
time
)
{
...
...
@@ -166,19 +162,41 @@ export default class Catecher extends FYGE.Container {
this
.
scoreRight
=
0
this
.
timerNumer
=
time
this
.
updateTime
(
this
.
timerNumer
)
this
.
timerFunc
=
setInterval
(()
=>
{
// 时间消耗完毕
if
(
this
.
timerNumer
<=
0
)
{
this
.
_root
.
gameOver
()
clearInterval
(
this
.
timerFunc
)
this
.
timerFunc
=
null
this
.
updateTime
(
0
)
}
else
{
this
.
updateTime
(
--
this
.
timerNumer
)
this
.
addEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
timerFunc
,
this
)
}
lt
=
0
tt
=
0
// 倒计时函数
timerFunc
()
{
if
(
!
this
.
_root
.
gameStartFlag
)
return
// console.log(this.timerNumer)
// 时间消耗完毕
if
(
this
.
timerNumer
<=
0
)
{
this
.
_root
.
gameOver
()
this
.
updateTime
(
0
)
this
.
lt
=
this
.
tt
=
0
this
.
removeEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
timerFunc
,
this
)
return
}
if
(
this
.
lt
)
{
let
nt
=
new
Date
().
getTime
()
let
dt
=
nt
-
this
.
lt
this
.
tt
+=
dt
/
1000
>>
0
let
ntt
=
60
-
this
.
tt
if
(
ntt
!=
this
.
timerNumer
)
{
this
.
timerNumer
=
ntt
this
.
updateTime
(
this
.
timerNumer
)
this
.
lt
=
nt
}
},
1000
)
}
else
{
this
.
lt
=
new
Date
().
getTime
()
}
}
...
...
@@ -215,7 +233,8 @@ export default class Catecher extends FYGE.Container {
c
.
width
=
120
c
.
height
=
120
let
a
=
Tools
.
getCircle
(
60
,
0x000000
,
1
,
60
,
60
)
let
p
=
Tools
.
getSprite
(
avatar
,
0
,
0
)
let
p
=
FYGE
.
Sprite
.
fromUrl
(
avatar
)
p
.
x
=
p
.
y
=
0
p
.
width
=
120
p
.
height
=
120
c
[
'updateAvatar'
]
=
(
avatar
)
=>
{
p
.
texture
=
RES
.
getRes
(
avatar
)
}
...
...
taobao_mini/client/pages/myprize/myprize.js
View file @
3cf797be
...
...
@@ -45,6 +45,9 @@ Page({
this
.
getMyPrize
();
},
onShareAppMessage
()
{
// 返回自定义分享信息
SHARE_CONFIG
.
imageUrl
=
''
SHARE_CONFIG
.
path
=
this
.
changeURLArg
(
'/pages/homePage/homePage'
,
'inviteId'
,
app
.
openId
)
return
SHARE_CONFIG
;
},
// 到期时间
...
...
taobao_mini/client/pages/pagecanvas/pagecanvas.js
View file @
3cf797be
...
...
@@ -317,7 +317,7 @@ Component({
let
fname
=
this
.
getFakeUserName
()
let
favatar
=
this
.
getFakeAvatar
()
this
.
gameData
=
{
win
:
win
,
win
:
true
,
fakeUserName
:
fname
,
fakeUserImgUrl
:
favatar
,
userName
:
app
.
nickName
,
...
...
taobao_mini/client/pages/turnTablePage/turnTablePage.acss
View file @
3cf797be
...
...
@@ -198,7 +198,7 @@
width: 478rpx;
height: 237rpx;
position: absolute;
top: 1
11
0rpx;
top: 1
08
0rpx;
left: calc(50% - 239rpx);
background: transparent
}
...
...
@@ -220,12 +220,12 @@
padding: 0 30rpx;
margin-top: 103rpx;
width: 100%;
height:
93
rpx;
height:
100
rpx;
}
.bottom_btn {
flex: 1;
width: 20
6
rpx;
width: 20
4
rpx;
height: 93rpx;
}
...
...
taobao_mini/client/pages/turnTablePage/turnTablePage.axml
View file @
3cf797be
...
...
@@ -34,6 +34,15 @@
<image class="outside" src="{{resList['7750fff8-383d-4135-b20b-b3108d5d0845'].url}}" />
</view>
<!-- 底座和按钮 -->
<view class="bottom">
<image class="bottom_bg" src="{{resList['738011dd-8cdc-455e-8dfa-2f17f5112bdf'].url}}" mode="aspectFill" />
<view class="bottom_btn_wrapper">
<view class="bottom_btn" onTap="gotoMyPrize"><image class="bottom_btn_image" src="{{resList['050b07b7-255a-4118-9221-0d4f1d45c296'].url}}" mode="aspectFill" /></view>
<view class="bottom_btn" onTap="handdlerStartButton"><image class="bottom_btn_image" src="{{resList['18cbbf52-1bc5-4109-b60c-59de1d06a1e7'].url}}" mode="aspectFill" /></view>
</view>
</view>
</view>
<!-- 开始按钮 -->
<view class="start_button" onTap='handdlerStartButton'>
...
...
@@ -44,20 +53,12 @@
<!-- 顶部文案 -->
<label class="chance">剩余抽奖次数:{{leftTimes}}次</label>
<!-- 底座和按钮 -->
<view class="bottom">
<image class="bottom_bg" src="{{resList['fbe88b43-5930-46e3-bd7b-f0ea0ff50d1a'].url}}" mode="aspectFill" />
<view class-"bottom_btn_wrapper">
<view class="bottom_btn" onTap=""><image class="bottom_btn_image" src="{{resList['050b07b7-255a-4118-9221-0d4f1d45c296'].url}}" mode="aspectFill" /></view>
<view class="bottom_btn" onTap=""><image class="bottom_btn_image" src="{{resList['18cbbf52-1bc5-4109-b60c-59de1d06a1e7'].url}}" mode="aspectFill" /></view>
</view>
</view>
</view>
</view>
<!-- 弹窗-奖品信息
-->
<!-- 弹窗-奖品信息
<rewards-modal a:if='{{rewardsModalShow}}' modalData='{{rewardsModalData}}' onModalClose='onModalClose' onModalConfirm='onModalConfirm' data-modalType='rewards' />
-->
<!-- 弹窗部分 -->
<common-modal-t1 a:if="{{commonModalVisibleT1}}" data="{{commonModalDataT1}}" onModalClose="closeCommonModalT1" onModalConfirm="confirmCommonModalT1" />
<common-modal-t2 a:if="{{commonModalVisibleT2}}" data="{{commonModalDataT2}}" onModalClose="closeCommonModalT2" onModalOne="onModalT2One" onModalTwo="onModalT2Two"/>
...
...
taobao_mini/client/pages/turnTablePage/turnTablePage.js
View file @
3cf797be
...
...
@@ -36,41 +36,41 @@ Page({
},
activityId
:
undefined
,
onLoad
(
query
)
{
async
onLoad
(
query
)
{
// 页面加载
// this.getAuth()
console
.
info
(
`Page onLoad with query:
${
JSON
.
stringify
(
query
)}
`
)
let
{
activityId
}
=
app
this
.
activityId
=
activityId
this
.
getDataTurnTable
()
this
.
getGameInfo
()
},
onCallBack
()
{
// console.log(this.data.listRange)
await
this
.
getGameInfo
()
},
// 获取游戏次数
async
getGameInfo
()
{
API
.
getGameInfo
({
activityId
:
this
.
activityId
})
return
new
Promise
((
resolve
,
reject
)
=>
{
API
.
getGameInfo
({
activityId
:
this
.
activityId
})
.
then
(
res
=>
{
const
{
success
,
message
,
data
}
=
res
if
(
!
success
)
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
)
}
else
{
console
.
log
(
'%c-----获取游戏信息
\
n'
+
'-----yd.getGameInfo
\
n'
,
ConsoleStyle
,
data
)
this
.
setData
({
leftTimes
:
data
.
lotteryTimes
})
resolve
(
'complete'
)
}
})
.
catch
(
res
=>
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
);
})
||
{};
.
catch
(
res
=>
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
);
reject
(
'fail'
)
})
||
{}
})
},
// 获取转盘信息
async
getDataTurnTable
()
{
let
{
success
,
data
}
=
await
API
.
getLotteryPrizeList
({
activityId
:
this
.
activityId
}).
catch
(
res
=>
{
console
.
warn
(
res
)
commonToast
(
res
&&
res
.
message
)
})
||
{}
if
(
success
&&
data
)
{
// 开发用
if
(
success
&&
data
)
{
console
.
log
(
'%c-----获取转盘奖品
\
n'
+
'-----getPrizeConfigList
\
n'
,
ConsoleStyle
,
data
)
data
.
forEach
((
item
,
index
)
=>
{
...
...
@@ -80,10 +80,7 @@ Page({
}
})
// data.push(...data)
// data.push(heartBroken)
this
.
setData
({
listTurnTable
:
data
,
leftTimes
:
data
.
leftTimes
})
this
.
setData
({
listTurnTable
:
data
})
}
},
...
...
@@ -97,7 +94,7 @@ Page({
// 开始旋转 转盘
async
startDraw
()
{
console
.
log
(
'
startDraw run'
)
console
.
log
(
'
%cstartDraw run'
,
ConsoleStyle
)
if
(
this
.
data
.
rotateFlag
)
return
if
(
!
this
.
data
.
leftTimes
>
0
)
{
commonToast
(
'您还没有抽奖次数'
)
...
...
@@ -109,16 +106,20 @@ Page({
return
})
||
{}
// test code -
// let success = true
// let data = {
// id: '5f7295860cb733e8928791b6',
// type: 3,
// name: '一碗热翔',
// image: '//yun.duiba.com.cn/spark/assets/9be08f492b1e9fb4006cd676bcf5df760856b74a.png'
// }
// test code -
this
.
setData
({
rotateFlag
:
true
})
if
(
success
&&
data
)
{
let
rotateT
// 旋转扇面
let
rotateDeg
// 选装角度
...
...
@@ -135,23 +136,60 @@ Page({
rotateT
=
4
+
1
this
.
setData
({
rewardsInfo
:
data
})
}
// test code -
// rotateT = this.sum(1, 6)
// test code -
})
}
// 调整位置-归零
this
.
animateRotation
(
this
.
timerCount
?
360
*
(
++
this
.
timerCount
*
2
)
:
0
,
1
)
rotateDeg
=
rotateT
*
60
-
30
// 开始动画
setTimeout
(()
=>
{
this
.
animateRotation
(
360
*
(
++
this
.
timerCount
*
2
)
+
rotateDeg
,
1000
*
(
rotateDeg
/
360
)
+
1000
)
//更改 rotateFlag
setTimeout
(()
=>
{
this
.
setData
({
rotateFlag
:
false
})
},
1000
*
(
rotateDeg
/
360
)
+
1000
+
20
)
// 更改 rotateFlag - 弹窗 结果弹窗
setTimeout
(()
=>
{
this
.
setData
({
rotateFlag
:
false
})
if
(
data
.
type
!==
5
)
{
this
.
showCommonMoadalT2
({
title
:
'恭喜你'
,
content
:
`恭喜您获得
${
data
.
name
}
`
,
confirmCallback1
:
async
()
=>
{
await
this
.
getGameInfo
()
this
.
closeCommonModalT2
()
this
.
gotoMyPrize
()
},
confirmCallback2
:
async
()
=>
{
await
this
.
getGameInfo
()
this
.
closeCommonModalT2
()
},
btnImg1
:
resList
[
'240b56fa-66ce-414c-86ea-4ac13a3ac4e2'
].
url
,
btnImg2
:
resList
[
'8d3b3b51-d535-48e6-a76c-d61920da4826'
].
url
,
rewardsImg
:
data
.
image
})
}
else
{
this
.
showCommonMoadalT1
({
title
:
'很遗憾'
,
content
:
`奖励与你擦肩而过\n 再接再厉哦~`
,
confirmCallback
:
async
()
=>
{
await
this
.
getGameInfo
()
this
.
closeCommonModalT1
()
},
btnImg
:
resList
[
'fd0d94ef-fe1a-4771-8ba2-ad7aadacafc0'
].
url
})
}
},
1000
*
(
rotateDeg
/
360
)
+
1000
+
20
)
},
300
)
this
.
setData
({
leftTimes
:
--
this
.
data
.
leftTimes
})
let
time
=
this
.
data
.
leftTimes
-
1
this
.
setData
({
leftTimes
:
time
})
}
},
// 旋转动画rot:旋转角度,timegap:旋转时间
animateRotation
(
rot
,
timegap
)
{
console
.
log
(
'animateRotation run'
)
...
...
@@ -165,7 +203,6 @@ Page({
this
.
setData
({
myAnimation
:
animation
.
export
()
})
},
onModalClose
(
e
)
{
...
...
@@ -186,10 +223,12 @@ Page({
},
onModalConfirm
(
e
)
{
// TODO: do something
this
.
onModalClose
(
e
)
},
gotoMyPrize
()
{
my
.
navigateTo
({
url
:
'../myprize/myprize'
})
},
init
()
{
this
.
getIndex
()
},
...
...
@@ -214,55 +253,14 @@ Page({
onReachBottom
()
{
// 页面被拉到底部
},
/**
* 获取用户权限
*/
async
getAuth
()
{
const
userInfo
=
await
getAuthUserInfo
()
if
(
!
userInfo
)
return
const
{
nickName
,
avatar
}
=
userInfo
app
.
nickName
=
nickName
app
.
avatar
=
avatar
this
.
login
()
},
/**
* 获取主接口
*/
async
getIndex
()
{
const
{
activityId
}
=
app
const
{
success
,
data
}
=
await
API
.
getIndex
({
activityId
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
)
})
||
{}
if
(
success
&&
data
)
{
const
{
title
,
content
,
rule
}
=
data
this
.
setData
({
title
,
content
,
rule
})
}
},
/**
* 登录接口
*/
async
login
()
{
const
{
activityId
,
nickName
,
avatar
}
=
app
const
{
success
}
=
await
API
.
login
({
activityId
,
nickName
,
avatar
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
)
})
||
{}
if
(
success
)
{
this
.
init
()
}
},
/**
* 显示规则弹层
*/
// 显示规则弹层
showRuleModal
()
{
this
.
setData
({
ruleModalVisible
:
true
})
},
/**
* 通用弹出确认按钮回调
*/
// 通用弹出确认按钮回调
confirmCommonModal
()
{
const
{
commonModalConfirm
}
=
this
.
data
commonModalConfirm
&&
commonModalConfirm
()
...
...
@@ -295,18 +293,71 @@ Page({
})
},
// 通用弹层 - 关闭 - T1
closeCommonModalT1
()
{
this
.
setData
({
commonModalVisibleT1
:
false
});
},
// 通用弹层 - 关闭 - T2
closeCommonModalT2
()
{
this
.
setData
({
commonModalVisibleT2
:
false
});
},
onModalT2One
()
{
this
.
data
.
onModalT2One
()
},
onModalT2Two
()
{
this
.
data
.
onModalT2Two
()
},
confirmCommonModalT1
()
{
this
.
data
.
confirmCommonModalT1
()
},
/**
* 跳转到天猫页面
*/
// 获取用户权限
async
getAuth
()
{
const
userInfo
=
await
getAuthUserInfo
()
if
(
!
userInfo
)
return
const
{
nickName
,
avatar
}
=
userInfo
app
.
nickName
=
nickName
app
.
avatar
=
avatar
this
.
login
()
},
// 获取主接口
async
getIndex
()
{
const
{
activityId
}
=
app
const
{
success
,
data
}
=
await
API
.
getIndex
({
activityId
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
)
})
||
{}
if
(
success
&&
data
)
{
const
{
title
,
content
,
rule
}
=
data
this
.
setData
({
title
,
content
,
rule
})
}
},
// 登录接口
async
login
()
{
const
{
activityId
,
nickName
,
avatar
}
=
app
const
{
success
}
=
await
API
.
login
({
activityId
,
nickName
,
avatar
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
)
})
||
{}
if
(
success
)
{
this
.
init
()
}
},
// 跳转到天猫页面
goTmallPage
()
{
navigateToOutside
(
REDIRECT_URL
[
'tmall'
])
},
onShareAppMessage
()
{
// 返回自定义分享信息
// return SHARE_CONFIG
SHARE_CONFIG
.
imageUrl
=
''
SHARE_CONFIG
.
path
=
this
.
changeURLArg
(
'/pages/homePage/homePage'
,
'inviteId'
,
app
.
openId
)
return
SHARE_CONFIG
;
},
// 取 随机数
sum
(
m
,
n
)
{
var
num
=
Math
.
floor
(
Math
.
random
()
*
(
m
-
n
)
+
n
)
return
num
},
})
taobao_mini/client/resconfig/resList.js
View file @
3cf797be
...
...
@@ -652,6 +652,18 @@ const resList = {
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/视频加载也.ae8ad97c68d1de7e88b311a7339b1a30c4ebc883.png'
,
uuid
:
'fbe88b43-5930-46e3-bd7b-f0ea0ff50d1a'
},
'240b56fa-66ce-414c-86ea-4ac13a3ac4e2'
:
{
name
:
'转盘查看奖品'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/转盘查看奖品.27e49f3519d21b18a9668b9f976c8d2b2518c06b.png'
,
uuid
:
'240b56fa-66ce-414c-86ea-4ac13a3ac4e2'
},
'8d3b3b51-d535-48e6-a76c-d61920da4826'
:
{
name
:
'转盘继续抽奖'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/转盘继续抽奖.fe17a5fb4ea5e033add1a857e3fd1f5b7363ac40.png'
,
uuid
:
'8d3b3b51-d535-48e6-a76c-d61920da4826'
}
};
...
...
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