Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RB_StrongestBrain_250520
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
RB_StrongestBrain_250520
Commits
15ece3e7
Commit
15ece3e7
authored
May 22, 2025
by
徐士卿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
capsule
parent
a4d1fc28
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
96 deletions
+100
-96
capsule.ts
mock/capsule.ts
+72
-0
draw.ts
mock/draw.ts
+0
-81
main.ts
mock/main.ts
+2
-2
index.ts
src/api/index.ts
+4
-4
CapsulePage.jsx
src/pages/CapsulePage/CapsulePage.jsx
+22
-9
No files found.
mock/capsule.ts
0 → 100644
View file @
15ece3e7
export
default
[
{
url
:
'/ndj/index.do'
,
method
:
'get'
,
response
:
({
query
})
=>
{
return
{
"success"
:
true
,
"message"
:
"信息"
,
"code"
:
"123"
,
"data"
:
{
"remainDrawTimes"
:
157
,
// 抽奖次数
"prizeInfo"
:
[
{
"prizeName"
:
`奖品1`
,
"prizeImg"
:
`//yun.duiba.com.cn/polaris/jinmoqiang.9e5bbc004f69ab6a3f34d93daeda028616a9f00d.png`
,
// prizeId: `1`,
},
{
"prizeName"
:
`奖品2`
,
"prizeImg"
:
`//yun.duiba.com.cn/polaris/jinmoqiang.9e5bbc004f69ab6a3f34d93daeda028616a9f00d.png`
,
// prizeId: `2`,
},
{
"prizeName"
:
`奖品名称3`
,
"prizeImg"
:
`//yun.duiba.com.cn/polaris/mac.fe55aa43e5a231d568973dcdd0b91e0263d5a12c.png`
,
// prizeId: `3`,
},
{
"prizeName"
:
`奖品名称4`
,
"prizeImg"
:
`//yun.duiba.com.cn/polaris/mgtv.e5f0709a2a4083bc57ce52ff200a50a2e56b2658.png`
,
// prizeId: `4`,
},
{
"prizeName"
:
`奖品名称5`
,
"prizeImg"
:
`//yun.duiba.com.cn/polaris/qq.73ad13cd0c6fd705327d12957c12e9d5b2e77baa.png`
,
// prizeId: `5`,
},
{
"prizeName"
:
`谢谢参与`
,
"prizeImg"
:
`https://yun.duiba.com.cn/spark/assets/f77861647e7b55e9c95e9c49d891a21526157a76.jpg`
,
// prizeId: `thanks`,
},
]
}
}
},
},
{
url
:
'/ndj/draw.do'
,
method
:
'get'
,
response
:
({
query
})
=>
{
return
{
"code"
:
"123"
,
"message"
:
"信息xxx"
,
"success"
:
true
,
"data"
:
{
"boolPrize"
:
true
,
// true-中奖,取prizeInfo信息,false-为中奖,取productInfo
"productInfos"
:
{
"productImg"
:
"//yun.duiba.com.cn/spark/assets/f77861647e7b55e9c95e9c49d891a21526157a76.jpg"
,
"productText"
:
"介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍1介绍费1介绍1介绍1介绍费1介绍1介绍1介绍费1介绍1介绍1介绍费1介绍1"
},
"prizeInfo"
:
{
"prizeName"
:
"reprehenderit tempor non"
,
"prizeImg"
:
"Duis veniam ipsum voluptate eiusmod"
}
}
}
},
}
]
\ No newline at end of file
mock/draw.ts
deleted
100644 → 0
View file @
a4d1fc28
export
default
[
{
url
:
'/draw/index.do'
,
method
:
'get'
,
response
:
({
query
})
=>
{
return
{
"success"
:
true
,
"message"
:
"报错了~"
,
"code"
:
null
,
timeStamp
:
Date
.
now
(),
"data"
:
{
"remainDrawTimes"
:
3
,
// 抽奖次数
"prizeVOs"
:
[
{
prizeName
:
`奖品1`
,
prizeImg
:
`//yun.duiba.com.cn/polaris/jinmoqiang.9e5bbc004f69ab6a3f34d93daeda028616a9f00d.png`
,
prizeId
:
`1`
,
},
{
prizeName
:
`奖品名称2`
,
prizeImg
:
`//yun.duiba.com.cn/polaris/kouzhao.dc55dac6db1ff94c4666c2602d6cb0ac84139982.png`
,
prizeId
:
`2`
,
},
{
prizeName
:
`奖品名称3`
,
prizeImg
:
`//yun.duiba.com.cn/polaris/mac.fe55aa43e5a231d568973dcdd0b91e0263d5a12c.png`
,
prizeId
:
`3`
,
},
{
prizeName
:
`奖品名称4`
,
prizeImg
:
`//yun.duiba.com.cn/polaris/mgtv.e5f0709a2a4083bc57ce52ff200a50a2e56b2658.png`
,
prizeId
:
`4`
,
},
{
prizeName
:
`奖品名称5`
,
prizeImg
:
`//yun.duiba.com.cn/polaris/qq.73ad13cd0c6fd705327d12957c12e9d5b2e77baa.png`
,
prizeId
:
`5`
,
},
{
prizeName
:
`谢谢参与`
,
prizeImg
:
`https://yun.duiba.com.cn/spark/assets/f77861647e7b55e9c95e9c49d891a21526157a76.jpg`
,
prizeId
:
`thanks`
,
},
]
}
}
},
},
{
url
:
'/draw/doDraw.do'
,
method
:
'get'
,
response
:
({
query
})
=>
{
return
{
"code"
:
""
,
"message"
:
null
,
"success"
:
true
,
"data"
:
{
"prizeName"
:
""
,
"prizeId"
:
"1"
,
"prizeImg"
:
""
,
"productInfos"
:
[
{
"productImg"
:
"//yun.duiba.com.cn/spark/assets/f77861647e7b55e9c95e9c49d891a21526157a76.jpg"
,
"productText"
:
"介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍费1介绍1介绍1介绍费1介绍1介绍1介绍费1介绍1介绍1介绍费1介绍1介绍1介绍费1介绍1"
},
{
"productImg"
:
"//yun.duiba.com.cn/polaris/111.8b981b3fc7d090da2457b4f29b9feec496dc95fd.png"
,
"productText"
:
"介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2介绍2"
},
{
"productImg"
:
"//yun.duiba.com.cn/polaris/mgtv.e5f0709a2a4083bc57ce52ff200a50a2e56b2658.png"
,
"productText"
:
"介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3介绍3"
}
]
},
"timeStamp"
:
1739176246085
}
},
}
]
\ No newline at end of file
mock/main.ts
View file @
15ece3e7
...
@@ -21,8 +21,8 @@ export default [
...
@@ -21,8 +21,8 @@ export default [
},
},
"rulePop"
:
false
,
"rulePop"
:
false
,
"userId"
:
"qui id deserunt"
,
"userId"
:
"qui id deserunt"
,
"validUid"
:
"Lorem labore occaecat sed quis"
,
"validUid"
:
true
,
"isAgent"
:
"true"
,
"isAgent"
:
true
,
"boundYkCode"
:
"eiusmod in dolor"
,
"boundYkCode"
:
"eiusmod in dolor"
,
"minim_0"
:
93293912
"minim_0"
:
93293912
}
}
...
...
src/api/index.ts
View file @
15ece3e7
...
@@ -125,11 +125,11 @@ const API = generateAPI({
...
@@ -125,11 +125,11 @@ const API = generateAPI({
},
},
/**
抽奖
首页 */
/**
扭蛋机
首页 */
drawIndex
:
"
draw
/index.do"
,
drawIndex
:
"
ndj
/index.do"
,
/** 抽奖 */
/**
扭蛋机
抽奖 */
drawJoin
:
{
drawJoin
:
{
uri
:
"
draw/doD
raw.do"
,
uri
:
"
ndj/d
raw.do"
,
withToken
:
true
,
withToken
:
true
,
},
},
...
...
src/pages/CapsulePage/CapsulePage.jsx
View file @
15ece3e7
...
@@ -21,7 +21,6 @@ import dynamicSvga from "../../assets/svga/3输出出奖啊.svga";
...
@@ -21,7 +21,6 @@ import dynamicSvga from "../../assets/svga/3输出出奖啊.svga";
// import { LOG_KEY, pageView, sensorLog } from '@src/utils/sensors';
// import { LOG_KEY, pageView, sensorLog } from '@src/utils/sensors';
@
observer
@
observer
class
Capsulepage
extends
React
.
Component
{
class
Capsulepage
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -32,7 +31,7 @@ class Capsulepage extends React.Component {
...
@@ -32,7 +31,7 @@ class Capsulepage extends React.Component {
};
};
this
.
btnStarting
=
false
;
// 抽奖机是否启动
this
.
btnStarting
=
false
;
// 抽奖机是否启动
// this.turntableRef = null; // 大转盘
// this.turntableRef = null; // 大转盘
this
.
drawResultInfo
=
{};
//
this.drawResultInfo = {};
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -86,28 +85,42 @@ class Capsulepage extends React.Component {
...
@@ -86,28 +85,42 @@ class Capsulepage extends React.Component {
// 抽奖次数为0
// 抽奖次数为0
if
(
!
remainDrawTimes
)
{
if
(
!
remainDrawTimes
)
{
return
Toast
.
show
(
"抽奖次数不足,快去
做任务
赚次数吧~"
);
return
Toast
.
show
(
"抽奖次数不足,快去
猜谜
赚次数吧~"
);
}
}
if
(
this
.
btnStarting
)
return
false
;
if
(
this
.
btnStarting
)
return
false
;
this
.
btnStarting
=
true
;
this
.
btnStarting
=
true
;
const
{
success
,
data
}
=
await
API
.
drawJoin
();
const
{
success
,
data
}
=
await
API
.
drawJoin
();
if
(
success
&&
data
)
{
if
(
success
&&
data
)
{
//
抽奖
机转动开始抽奖
//
扭蛋
机转动开始抽奖
// this.turntableRef.launch();
// this.turntableRef.launch();
this
.
setState
({
btnDynamic
:
true
});
this
.
setState
({
btnDynamic
:
true
});
this
.
drawResultInfo
=
data
||
{};
// this.drawResultInfo = data || {};
const
{
boolPrzie
,
prizeInfo
=
{},
productInfo
=
{}
}
=
data
||
{};
const
{
prizeName
=
""
,
prizeImg
=
""
}
=
prizeInfo
||
{};
const
{
productImg
=
""
,
productText
=
""
}
=
productInfo
||
{};
// const index = prizeVOs?.findIndex(
// (item) => item.prizeId === (this.drawResultInfo.prizeId || "thanks")
// );
// console.info("index", index);
const
index
=
prizeVOs
?.
findIndex
(
(
item
)
=>
item
.
prizeId
===
(
this
.
drawResultInfo
.
prizeId
||
"thanks"
)
);
console
.
info
(
"index"
,
index
);
// 抽奖机停止转动
// 抽奖机停止转动
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
btnDynamic
:
false
});
this
.
setState
({
btnDynamic
:
false
});
this
.
stopOkHandle
();
this
.
stopOkHandle
();
},
2000
);
},
2000
);
// this.turntableRef.braking(index);
// this.turntableRef.braking(index);
// 此时判断是否中奖 true-中奖,取prizeInfo信息,false-为中奖,取productInfo
if
(
boolPrzie
)
{
// 中奖
ModalCtrl
.
pushPop
(
"Pop_winprize"
,
{
prizeName
,
prizeImg
});
}
else
{
// 没中奖
ModalCtrl
.
pushPop
(
"NoPrizeCard"
,
{
productImg
,
productText
});
}
}
else
{
}
else
{
this
.
btnStarting
=
false
;
this
.
btnStarting
=
false
;
this
.
getDrawInfo
();
this
.
getDrawInfo
();
...
...
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