Last active
December 11, 2015 17:28
-
-
Save inkless/4634359 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width,maximum-scale=1.0,minimum-scale=1.0"> | |
<script src="http://we.sdoprofile.com/common/js/release/loader.min.js"></script> | |
<script type="text/javascript"> | |
var prizeInfoUrl = "xxxx"; | |
var drawUrl = 'xxx'; | |
</script> | |
</head> | |
<body> | |
<div id="container"></div> | |
<script src="lottery.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we_ipic/common/js/test/business/lottery.js | |
// 此文件旨在缩短lottery 消息html的长度,为临时文件 | |
; | |
$we.require("component/lottery", function(f) { | |
$we.utils.request(prizeInfoUrl, {}, function(data) { | |
if(typeof data.data !== "object") { | |
alert("系统内部错误,请稍后再试!"); | |
return; | |
} | |
var prizeInfo = data.data; | |
var width = $("body").width(); | |
var lottery = f(document.getElementById("container"), { | |
width: width, | |
// width: 516, | |
height: width*0.8375, | |
// height: 432, | |
x: 3, | |
y: 3, | |
itemBorder: 0, | |
itemMargin: 0, | |
itemPadding: width/86, | |
// itemPadding: 6, | |
bgColor: "#fff" | |
}); | |
// $we.utils.addStyleSheet(".we_lottery .we_lottery_btn a { background-size: 100% 100%; }"); | |
// 设置奖品图片对应表 | |
lottery.setPicMatch(prizeInfo.prizeMatch); | |
// 设置奖品的布局和获取奖品的时候的URL | |
lottery.setPrizeFromServer({ | |
prize: prizeInfo.prizeLayout, | |
url: drawUrl, | |
endCallback: function(prize_desc) { | |
var txt = ''; | |
if (!prize_desc) { | |
alert('很遗憾,没有中奖,感谢参与!'); | |
return; | |
} | |
if (prize_desc.indexOf('点券') !== -1) { | |
txt = '恭喜您获得盛大通行证送出的'+prize_desc+',稍后,我们会将点券发放到您的账号,更多精彩活动陆续推出,敬请留意。'; | |
alert(txt); | |
return; | |
} | |
switch(prize_desc){ | |
case 'iPad mini': | |
case 'iPhone5': | |
case '雷蛇游戏鼠标': | |
txt = '恭喜,中奖啦!您已经赢取'+ prize_desc +'一部,请保持'+binded_mobile+'手机开机,我们的工作人员会在近期与您取得联系,确认领奖方式。'; | |
break; | |
case '电影票': | |
txt = '恭喜,中奖啦!您已经赢取'+ prize_desc +'一张,我们会将兑换码发送到您的手机,请注意查收。'; | |
break; | |
default: | |
txt = '恭喜,中奖啦!您已经赢取' + prize_desc + '!'; | |
break; | |
} | |
alert(txt); | |
}, | |
errorCallback: function(data) { | |
var txt = ''; | |
switch(data.errno){ | |
//未达到分值 | |
case -3000: //85 | |
case -4000: //100 | |
txt = '抱歉,您不符合抽奖条件,请重新体检后再抽奖'; | |
break; | |
case 40000031: | |
txt = '不要贪心哦,你已经抽过奖了'; | |
break; | |
case -5000: | |
txt = '系统异常,请稍后再试!'; | |
break; | |
default: | |
txt = data.msg; | |
break; | |
} | |
alert(txt); | |
} | |
}); | |
}, function(data) { | |
alert(data.msg); | |
}, "GET", true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment