Commit 15ece3e7 authored by 徐士卿's avatar 徐士卿

capsule

parent a4d1fc28
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
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
...@@ -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
} }
......
...@@ -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/doDraw.do", uri: "ndj/draw.do",
withToken: true, withToken: true,
}, },
......
...@@ -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();
......
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