Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@byhealth/lotteryroulette

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byhealth/lotteryroulette

转盘抽奖 [demo](https://by-healthfed.github.io/venom-lotteryroulette/dist)

  • 1.0.28
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

lotteryroulette

转盘抽奖 demo

parame
参数名称说明是否必填类型
重要参数parentIdGame挂载Id
游戏将要寄生的Node Id
String
targetIdGame自身Id
默认game-target-时间戳+100以内随机数
String
styleGame皮肤定义
定义游戏模块的UI展示效果
Object
prizes奖品参数
参考prizes结构
Array
start开始抽奖,向后台请求抽奖结果然后以promise的形式将结果返回给Game以启动抽奖。
注意
1、务必返回Promise对象
2、中奖奖品数据结构必须等于prizes的某个子项
Function
()=>Promise(...)
saveAddress提交收货地址时保存收货人地址方法
当所中奖品的属性receiveType=2(填写地址)时将会弹出地址填写框,完成地址填写提交后调用此方法用于保存收货人地址,参数address是收集的地址信息
saveAddress = function(address){

console.log(data)
}
Function
()=>Promise(...)
playerPhone参与抽奖人的电话号码,有则显示String
checkVerificationCode获取短信验证码方法,用于短信验证参与人电话号码,有电话号码且有此方法时开启短信验证Function
receiverInfo默认收货人信息,中奖时此信息将自动填写到收货地址表单Object
cardIdRequest是否要求填写或验证身份证
状态:1 隐藏身份证,2 验证身份证,3 身份证为空时不验证有填写时验证,4 不验证身份证
Number
emBaseem基准像素,Game将把此值写入到parentId的style.fontSize中,子元素将以此为单位基准,默认计算window宽度Number
onCancel取消中奖结果或取消中奖后填写地址时的回调Function
onEnsure确定中奖结果或完成中奖填写地址时的回调Function
loading设置Loading的属性,也可以在style中设置
document
Object
显示文字定义failedModalTitle未中奖弹窗标题String
submitFailedText未中奖按钮文字String
successModalTitle中奖弹窗标题String
submitSuccessText中奖按钮文字String
submitAddressText中奖去填写地址按钮文字String
prizes 结构

奖品是一个数组,游戏将根据奖品数组渲染页面,奖品数组的每一项必须包含以下属性

prizes = [{
   "prizeId": 1, // 奖品id
   "prizeType": 1, // 奖品类型 0 未中奖, 1 实物, 2 虚拟
   "receiveType": 1, // 领取方式。1:默认;2:填写地址;3:链接类;4:虚拟卡
   "prizeAlias": "巴西绿蜂胶", // 奖品别名
   "prizeName": "蜂胶软胶囊彩盒装(60粒,巴西绿蜂胶)", // 奖品名称
   "awardMsg": null, // 中奖提示信息
   "gameImg": "./assets/images/card1.png", // 游戏图片
   "prizeImg": "./assets/images/prize1.jpg", // 奖品图片
   "memo": "奖品的备注说明!" // 奖品备注
},{...}]
case
import { Game } from '@byhealth/lotteryroulette';

const LotteryGame = new Game({
          targetId: "target",
          parentId: "parentId",
          playerPhone: "13635219421",
          cardIdRequest: 3, 
          style: window.themedata1,
          start: () => new Promise((resolve) => {
                window.LotteryGame1.Loading.show();
                window.setTimeout(() => {
                	window.LotteryGame1.Loading.hide();
                	resolve(prizes1[Math.floor(Math.random() * rand)]);
                }, 1000);
            }),
          saveAddress: data => new Promise((resolve) => {
                window.LotteryGame1.Loading.show();
                window.setTimeout(() => {
                    console.log('地址信息', data);
                	window.LotteryGame1.Loading.hide();
                	resolve();
                }, 3000);
            }),
          receiverInfo: {
              idCard: "430522201008124611",
              receiverPhone: "13622841234",
              address: "address"
          },
          checkVerificationCode: data => new Promise((resolve) => {
                window.LotteryGame1.Loading.show();
                window.setTimeout(() => {
                    console.log('手机验证码', data);
                	window.LotteryGame1.Loading.hide();
                	resolve();
                }, 3000);
            }), // 检查手机验证码
          prizes: {
			...
          },
          emBase: 10,
          onCancel: () => console.log('关闭中奖结果'),
          onEnsure: function(prize){ console.log('确定中奖结果1!', prize); },
          loading: {
            size: 20,
            length: 5,
            cycleTime: 1
          }
    });
    

FAQs

Package last updated on 25 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc