Browse Source

[抽签]功能实现

master
baozw 4 years ago
parent
commit
40c266f797
  1. 266
      src/assets/js/zhuanpan.js

266
src/assets/js/zhuanpan.js

@ -8,22 +8,10 @@ var turnplate={
startAngle:0, //开始角度
bRotate:false //false:停止;ture:旋转
};
choujiang=[
{name:"钦州支队",idnum:1,result:""},
{name:"南宁支队",idnum:1,result:""},
{name:"柳州支队",idnum:1,result:""},
{name:"河池支队",idnum:1,result:""},
{name:"来宾支队",idnum:1,result:""},
{name:"贺州支队",idnum:1,result:""},
{name:"防城港支队",idnum:1,result:""},
{name:"崇左支队",idnum:1,result:""},
{name:"贵港支队",idnum:9,result:""},
{name:"梧州支队",idnum:10,result:""},
{name:"百色支队",idnum:11,result:""},
{name:"玉林支队",idnum:12,result:""},
{name:"北海支队",idnum:13,result:""},
{name:"桂林支队",idnum:14,result:""}
]
num=-1
$(document).ready(function(){
//var chooseid = $( "span[name='zhidui']").attr('id');
$("span[name='aaa']").on("click",function(){
@ -31,138 +19,240 @@ $(document).ready(function(){
if($(this).html()=="钦州支队"){
turnplate.restaraunts = ["广西东油沥青有限公司", "钦州吾悦广场", "钦州天亿石化有限公司"];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6"];
console.log(choujiang[0].result)
if(choujiang[0].idnum<=2)
num=0
if(window.localStorage["0"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
console.log(choujiang[0].idnum)
choujiang[0].idnum++
choujiang[0].result='钦州吾悦广场'
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
console.log(choujiang[0].idnum)
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+choujiang[0].result)
$("#jieguo").append("您的抽签结果为:</br>钦州吾悦广场")
}
drawRouletteWheel()
}else if($(this).html()=="南宁支队")
{
turnplate.restaraunts = ["九洲国际(超高层)", "南宁国际会展中心", "维景国际酒店", "荔园山庄 "];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF"];
if(choujiang[1].idnum<=2)
num=1
if(window.localStorage["1"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
choujiang[1].idnum++
choujiang[1].result='九洲国际(超高层)'
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+choujiang[1].result)
$("#jieguo").append("您的抽签结果为:</br>九洲国际(超高层)")
}
drawRouletteWheel()
}else if($(this).html()=="柳州支队")
{
turnplate.restaraunts = ["广西柳州莲花山庄", "柳州万达广场", "龙城地下商业街", "板栗园加气站 ","地王财富中心"];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=2
if(window.localStorage["2"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["2"])
}
drawRouletteWheel()
}else if($(this).html()=="河池支队")
{
turnplate.restaraunts = ["河池市中石化金城江油库", "河池市宜州区地下商业街", "南城百货(地下) ","宁铁燃气有限责任公司","广西河池市大洋购物中心"];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=3
if(window.localStorage["3"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["3"])
}
drawRouletteWheel()
}else if($(this).html()=="来宾支队")
{
turnplate.restaraunts = ["来宾饭店(高层)", "宝晨化工", "天成百货(地下) ","百悦商业广场(地下)","来宾市方盛广场(人员密集)"];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=4
if(window.localStorage["4"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["4"])
}
drawRouletteWheel()
}else if($(this).html()=="贺州支队")
{
turnplate.restaraunts = ["贺州市国际酒店(高层)", "宝晨化工有限公司", "贺州市南宁百货大楼", "远东国贸地下停车场 "];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=5
if(window.localStorage["5"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["5"])
}
drawRouletteWheel()
}
else if($(this).html()=="防城港支队")
{
turnplate.restaraunts = ["防城港供电局", "北京华联超市桂海东盟店", "港宸国际大酒店(高层)", "永旺天和商贸有限公司(只做地下一) ", "广西中油能源有限公司 ","中海油广西防城港天然气有限责任公司 "];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=6
if(window.localStorage["6"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["6"])
}
drawRouletteWheel()
}else if($(this).html()=="崇左支队")
{
turnplate.restaraunts = ["崇左油库","崇左市雅图影视广场(6层商场)"];
turnplate.colors = ["#FFF4D6", "#FFFFFF"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=7
if(window.localStorage["7"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["7"])
}
drawRouletteWheel()
}else if($(this).html()=="贵港支队")
{
turnplate.restaraunts = ["广西威汉鞋业有限公司", "贵港市嘉龙海杰电子科技有限公司", "贵港市覃塘区人民医院综合楼", "贵港市中国石油分公司油库 ", "维多利亚酒店(高层)","平南中心购物广场(地下)"];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=8
if(window.localStorage["8"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["8"])
}
drawRouletteWheel()
}else if($(this).html()=="梧州支队")
{
turnplate.restaraunts = ["广西威汉鞋业有限公司", "贵港市嘉龙海杰电子科技有限公司", "贵港市覃塘区人民医院综合楼", "贵港市中国石油分公司油库 ", "梧州市中石化火山油库","平南中心购物广场(地下)", ];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=9
if(window.localStorage["9"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["9"])
}
drawRouletteWheel()
}else if($(this).html()=="百色支队")
{
turnplate.restaraunts = ["平果地下商业街", "三雷油库", "安达曼国际酒店(高层)", "恒宁城市广场(大型城市综合体) "];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=10
if(window.localStorage["10"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["10"])
}
drawRouletteWheel()
}else if($(this).html()=="玉林支队")
{
turnplate.restaraunts = ["平果地下商业街", "三雷油库", "安达曼国际酒店(高层)", "恒宁城市广场(大型城市综合体) ","玉林市中医医院"];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF","#FFF4D6"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=11
if(window.localStorage["11"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["11"])
}
drawRouletteWheel()
}else if($(this).html()=="北海支队")
{
turnplate.restaraunts = ["平果地下商业街", "三雷油库", "安达曼国际酒店(高层)", "恒宁城市广场(大型城市综合体) ","和安宁春城(大型城市综合体)"];
turnplate.colors = ["#FFF4D6", "#FFFFFF", "#FFF4D6", "#FFFFFF","#FFF4D6"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=12
if(window.localStorage["12"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["12"])
}
drawRouletteWheel()
}else if($(this).html()=="桂林支队")
{
turnplate.restaraunts = ["兴安油库", "宏谋酒店(高层)"];
turnplate.colors = ["#FFF4D6", "#FFFFFF"];
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
num=13
if(window.localStorage["13"]==undefined)
{
$("#zhuanpan").show()
$("#end").hide();
$("#jieguo").empty()
}else{
$("#zhuanpan").hide()
$("#end").show();
$("#jieguo").empty()
$("#jieguo").append("您的抽签结果为:</br>"+window.localStorage["13"])
}
drawRouletteWheel()
}
});
@ -203,7 +293,51 @@ var rotateFn = function (item, txt){
$("#zhuanpan").hide()
$("#end").show();
var dataLength=turnplate.restaraunts.length
if(dataLength>=5)
if(num==0){
window.localStorage.setItem( 0, "钦州吾悦广场");
$("#jieguo").append("您的抽签结果为:</br>钦州吾悦广场")
}else if(num==1){
window.localStorage.setItem( 1, "九洲国际(超高层)");
$("#jieguo").append("您的抽签结果为:</br>九洲国际(超高层)")
}else if(num==2){
window.localStorage.setItem( 2, "地王财富中心");
$("#jieguo").append("您的抽签结果为:</br>地王财富中心")
}else if(num==3){
window.localStorage.setItem( 3, "广西河池市大洋购物中心");
$("#jieguo").append("您的抽签结果为:</br>广西河池市大洋购物中心")
}
else if(num==4){
window.localStorage.setItem( 4, "来宾市方盛广场(人员密集)");
$("#jieguo").append("您的抽签结果为:</br>来宾市方盛广场(人员密集)")
}else if(num==5){
window.localStorage.setItem( 5, "贺州市国际酒店(高层)");
$("#jieguo").append("您的抽签结果为:</br>贺州市国际酒店(高层)")
}else if(num==6){
window.localStorage.setItem( 6, "广西中油能源有限公司");
$("#jieguo").append("您的抽签结果为:</br>广西中油能源有限公司")
}else if(num==7){
window.localStorage.setItem( 7, "崇左油库");
$("#jieguo").append("您的抽签结果为:</br>崇左油库")
}else if(num==8){
window.localStorage.setItem( 8, "维多利亚酒店(高层)");
$("#jieguo").append("您的抽签结果为:</br>维多利亚酒店(高层)")
}else if(num==9){
window.localStorage.setItem( 9, "梧州市中石化火山油库");
$("#jieguo").append("您的抽签结果为:</br>梧州市中石化火山油库")
}else if(num==10){
window.localStorage.setItem( 10, "平果地下商业街");
$("#jieguo").append("您的抽签结果为:</br>平果地下商业街")
}else if(num==11){
window.localStorage.setItem( 11, "玉林市中医医院");
$("#jieguo").append("您的抽签结果为:</br>玉林市中医医院")
}else if(num==12){
window.localStorage.setItem( 12, "和安宁春城(大型城市综合体)");
$("#jieguo").append("您的抽签结果为:</br>和安宁春城(大型城市综合体)")
}else if(num==13){
window.localStorage.setItem( 13, "兴安油库");
$("#jieguo").append("您的抽签结果为:</br>兴安油库")
}
/* if(dataLength>=5)
{
$("#jieguo").append("您的抽签结果为:</br>"+turnplate.restaraunts[4])
}else if(dataLength==3){
@ -211,7 +345,7 @@ var rotateFn = function (item, txt){
}
else{
$("#jieguo").append("您的抽签结果为:</br>"+turnplate.restaraunts[0])
}
} */
turnplate.bRotate = !turnplate.bRotate;
}
});

Loading…
Cancel
Save