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
8800b354
Commit
8800b354
authored
Sep 30, 2020
by
AU-Pro-mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new code --02
parent
7aa323bf
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
161 additions
and
206 deletions
+161
-206
app.js
taobao_mini/client/app.js
+4
-1
comMissionModal.axml
...ni/client/components/comMissionModal/comMissionModal.axml
+2
-2
comMissionModal.js
...mini/client/components/comMissionModal/comMissionModal.js
+5
-0
goodsModal.js
taobao_mini/client/components/goodsModal/goodsModal.js
+2
-2
homePage.axml
taobao_mini/client/pages/homePage/homePage.axml
+3
-5
homePage.js
taobao_mini/client/pages/homePage/homePage.js
+16
-127
pagecanvas.js
taobao_mini/client/pages/pagecanvas/pagecanvas.js
+117
-69
resList.js
taobao_mini/client/resconfig/resList.js
+12
-0
No files found.
taobao_mini/client/app.js
View file @
8800b354
...
@@ -21,7 +21,10 @@ App({
...
@@ -21,7 +21,10 @@ App({
xxlWinRate
:
0.7
,
xxlWinRate
:
0.7
,
// 游戏胜率 - 传送带
// 游戏胜率 - 传送带
csdWinRate
:
0.7
,
csdWinRate
:
0.7
,
// 是否是新用户 - 传送带
isNewUser_csd
:
true
,
// 是否是新用户 - 消消乐
isNewUser_xxl
:
true
,
// 全局数据
// 全局数据
globalData
:
{},
globalData
:
{},
...
...
taobao_mini/client/components/comMissionModal/comMissionModal.axml
View file @
8800b354
...
@@ -14,10 +14,10 @@
...
@@ -14,10 +14,10 @@
<image class="mission_icon" src="{{item.iconUrl}}" />
<image class="mission_icon" src="{{item.iconUrl}}" />
<view class="mission_content">
<view class="mission_content">
<view class="mission_title">{{item.taskNameActiv}}</view>
<view class="mission_title">{{item.taskNameActiv}}</view>
<view class="mission_describe">乐园门票 <text class="mission_describe_hightlight">+{{item.
waitReceive
}}</text></view>
<view class="mission_describe">乐园门票 <text class="mission_describe_hightlight">+{{item.
rewards
}}</text></view>
</view>
</view>
<view class="mission_btn {{ item.status === 1 ? 'mission_btn_active' : '' }}"
<view class="mission_btn {{ item.status === 1 ? 'mission_btn_active' : '' }}"
data-type="{{item.taskType}}" data-status="{{item.status}}" data-itemIds="{{item.itemIds}}" onTap="doTaskByType">
data-type="{{item.taskType}}" data-status="{{item.status}}" data-itemIds="{{item.itemIds}}"
data-info="{{item}}"
onTap="doTaskByType">
<text a:if="{{item.status === 1}}" class="mission_btn_text">{{item.btnText}}</text>
<text a:if="{{item.status === 1}}" class="mission_btn_text">{{item.btnText}}</text>
<text a:if="{{item.status === 2}}" class="mission_btn_text">待领取</text>
<text a:if="{{item.status === 2}}" class="mission_btn_text">待领取</text>
<text a:if="{{item.status === 3}}" class="mission_btn_text">已完成</text>
<text a:if="{{item.status === 3}}" class="mission_btn_text">已完成</text>
...
...
taobao_mini/client/components/comMissionModal/comMissionModal.js
View file @
8800b354
...
@@ -142,6 +142,11 @@ Component({
...
@@ -142,6 +142,11 @@ Component({
if
(
!
success
)
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
)
}
if
(
!
success
)
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
)
}
else
{
else
{
console
.
log
(
'%c--------领取成功
\
n'
+
'-----yd.receiveTaskRewards
\
n'
,
ConsoleStyle
,
data
)
console
.
log
(
'%c--------领取成功
\
n'
+
'-----yd.receiveTaskRewards
\
n'
,
ConsoleStyle
,
data
)
if
(
ds
.
type
===
'invites'
)
{
commonToast
(
`已有
${
ds
.
info
.
todayCompleteTimes
}
位还有为你助力,获得次数,乐园门票+
${
Number
(
ds
.
info
.
todayCompleteTimes
)
*
Number
(
ds
.
info
.
rewards
)}
`
)
}
else
{
commonToast
(
'领取成功'
)
}
this
.
getMissionList
()
this
.
getMissionList
()
this
.
onRefreshGameInfo
()
this
.
onRefreshGameInfo
()
}
}
...
...
taobao_mini/client/components/goodsModal/goodsModal.js
View file @
8800b354
...
@@ -48,7 +48,7 @@ Component({
...
@@ -48,7 +48,7 @@ Component({
if
(
!
this
.
timer
)
{
if
(
!
this
.
timer
)
{
this
.
setData
({
usePercent
:
this
.
data
.
percent
})
this
.
setData
({
usePercent
:
this
.
data
.
percent
})
this
.
browseGoodsTimes
()
this
.
browseGoodsTimes
()
console
.
log
(
30
-
this
.
usePercent
)
console
.
log
(
15
-
this
.
usePercent
)
}
}
}
}
},
},
...
@@ -87,7 +87,7 @@ Component({
...
@@ -87,7 +87,7 @@ Component({
this
.
setData
({
this
.
setData
({
usePercent
:
this
.
data
.
usePercent
+
1
usePercent
:
this
.
data
.
usePercent
+
1
},
()
=>
{
},
()
=>
{
if
(
this
.
data
.
usePercent
>=
30
)
{
if
(
this
.
data
.
usePercent
>=
15
)
{
console
.
log
(
this
.
data
.
usePercent
)
console
.
log
(
this
.
data
.
usePercent
)
this
.
props
.
onCompleteTask
(
taskType
)
this
.
props
.
onCompleteTask
(
taskType
)
clearInterval
(
this
.
timer
)
clearInterval
(
this
.
timer
)
...
...
taobao_mini/client/pages/homePage/homePage.axml
View file @
8800b354
...
@@ -78,11 +78,11 @@
...
@@ -78,11 +78,11 @@
<view class="bottom">
<view class="bottom">
<view class="bottom_turntable_block" onTap="gotoTurnTable">
<view class="bottom_turntable_block" onTap="gotoTurnTable">
<image class="bottom_turntable_block_image" src="{{resList['44b8923b-c9f9-4246-a4ff-4093ff97ca33'].url}}" />
<image class="bottom_turntable_block_image" src="{{resList['44b8923b-c9f9-4246-a4ff-4093ff97ca33'].url}}" />
<view class="bottom_ydgame_block_coin">抽奖次数 X{{drawNum}}</view>
</view>
</view>
<view class="bottom_ydgame_block" onTap="openShowChooseGame">
<view class="bottom_ydgame_block" onTap="openShowChooseGame">
<image class="bottom_ydgame_block_image" src="{{resList['81a085b2-ce9c-4a8f-bdcc-d08f10083134'].url}}" />
<image class="bottom_ydgame_block_image" src="{{resList['81a085b2-ce9c-4a8f-bdcc-d08f10083134'].url}}" />
<view class="bottom_mission_block_freenum">抽奖次数 X{{drawNum}}</view>
</view>
</view>
<view class="bottom_mission_block" onTap="showMissionModal">
<view class="bottom_mission_block" onTap="showMissionModal">
...
@@ -93,8 +93,8 @@
...
@@ -93,8 +93,8 @@
<!-- 选择游戏 -->
<!-- 选择游戏 -->
<view class="gamechoose_block" a:if='{{ showChooseGame }}'>
<view class="gamechoose_block" a:if='{{ showChooseGame }}'>
<image class="gamechoose_block_back" src="{{resList['22c949b8-84af-4a22-bb21-70088d1eafad'].url}}" />
<image class="gamechoose_block_back" src="{{resList['22c949b8-84af-4a22-bb21-70088d1eafad'].url}}" />
<image data-gameType='1' onTap="handleClickGame" class="gamechoose_block_sc {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['
f2915694-4e09-4776-8f38-9ddb285e4d17
'].url}}" />
<image data-gameType='1' onTap="handleClickGame" class="gamechoose_block_sc {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['
b23ce750-11e2-45f9-b3af-a0a7dedddcfd
'].url}}" />
<image data-gameType='2' onTap="handleClickGame" class="gamechoose_block_xxl {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['
7aafb158-7fec-4ae1-a83e-496779c4a10
7'].url}}" />
<image data-gameType='2' onTap="handleClickGame" class="gamechoose_block_xxl {{ ticketNum ? '' : 'opciaty05' }}" src="{{resList['
ffe6b4b2-3401-44b6-b090-11005d2fd5d
7'].url}}" />
<view class="gameChoose_mask" onTap="closeShowChooseGame"></view>
<view class="gameChoose_mask" onTap="closeShowChooseGame"></view>
</view>
</view>
</view>
</view>
...
@@ -108,8 +108,6 @@
...
@@ -108,8 +108,6 @@
class="homepage_pagecanvas"
class="homepage_pagecanvas"
onBackPage="backToPage"
onBackPage="backToPage"
gameType="{{ gameType }}"
gameType="{{ gameType }}"
gameData="{{ gameData }}"
gamePrize="{{ gamePrize }}"
>
>
</pagecanvas>
</pagecanvas>
...
...
taobao_mini/client/pages/homePage/homePage.js
View file @
8800b354
...
@@ -42,12 +42,6 @@ Page({
...
@@ -42,12 +42,6 @@ Page({
// 用户是否登陆
// 用户是否登陆
userLogin
:
false
,
userLogin
:
false
,
data
:
{
data
:
{
// 游戏数据
gameData
:
null
,
// 游戏抽奖
gamePrize
:
null
,
resList
:
resList
,
resList
:
resList
,
title
:
''
,
title
:
''
,
content
:
''
,
content
:
''
,
...
@@ -106,13 +100,12 @@ Page({
...
@@ -106,13 +100,12 @@ Page({
// 开场动画
// 开场动画
this
.
openAnimation
().
then
(
async
res_
=>
{
this
.
openAnimation
().
then
(
async
res_
=>
{
this
.
backToPage
()
this
.
backToPage
()
this
.
init
()
this
.
getAuth
()
})
})
// test - 打点
// test - 打点
// clickStat(1, '2')
// clickStat(1, '2')
this
.
getAuth
()
},
},
// 获取用户授权信息
// 获取用户授权信息
...
@@ -304,10 +297,10 @@ Page({
...
@@ -304,10 +297,10 @@ Page({
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
API
.
getGameInfo
({
activityId
:
app
.
activityId
})
API
.
getGameInfo
({
activityId
:
app
.
activityId
})
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
'%c-----获取游戏信息
\
n'
+
'-----yd.getGameInfo
\
n'
,
ConsoleStyle
,
data
)
const
{
success
,
message
,
data
}
=
res
const
{
success
,
message
,
data
}
=
res
if
(
!
success
)
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
)
}
if
(
!
success
)
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
)
}
else
{
else
{
console
.
log
(
'%c-----获取游戏信息
\
n'
+
'-----yd.getGameInfo
\
n'
,
ConsoleStyle
,
data
)
this
.
setData
({
this
.
setData
({
ticketNum
:
data
.
gameTimes
,
ticketNum
:
data
.
gameTimes
,
drawNum
:
data
.
lotteryTimes
,
drawNum
:
data
.
lotteryTimes
,
...
@@ -336,31 +329,7 @@ Page({
...
@@ -336,31 +329,7 @@ Page({
// 切换到游戏
// 切换到游戏
async
changeGameOrPage
(
e
)
{
async
changeGameOrPage
(
e
)
{
// 测试
if
(
e
.
currentTarget
.
dataset
.
gameType
!=
3
)
await
this
.
getGameInfo
()
this
.
setData
({
gameShow
:
true
,
gameType
:
1
,
gameData
:
{
win
:
true
,
fakeUserName
:
'xxxxxxxx'
,
fakeUserImgUrl
:
'//yun.duiba.com.cn/spark/assets/赚门票.21d8c2fd01dffd454116bb6c1189ba6bb74306f4.png'
,
userName
:
app
.
nickName
,
userImgUrl
:
app
.
avatar
}
})
setTimeout
(()
=>
{
this
.
setData
({
gameShow_timeout
:
true
})
},
350
)
this
.
setData
({
gamePrize
:
{
name
:
'一碗热翔'
,
image
:
'//yun.duiba.com.cn/spark/assets/赚门票.21d8c2fd01dffd454116bb6c1189ba6bb74306f4.png'
,
type
:
1
}
})
// 测试
return
if
(
this
.
data
.
ticketNum
==
0
&&
e
.
currentTarget
.
dataset
.
gameType
!=
3
)
{
if
(
this
.
data
.
ticketNum
==
0
&&
e
.
currentTarget
.
dataset
.
gameType
!=
3
)
{
this
.
showCommonMoadalT1
({
this
.
showCommonMoadalT1
({
title
:
'门票不足'
,
title
:
'门票不足'
,
...
@@ -372,109 +341,22 @@ Page({
...
@@ -372,109 +341,22 @@ Page({
return
return
}
else
{
}
else
{
let
type
=
Number
(
e
.
currentTarget
.
dataset
.
gameType
)
let
type
=
Number
(
e
.
currentTarget
.
dataset
.
gameType
)
API
.
doJoin
({
activityId
:
app
.
activityId
,
type
:
type
===
1
?
'slide'
:
'timeline'
})
this
.
setData
({
.
then
(
res
=>
{
gameShow
:
true
,
const
{
data
,
success
}
=
res
gameType
:
type
if
(
success
)
{
// 计算胜负
let
win
=
this
.
countWinRange
()
let
fname
=
this
.
getFakeUserName
()
let
favatar
=
this
.
getFakeAvatar
()
this
.
setData
({
gameShow
:
true
,
gameType
:
type
,
gameData
:
{
win
:
win
,
fakeUserName
:
fname
,
fakeUserImgUrl
:
favatar
,
userName
:
app
.
nickName
,
userImgUrl
:
app
.
avatar
}
})
setTimeout
(()
=>
{
this
.
setData
({
gameShow_timeout
:
true
})
},
350
)
// 游戏结束开奖 -- 提前
this
.
getGameOverPrize
()
}
else
{
commonToast
(
res
.
message
)
}
})
.
catch
(
res
=>
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
)
})
||
{};
}
},
// 游戏结束 获取开奖
getGameOverPrize
()
{
API
.
gameOver
({
activityId
:
app
.
activityId
,
type
:
type
===
1
?
'slide'
:
'timeline'
,
isWin
:
win
})
.
then
(
res
=>
{
const
{
data
,
success
}
=
res
if
(
success
)
{
this
.
setData
({
gamePrize
:
{
name
:
data
.
prize
.
name
,
image
:
data
.
prize
.
image
,
type
:
data
.
prize
.
type
}
})
}
else
{
this
.
setData
({
gamePrize
:
{
name
:
'谢谢参与'
,
image
:
''
,
type
:
5
}
})
}
})
})
.
catch
(
err
=>
{
console
.
warn
(
err
)
this
.
setData
({
gamePrize
:
{
name
:
'谢谢参与'
,
image
:
''
,
type
:
5
}
})
})
},
// 游戏胜率计算
countWinRange
(
type
)
{
let
win
=
false
let
num
=
Math
.
floor
(
Math
.
random
()
*
(
100
-
1
)
+
1
)
if
(
type
===
1
)
{
if
(
num
<=
app
.
xxlWinRate
*
100
)
win
=
true
else
win
=
false
}
else
if
(
type
===
2
)
{
if
(
num
<=
app
.
csdWinRate
*
100
)
win
=
true
else
win
=
false
}
}
return
win
},
},
// 生成假用户名
getFakeUserName
()
{
},
// 生成假用户头像
getFakeAvatar
()
{
},
// 从游戏 返回 到 主页
// 从游戏 返回 到 主页
backToPage
()
{
backToPage
()
{
this
.
setData
({
gameShow_timeout
:
false
,
gameType
:
0
,
gamePrize
:
null
,
gameData
:
null
})
this
.
setData
({
gameShow_timeout
:
false
,
gameType
:
0
})
this
.
getGameInfo
()
this
.
getGameInfo
()
setTimeout
(()
=>
{
this
.
setData
({
gameShow
:
false
})
},
350
)
setTimeout
(()
=>
{
this
.
setData
({
gameShow
:
false
})
},
350
)
},
},
// 去转盘
// 去转盘
gotoTurnTable
()
{
gotoTurnTable
()
{
my
.
navigateTo
({
url
:
'../turnTablePage/turnTablePage'
})
},
my
.
navigateTo
({
url
:
'../turnTablePage/turnTablePage'
})
},
// video - turn left
// video - turn left
videoTurnLeft
()
{
videoTurnLeft
()
{
...
@@ -562,12 +444,17 @@ Page({
...
@@ -562,12 +444,17 @@ Page({
videoHideFunc
()
{
videoHideFunc
()
{
this
.
videoRecord
(
this
.
data
.
videoActiveIndex
)
this
.
videoRecord
(
this
.
data
.
videoActiveIndex
)
console
.
log
(
'videoHideFunc'
,
this
.
videoSrcArr
)
console
.
log
(
'videoHideFunc'
,
this
.
videoSrcArr
)
this
.
setData
({
videoShow
:
false
})
this
.
setData
({
videoShow
:
false
})
// 观看超过 15000ms 15s
// 观看超过 15000ms 15s
if
(
this
.
videoSrcArr
[
this
.
data
.
videoActiveIndex
].
timeStamp
>=
15000
&&
!
this
.
videoSrcArr
[
this
.
data
.
videoActiveIndex
].
completed
)
{
if
(
this
.
videoSrcArr
[
this
.
data
.
videoActiveIndex
].
timeStamp
>=
15000
&&
!
this
.
videoSrcArr
[
this
.
data
.
videoActiveIndex
].
completed
)
{
this
.
videoSrcArr
[
this
.
data
.
videoActiveIndex
].
completed
=
true
this
.
videoSrcArr
[
this
.
data
.
videoActiveIndex
].
completed
=
true
this
.
getWatchRewards
()
this
.
getWatchRewards
()
}
}
this
.
videoSrcArr
.
forEach
((
item
)
=>
{
item
.
timeStamp
=
0
})
},
},
// video - 观看视频领奖
// video - 观看视频领奖
...
@@ -575,9 +462,11 @@ Page({
...
@@ -575,9 +462,11 @@ Page({
API
.
sendCoinsByWatch
({
activityId
:
app
.
activityId
,
videoIndex
:
this
.
data
.
videoActiveIndex
})
API
.
sendCoinsByWatch
({
activityId
:
app
.
activityId
,
videoIndex
:
this
.
data
.
videoActiveIndex
})
.
then
(
res
=>
{
.
then
(
res
=>
{
const
{
success
,
data
}
=
res
const
{
success
,
data
}
=
res
console
.
log
(
'%c-----观看视频领奖
\
n'
+
'-----yd.sendCoinsByWatch
\
n'
,
ConsoleStyle
,
data
)
if
(
success
)
{
if
(
success
)
{
let
num
=
this
.
data
.
drawNum
let
num
=
this
.
data
.
drawNum
this
.
setData
({
drawNum
:
num
+
data
.
lotteryTimes
})
this
.
setData
({
drawNum
:
num
+
data
.
lotteryTimes
})
if
(
!
data
.
lotteryTimes
)
return
this
.
showCommonMoadalT2
({
this
.
showCommonMoadalT2
({
title
:
'看视频奖励'
,
title
:
'看视频奖励'
,
content
:
`抽奖次数+
${
data
.
lotteryTimes
}
`
,
content
:
`抽奖次数+
${
data
.
lotteryTimes
}
`
,
...
...
taobao_mini/client/pages/pagecanvas/pagecanvas.js
View file @
8800b354
...
@@ -2,7 +2,7 @@ import { Main } from './output';
...
@@ -2,7 +2,7 @@ import { Main } from './output';
import
API
from
'../../api'
;
import
API
from
'../../api'
;
const
app
=
getApp
();
const
app
=
getApp
();
const
{
tbcc
}
=
app
;
const
{
tbcc
}
=
app
;
const
{
commonToast
,
getAuthUserInfo
,
navigateToOutside
,
getSystemInfo
}
=
tbcc
.
tb
;
const
{
commonToast
,
getAuthUserInfo
,
navigateToOutside
,
getSystemInfo
,
ConsoleStyle
}
=
tbcc
.
tb
;
const
checkSystem
=
async
()
=>
{
const
checkSystem
=
async
()
=>
{
const
{
version
}
=
await
getSystemInfo
();
const
{
version
}
=
await
getSystemInfo
();
...
@@ -20,6 +20,8 @@ Component({
...
@@ -20,6 +20,8 @@ Component({
messageMadalData
:
{},
messageMadalData
:
{},
messageMadalVisble
:
false
,
messageMadalVisble
:
false
,
},
},
isWin
:
false
,
gamePrize
:
null
,
gameData
:
null
,
gameData
:
null
,
didMount
()
{
didMount
()
{
...
@@ -36,20 +38,10 @@ Component({
...
@@ -36,20 +38,10 @@ Component({
// 切换游戏场景
// 切换游戏场景
if
(
!
this
.
main
)
return
if
(
!
this
.
main
)
return
this
.
main
.
changeGameSence
(
this
.
props
.
gameType
)
this
.
main
.
changeGameSence
(
this
.
props
.
gameType
)
setTimeout
(()
=>
{
if
(
this
.
props
.
gameType
===
2
)
this
.
postMessage
(
'xxlGameData'
,
this
.
props
.
gameData
)
else
if
(
this
.
props
.
gameType
===
1
)
this
.
postMessage
(
'csdGameData'
,
this
.
props
.
gameData
)
},
60
)
}
if
(
this
.
props
.
gamePrize
!==
prevProps
.
gamePrize
&&
this
.
props
.
gamePrize
!==
null
)
{
if
(
this
.
props
.
gameType
===
2
)
this
.
postMessage
(
'xxlGamePrize'
,
this
.
props
.
gamePrize
)
else
if
(
this
.
props
.
gameType
===
1
)
this
.
postMessage
(
'csdGamePrize'
,
this
.
props
.
gamePrize
)
}
}
},
},
methods
:
{
methods
:
{
back
()
{
this
.
props
.
onBackPage
()
},
init
()
{
init
()
{
console
.
log
(
'do init'
);
console
.
log
(
'do init'
);
this
.
spark_startEngine
();
this
.
spark_startEngine
();
...
@@ -82,12 +74,6 @@ Component({
...
@@ -82,12 +74,6 @@ Component({
onCanvasReady
()
{
onCanvasReady
()
{
console
.
log
(
'onCanvasReady'
)
console
.
log
(
'onCanvasReady'
)
this
.
changeGameSence
(
this
.
props
.
gameType
)
this
.
changeGameSence
(
this
.
props
.
gameType
)
// 授权和登录先搞
checkSystem
().
then
(
r
=>
{
if
(
r
)
{
this
.
getAuth
();
}
});
},
},
postMessage
(
netName
,
data
)
{
postMessage
(
netName
,
data
)
{
...
@@ -102,61 +88,123 @@ Component({
...
@@ -102,61 +88,123 @@ Component({
let
netName
=
e
.
data
.
netName
;
//接口参数
let
netName
=
e
.
data
.
netName
;
//接口参数
let
parameter
=
e
.
data
.
parameter
;
//暂时发现3个需要用户操作的接口
let
parameter
=
e
.
data
.
parameter
;
//暂时发现3个需要用户操作的接口
//定制的授权
switch
(
netName
)
{
if
(
netName
.
indexOf
(
"mine"
)
==
0
)
{
// 获取信息
var
data
=
{
case
"mine.getUserInfo"
:
success
:
true
// 开始游戏
};
this
.
gameStartInfo
()
break
;
switch
(
netName
)
{
case
"mine.backToPage"
:
case
"mine.getAppData"
:
this
.
back
()
//获取信息
break
;
data
=
{
case
'mine.getPrizeInfo'
:
success
:
true
,
// 游戏结束开奖 -- 提前
data
:
{
this
.
getGameOverPrize
()
activityId
:
app
.
activityId
,
break
;
nickName
:
app
.
nickName
,
default
:
avatar
:
app
.
avatar
,
console
.
warn
(
'监听时间名 没有对应处理函数'
)
openId
:
app
.
openId
break
;
}
}
};
break
;
},
case
"mine.navigateToPage"
:
// 切换page
data
=
{
success
:
true
,
data
:
{}
};
// 从游戏中返回
my
.
navigateTo
({
back
()
{
url
:
`/pages/
${
parameter
.
name
}
/
${
parameter
.
name
}
`
this
.
props
.
onBackPage
()
});
this
.
gameData
=
null
break
;
this
.
gamePrize
=
null
case
"mine.backToPage"
:
},
this
.
back
()
break
;
// 游戏开始 获取用户信息
case
"mine.showModal"
:
// 展示弹窗
gameStartInfo
()
{
data
=
{
success
:
true
,
data
:
{}
};
API
.
doJoin
({
activityId
:
app
.
activityId
,
type
:
this
.
data
.
gameType
===
1
?
'slide'
:
'timeline'
})
const
key
=
`
${
parameter
.
name
}
Visible`
;
.
then
(
res
=>
{
const
dataKey
=
`
${
parameter
.
name
}
Data`
;
const
{
data
,
success
}
=
res
const
toSetData
=
{};
if
(
success
)
{
toSetData
[
key
]
=
true
;
// 计算胜负
toSetData
[
dataKey
]
=
parameter
.
data
;
let
win
=
this
.
countWinRange
()
this
.
setData
(
toSetData
);
this
.
isWin
=
win
break
;
let
fname
=
this
.
getFakeUserName
()
case
'test'
:
let
favatar
=
this
.
getFakeAvatar
()
console
.
log
(
'测试一下'
,
parameter
.
hint
);
this
.
gameData
=
{
break
;
win
:
win
,
fakeUserName
:
fname
,
fakeUserImgUrl
:
favatar
,
userName
:
app
.
nickName
,
userImgUrl
:
app
.
avatar
,
// 是否是新用户
isNewUser
:
this
.
data
.
gameType
===
1
?
app
.
isNewUser_csd
:
app
.
isNewUser_xxl
}
this
.
postMessage
(
'mine.getUserInfo'
,
this
.
gameData
)
// this.postMessage('csdGameData', this.gameData)
}
else
{
commonToast
(
res
.
message
)
}
}
})
.
catch
(
res
=>
{
console
.
warn
(
res
);
commonToast
(
res
&&
res
.
message
)
})
||
{};
},
// 游戏结束 获取开奖
getGameOverPrize
()
{
API
.
gameOver
({
activityId
:
app
.
activityId
,
type
:
this
.
data
.
gameType
===
1
?
'slide'
:
'timeline'
,
isWin
:
this
.
win
})
.
then
(
res
=>
{
const
{
data
,
success
}
=
res
if
(
success
)
{
this
.
gamePrize
=
{
name
:
data
.
prize
.
name
,
image
:
data
.
prize
.
image
,
type
:
data
.
prize
.
type
}
this
.
postMessage
(
'mine.getPrizeInfo'
,
this
.
gamePrize
)
}
else
{
this
.
gamePrize
=
{
name
:
'谢谢参与'
,
image
:
''
,
type
:
5
}
this
.
postMessage
(
'mine.getPrizeInfo'
,
this
.
gamePrize
)
}
})
.
catch
(
err
=>
{
console
.
warn
(
err
)
this
.
gamePrize
=
{
name
:
'谢谢参与'
,
image
:
''
,
type
:
5
}
this
.
postMessage
(
'mine.getPrizeInfo'
,
this
.
gamePrize
)
})
},
this
.
postMessage
(
netName
,
data
);
// 游戏胜率计算
}
else
{
countWinRange
(
type
)
{
const
{
let
win
=
false
function
:
fc
let
num
=
Math
.
floor
(
Math
.
random
()
*
(
100
-
1
)
+
1
)
}
=
app
.
cloud
;
if
(
type
===
1
)
{
const
[
myCloudName
,
handler
]
=
netName
.
split
(
"."
);
//待写,
if
(
num
<=
app
.
xxlWinRate
*
100
)
win
=
true
else
win
=
false
parameter
.
activityId
=
app
.
activityId
;
}
else
if
(
type
===
2
)
{
fc
.
invoke
(
myCloudName
,
parameter
,
handler
).
then
(
res
=>
{
if
(
num
<=
app
.
csdWinRate
*
100
)
win
=
true
this
.
postMessage
(
netName
,
res
);
else
win
=
false
});
}
}
return
win
},
// 生成假用户名
getFakeUserName
()
{
var
_rsl1
=
''
,
_rsl2
=
''
var
_randomUniCode
=
Math
.
floor
(
Math
.
random
()
*
(
40870
-
19968
)
+
19968
).
toString
(
16
);
eval
(
"_rsl1="
+
'"
\\
u'
+
_randomUniCode
+
'"'
)
eval
(
"_rsl2="
+
'"
\\
u'
+
_randomUniCode
+
'"'
)
return
_rsl1
+
'XXXXXX'
+
_rsl2
},
// 生成假用户头像
getFakeAvatar
()
{
return
'FakeAvatar'
},
},
//鼠标事件
//鼠标事件
...
...
taobao_mini/client/resconfig/resList.js
View file @
8800b354
...
@@ -610,6 +610,18 @@ const resList = {
...
@@ -610,6 +610,18 @@ const resList = {
ext
:
'.png'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/我也要赢大奖.a22bebbd5be4a6e557ee4ef611216ba73b729d10.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/我也要赢大奖.a22bebbd5be4a6e557ee4ef611216ba73b729d10.png'
,
uuid
:
'fd8a805e-e2e3-49c6-8236-1f181177a313'
uuid
:
'fd8a805e-e2e3-49c6-8236-1f181177a313'
},
'ffe6b4b2-3401-44b6-b090-11005d2fd5d7'
:
{
name
:
'胶囊消消'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/胶囊消消.898555668d65ae277a2db5f6541615e4ed6336be.png'
,
uuid
:
'ffe6b4b2-3401-44b6-b090-11005d2fd5d7'
},
'b23ce750-11e2-45f9-b3af-a0a7dedddcfd'
:
{
name
:
'时空传送'
,
ext
:
'.png'
,
url
:
'//yun.duiba.com.cn/spark/assets/时空传送.53c4af1a66a461812b8f3a502b14cddf4daed9b3.png'
,
uuid
:
'b23ce750-11e2-45f9-b3af-a0a7dedddcfd'
}
}
};
};
export
default
resList
;
export
default
resList
;
\ 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