From 64575f92bdb7976168b9439b2a1376b6114c25c2 Mon Sep 17 00:00:00 2001 From: chenjingyu Date: Sun, 18 Oct 2020 08:44:44 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=94=B9]=E8=BD=AC=E7=9B=98=E4=B9=9D?= =?UTF-8?q?=E5=B7=9E=E5=9B=BD=E9=99=85=E5=90=8D=E7=A7=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- angular.json | 5 +- src/app/app-routing.module.ts | 5 +- src/app/ui/luck-draw/luck-draw.component.html | 4 +- src/app/ui/luck-draw/luck-draw.component.ts | 11 +- src/assets/js/zhuanpan.js | 6 +- src/assets/js/zhuanpanpici.js | 1269 +++++++++++++++++ 6 files changed, 1290 insertions(+), 10 deletions(-) create mode 100644 src/assets/js/zhuanpanpici.js diff --git a/angular.json b/angular.json index b435257..5239c70 100644 --- a/angular.json +++ b/angular.json @@ -105,7 +105,10 @@ "styles": [ "src/styles.scss" ], - "scripts": [] + "scripts": [ + "src/assets/js/zhuanpan.js", + "src/assets/js/zhuanpanpici.js" + ] } }, "lint": { diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 833c96c..18d8f45 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -4,7 +4,7 @@ * @Author: sueRimn * @Date: 2020-10-07 15:00:15 * @LastEditors: sueRimn - * @LastEditTime: 2020-10-09 15:28:06 + * @LastEditTime: 2020-10-17 15:46:23 */ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; @@ -18,6 +18,8 @@ import {AuthGuard} from './auth.guard' import {MTokenK1Component} from './m-token-k1/m-token-k1.component' //K1秘钥 import { LuckDrawComponent } from './ui/luck-draw/luck-draw.component'; import {ResetComponent} from './ui/reset/reset.component' +//import {LuckDrawBatchComponent} from './ui/luck-draw-batch/luck-draw-batch.component' +import { from } from 'rxjs'; const routes: Routes = [ @@ -35,6 +37,7 @@ const routes: Routes = [ }, */ {path:'',component:LuckDrawComponent}, {path:'Reset',component:ResetComponent}, + //{path:'LuckDrawBatch',component:LuckDrawBatchComponent} // {path:'login', // component:LoginComponent}, diff --git a/src/app/ui/luck-draw/luck-draw.component.html b/src/app/ui/luck-draw/luck-draw.component.html index f45809d..7c35a4c 100644 --- a/src/app/ui/luck-draw/luck-draw.component.html +++ b/src/app/ui/luck-draw/luck-draw.component.html @@ -4,8 +4,9 @@ * @Author: sueRimn * @Date: 2020-09-25 08:48:50 * @LastEditors: sueRimn - * @LastEditTime: 2020-10-17 10:59:46 + * @LastEditTime: 2020-10-17 11:06:52 --> + @@ -57,7 +58,6 @@ - diff --git a/src/app/ui/luck-draw/luck-draw.component.ts b/src/app/ui/luck-draw/luck-draw.component.ts index a2b6d94..0858036 100644 --- a/src/app/ui/luck-draw/luck-draw.component.ts +++ b/src/app/ui/luck-draw/luck-draw.component.ts @@ -4,12 +4,17 @@ * @Author: sueRimn * @Date: 2020-09-25 08:48:50 * @LastEditors: sueRimn - * @LastEditTime: 2020-10-13 15:49:22 + * @LastEditTime: 2020-10-18 08:36:27 */ import { Component, OnInit } from '@angular/core'; +import { from } from 'rxjs'; +import '../../../assets/js/zhuanpan' //import * from '../../../assets/js/awardRotate' +//import *as '../../../assets/js/zhuanpan'; -declare var zhuan:any + +//declare var zhuan:any +//declare function zhuan():any @Component({ selector: 'app-luck-draw', templateUrl: './luck-draw.component.html', @@ -21,7 +26,7 @@ export class LuckDrawComponent implements OnInit { ngOnInit(){ window.setTimeout(()=>{ - //zhuan.drawRouletteWheel() + //zhuan() },0) } diff --git a/src/assets/js/zhuanpan.js b/src/assets/js/zhuanpan.js index bcfd817..3f3d1f0 100644 --- a/src/assets/js/zhuanpan.js +++ b/src/assets/js/zhuanpan.js @@ -10,7 +10,7 @@ var turnplate={ }; var url=(window.location.href).substring(22.26) -num=-1 +var num=-1 function chongzhi(){ localStorage.removeItem(num); } @@ -78,7 +78,7 @@ $(document).ready(function(){ drawRouletteWheel() }else if($(this).html().substring(0,4)=="南宁支队") { - turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) ","九洲国际"]; + turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) ","地王财富中心(模板)"]; turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; num=0 if(window.localStorage["0"]==undefined) @@ -666,7 +666,7 @@ var rotateFn = function (item, txt){ drawRouletteWheel() }else if($(this).html().substring(0,4)=="南宁支队") { - turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) ","九洲国际"]; + turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) ","地王财富中心(模板)"]; turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; num=0 if(window.localStorage["0"]==undefined) diff --git a/src/assets/js/zhuanpanpici.js b/src/assets/js/zhuanpanpici.js new file mode 100644 index 0000000..85e06cb --- /dev/null +++ b/src/assets/js/zhuanpanpici.js @@ -0,0 +1,1269 @@ + + var turnplate={ + restaraunts:[], //大转盘奖品名称 + colors:[], //大转盘奖品区块对应背景颜色 + outsideRadius:176, //大转盘外圆的半径outsideRadius:192, + textRadius:125, //大转盘奖品位置距离圆心的距离155 + insideRadius:52, //大转盘内圆的半径insideRadius:68, + startAngle:0, //开始角度 + bRotate:false //false:停止;ture:旋转 + }; + var url=(window.location.href).substring(22.26) + + var num=-1 + function chongzhi(){ + localStorage.removeItem(num); + } + + $(document).ready(function(){ + console.log(url) + //页面初始化抽签结果 + /* for(var i=0;i<14;i++){ + if(window.localStorage[i]!=undefined){ + $("#endjieguo span").eq(i+1).html(window.localStorage[i]) + $("#chooseZhi img").eq(i).show() + //$(".check-style-unequal-width").show() + } + } */ + if(window.localStorage["南宁支队场次"]!=undefined){ + $("#chooseZhi img").eq(0).show() + $("#endjieguo span").eq(1).html(window.localStorage["南宁支队场次"]) + } if(window.localStorage["柳州支队场次"]!=undefined){ + $("#chooseZhi img").eq(1).show() + $("#endjieguo span").eq(2).html(window.localStorage["柳州支队场次"]) + } if(window.localStorage["桂林支队场次"]!=undefined){ + $("#chooseZhi img").eq(2).show() + $("#endjieguo span").eq(3).html(window.localStorage["桂林支队场次"]) + } if(window.localStorage["梧州支队场次"]!=undefined){ + $("#chooseZhi img").eq(3).show() + $("#endjieguo span").eq(4).html(window.localStorage["梧州支队场次"]) + } if(window.localStorage["北海支队场次"]!=undefined){ + $("#chooseZhi img").eq(4).show() + $("#endjieguo span").eq(5).html(window.localStorage["北海支队场次"]) + } if(window.localStorage["防城港支队场次"]!=undefined){ + $("#chooseZhi img").eq(5).show() + $("#endjieguo span").eq(6).html(window.localStorage["防城港支队场次"]) + } if(window.localStorage["钦州支队场次"]!=undefined){ + $("#chooseZhi img").eq(6).show() + $("#endjieguo span").eq(7).html(window.localStorage["钦州支队场次"]) + } if(window.localStorage["贵港支队场次"]!=undefined){ + $("#chooseZhi img").eq(7).show() + $("#endjieguo span").eq(8).html(window.localStorage["贵港支队场次"]) + } if(window.localStorage["玉林支队场次"]!=undefined){ + $("#chooseZhi img").eq(8).show() + $("#endjieguo span").eq(9).html(window.localStorage["玉林支队场次"]) + } if(window.localStorage["百色支队场次"]!=undefined){ + $("#chooseZhi img").eq(9).show() + $("#endjieguo span").eq(10).html(window.localStorage["百色支队场次"]) + } if(window.localStorage["贺州支队场次"]!=undefined){ + $("#chooseZhi img").eq(10).show() + $("#endjieguo span").eq(11).html(window.localStorage["贺州支队场次"]) + } if(window.localStorage["河池支队场次"]!=undefined){ + $("#chooseZhi img").eq(11).show() + $("#endjieguo span").eq(12).html(window.localStorage["河池支队场次"]) + } if(window.localStorage["来宾支队场次"]!=undefined){ + $("#chooseZhi img").eq(12).show() + $("#endjieguo span").eq(13).html(window.localStorage["来宾支队场次"]) + } if(window.localStorage["崇左支队场次"]!=undefined){ + $("#chooseZhi img").eq(13).show() + $("#endjieguo span").eq(14).html(window.localStorage["崇左支队场次"]) + } + //转盘初始化 + turnplate.restaraunts = ["上午场", "下午场"]; + turnplate.colors = ["#FFEBEA", "#FF7245"]; + + //左侧表格点击事件 + $("span[name='aaa']").on("click",function(){ + console.log($(this).html().substring(0,4)) + //$(".turnplate").css("background-image","url(../../../assets/images/ceshi.png)"); + + if($(this).html().substring(0,4)=="钦州支队"){ + //console.log(item) + num=6 + if(window.localStorage["钦州支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==7){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + turnplate.startAngle=0 + $("#endjieguo span").eq(7).html("") + $('.pointer').removeClass("stop") + }else{ + for(var i=1;i<15;i++){ + if(i==7){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + //if(window.localStorage["6"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["钦州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["钦州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["6"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(7).html(window.localStorage["钦州支队场次"]) + //$("#endjieguo").append("
"+"您的抽签结果为:
"+window.localStorage["0"]+"
") + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="南宁支队") + { + /* turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) ","九洲国际"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=0 + if(window.localStorage["南宁支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==1){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + turnplate.startAngle=0 + $("#endjieguo span").eq(1).html("") + $('.pointer').removeClass("stop") + }else{ + for(var i=1;i<15;i++){ + if(i==1){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + //if(window.localStorage["0"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["南宁支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["南宁支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["0"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(1).html(window.localStorage["南宁支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="柳州支队") + { + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "龙城地下商业街", "板栗园加气站 ","柳州万达广场"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=1 + if(window.localStorage["柳州支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==2){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + turnplate.startAngle=0 + $("#endjieguo span").eq(2).html("") + $('.pointer').removeClass("stop") + }else{ + for(var i=1;i<15;i++){ + if(i==2){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + //if(window.localStorage["柳州支队场次"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["柳州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["柳州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["柳州支队场次"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(2).html(window.localStorage["柳州支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="河池支队") + { + /* turnplate.restaraunts = ["地王国际财富中心(模板)","广西河池市大洋购物中心", "河池市宜州区地下商业街", "河池市中石化金城江油库 "]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=11 + if(window.localStorage["河池支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==12){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + turnplate.startAngle=0 + $("#endjieguo span").eq(12).html("") + $('.pointer').removeClass("stop") + }else{ + for(var i=1;i<15;i++){ + if(i==12){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + //if(window.localStorage["河池支队场次"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["河池支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["河池支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //(window.localStorage["河池支队场次"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(12).html(window.localStorage["河池支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="来宾支队") + { + /* turnplate.restaraunts = ["来宾饭店","来宾市方盛广场","宝晨化工", "天成百货"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=12 + if(window.localStorage["来宾支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==13){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + $("#endjieguo span").eq(13).html("") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + }else{ + for(var i=1;i<15;i++){ + if(i==13){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + //if(window.localStorage["12"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["来宾支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["来宾支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["12"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(13).html(window.localStorage["来宾支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="贺州支队") + { + /* turnplate.restaraunts = ["远东国贸地下停车场", "宝晨化工有限公司", "贺州市南宁百货大楼", "贺州市国际酒店"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=10 + if(window.localStorage["贺州支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==11){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + $("#endjieguo span").eq(11).html("") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + }else{ + for(var i=1;i<15;i++){ + if(i==11){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + if(window.localStorage["贺州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["贺州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(11).html(window.localStorage["贺州支队场次"]) + } + drawRouletteWheel() + } + else if($(this).html().substring(0,5)=="防城港支队") + { + /* turnplate.restaraunts = ["港宸国际大酒店", "钦州吾悦广场(模板)", "龙城地下商业街(模板)", "广西中油能源有限公司 "]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=5 + if(window.localStorage["防城港支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==6){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + $("#endjieguo span").eq(6).html("") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + }else{ + for(var i=1;i<15;i++){ + if(i==6){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + //if(window.localStorage["5"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["防城港支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["防城港支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["5"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(6).html(window.localStorage["防城港支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="崇左支队") + { + /* turnplate.restaraunts = ["钦州吾悦广场(模板)","龙城地下商业街(模板)","地王国际财富中心(模板)","崇左油库"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=13 + if(window.localStorage["崇左支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==14){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + turnplate.startAngle=0 + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(14).html("") + }else{ + for(var i=1;i<15;i++){ + if(i==14){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + //if(window.localStorage["13"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["崇左支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["崇左支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["13"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(14).html(window.localStorage["崇左支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="贵港支队") + { + /* turnplate.restaraunts = ["钦州吾悦广场(模板)", "平南中心购物广场", "贵港市中国石油分公司油库", "维多利亚酒店"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + + num=7 + if(window.localStorage["贵港支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==8){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + $("#endjieguo span").eq(8).html("") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + }else{ + for(var i=1;i<15;i++){ + if(i==8){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + $("#endjieguo span").eq(8).html(window.localStorage["贵港支队场次"]) + //if(window.localStorage["7"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["贵港支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["贵港支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["7"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="梧州支队") + { + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "钦州吾悦广场(模板)", "龙城地下商业街(模板)", "梧州市中石化火山油库" ]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=3 + if(window.localStorage["梧州支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==4){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(4).html("") + }else{ + //console.log("hhh") + for(var i=1;i<15;i++){ + if(i==4){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + $('.pointer').addClass("stop") + if(window.localStorage["梧州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["梧州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + $("#endjieguo span").eq(4).html(window.localStorage["梧州支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="百色支队") + { + /* turnplate.restaraunts = ["安达曼国际酒店", "恒宁城市广场", "三雷油库", "平果地下商业街"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=9 + if(window.localStorage["百色支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==10){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(10).html("") + }else{ + for(var i=1;i<15;i++){ + if(i==10){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + $('.pointer').addClass("stop") + if(window.localStorage["百色支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["百色支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + $("#endjieguo span").eq(10).html(window.localStorage["百色支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="玉林支队") + { + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) "]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=8 + if(window.localStorage["玉林支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==9){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(9).html("") + }else{ + for(var i=1;i<15;i++){ + if(i==9){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + //if(window.localStorage["8"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["玉林支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["玉林支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["8"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $('.pointer').addClass("stop") + $("#endjieguo span").eq(9).html(window.localStorage["玉林支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="北海支队") + { + console.log(turnplate.startAngle) + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "龙城地下商业街(模板)", "和安宁春城","广西东油沥青有限公司(模板)"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=4 + if(window.localStorage["北海支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==5){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + turnplate.startAngle=0 + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(5).html("") + }else{ + for(var i=1;i<15;i++){ + if(i==5){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + $('.pointer').addClass("stop") + //if(window.localStorage["4"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["北海支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["北海支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["4"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $("#endjieguo span").eq(5).html(window.localStorage["北海支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="桂林支队") + { + /* turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)","兴安油库","宏谋酒店"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=2 + if(window.localStorage["桂林支队场次"]==undefined) + { + for(var i=1;i<15;i++){ + if(i==3){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + turnplate.startAngle=0 + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(3).html("") + }else{ + for(var i=1;i<15;i++){ + if(i==3){ + $("#endjieguo span").eq(i).css("color","#ff4d29") + $("#chooseZhi span").eq(i).css("color","#FFF") + }else{ + $("#endjieguo span").eq(i).css("color","#000") + $("#chooseZhi span").eq(i).css("color","#000") + } + } + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + $('.pointer').addClass("stop") + //if(window.localStorage["2"]==turnplate.restaraunts[3]){turnplate.startAngle=5.48} + if(window.localStorage["桂林支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=3.1} + if(window.localStorage["桂林支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["2"]==turnplate.restaraunts[2]){turnplate.startAngle=0.8} + $("#endjieguo span").eq(3).html(window.localStorage["桂林支队场次"]) + } + drawRouletteWheel() + } + + + }); + + //网络检测 + var rotateTimeOut = function (){ + $('#wheelcanvas').rotate({ + angle:0, + animateTo:2160, + duration:8000, + callback:function (){ + alert('网络超时,请检查您的网络设置!'); + } + }); + }; + + //旋转转盘 item:奖品位置; txt:提示语; + var rotateFn = function (item, txt){ + var angles = item * (360 / turnplate.restaraunts.length) - (360 / (turnplate.restaraunts.length*2)); + if(angles<270){ + angles = 270 - angles; + }else{ + angles = 360 - angles + 270; + } + $('#wheelcanvas').stopRotate(); + $('#wheelcanvas').rotate({ + angle:0, + animateTo:angles+1800, + duration:8000, + callback:function (){ + $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") + $("span[name='aaa']").removeClass("stop") + //抽签完成后左侧表格点击事件 + $("span[name='aaa']").on("click",function(){ + + if($(this).html().substring(0,4)=="钦州支队"){ + console.log(turnplate.startAngle) + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "龙城地下商业街(模板)", "钦州吾悦广场","广西东油沥青有限公司"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=6 + //turnplate.startAngle=3 + if(window.localStorage["钦州支队场次"]==undefined) + { + turnplate.startAngle=0 + $("#endjieguo span").eq(7).html("") + $('.pointer').removeClass("stop") + }else{ + if(item==2){ + if(window.localStorage["钦州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["钦州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + }else if(item==1){ + if(window.localStorage["钦州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["钦州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + } + + $('.pointer').addClass("stop") + $("#endjieguo span").eq(7).html(window.localStorage["钦州支队场次"]) + //$("#endjieguo").append("
"+"您的抽签结果为:
"+window.localStorage["0"]+"
") + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="南宁支队场次") + { + /* turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) ","九洲国际"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=0 + if(window.localStorage["南宁支队场次"]==undefined) + { + turnplate.startAngle=0 + $("#endjieguo span").eq(1).html("") + $('.pointer').removeClass("stop") + }else{ + if(item==2){ + //if(window.localStorage["0"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["南宁支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["南宁支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["0"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["0"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["南宁支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["南宁支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["0"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(1).html(window.localStorage["南宁支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="柳州支队场次") + { + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "龙城地下商业街", "板栗园加气站 ","柳州万达广场"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=1 + if(window.localStorage["柳州支队场次"]==undefined) + { + turnplate.startAngle=0 + $("#endjieguo span").eq(2).html("") + $('.pointer').removeClass("stop") + }else{ + if(item==2){ + //if(window.localStorage["1"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["柳州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["柳州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1} + //if(window.localStorage["1"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["1"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["柳州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["柳州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["1"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(2).html(window.localStorage["柳州支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="河池支队场次") + { + /* turnplate.restaraunts = ["地王国际财富中心(模板)","广西河池市大洋购物中心", "河池市宜州区地下商业街", "河池市中石化金城江油库 "]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=11 + if(window.localStorage["河池支队场次"]==undefined) + { + turnplate.startAngle=0 + $("#endjieguo span").eq(12).html("") + $('.pointer').removeClass("stop") + }else{ + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["河池支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["河池支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["河池支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["河池支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(12).html(window.localStorage["河池支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="来宾支队") + { + /* turnplate.restaraunts = ["来宾饭店","来宾市方盛广场", "宝晨化工", "天成百货"]; + turnplate.colors = ["#FFEBEA", "#FF7245","#FFEBEA", "#FF7245"]; */ + num=12 + if(window.localStorage["来宾支队场次"]==undefined) + { + $("#endjieguo span").eq(13).html("") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + }else{ + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["来宾支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["来宾支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["来宾支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["来宾支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(13).html(window.localStorage["来宾支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="贺州支队") + { + /* turnplate.restaraunts = ["远东国贸地下停车场", "宝晨化工有限公司", "贺州市南宁百货大楼", "贺州市国际酒店"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=10 + if(window.localStorage["贺州支队场次"]==undefined) + { + $("#endjieguo span").eq(11).html("") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + }else{ + //turnplate.startAngle=5.48 + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["贺州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["贺州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["贺州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["贺州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(11).html(window.localStorage["贺州支队场次"]) + } + drawRouletteWheel() + } + else if($(this).html().substring(0,5)=="防城港支队") + { + /* turnplate.restaraunts = ["港宸国际大酒店", "钦州吾悦广场(模板)", "龙城地下商业街(模板)", "广西中油能源有限公司 "]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=5 + if(window.localStorage["防城港支队场次"]==undefined) + { + $("#endjieguo span").eq(6).html("") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + }else{ + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["防城港支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["防城港支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["防城港支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["防城港支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(6).html(window.localStorage["防城港支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="崇左支队") + { + /* turnplate.restaraunts = ["钦州吾悦广场(模板)","龙城地下商业街(模板)","地王国际财富中心(模板)","崇左油库"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=13 + if(window.localStorage["崇左支队场次"]==undefined) + { + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(14).html("") + }else{ + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["崇左支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["崇左支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["崇左支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["崇左支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(14).html(window.localStorage["崇左支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="贵港支队") + { + /* turnplate.restaraunts = ["钦州吾悦广场(模板)", "平南中心购物广场", "贵港市中国石油分公司油库", "维多利亚酒店"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + console.log(111) + num=7 + if(window.localStorage["贵港支队场次"]==undefined) + { + console.log(111) + $("#endjieguo span").eq(8).html("") + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + }else{ + console.log(11) + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["贵港支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["贵港支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["贵港支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["贵港支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $("#endjieguo span").eq(8).html(window.localStorage["贵港支队场次"]) + $('.pointer').addClass("stop") + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="梧州支队") + { + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "钦州吾悦广场(模板)", "龙城地下商业街(模板)", "梧州市中石化火山油库" ]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=3 + if(window.localStorage["梧州支队场次"]==undefined) + { + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(4).html("") + }else{ + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["梧州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["梧州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["梧州支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["梧州支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(4).html(window.localStorage["梧州支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="百色支队") + { + /* turnplate.restaraunts = ["安达曼国际酒店", "恒宁城市广场", "三雷油库", "平果地下商业街"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=9 + if(window.localStorage["百色支队场次"]==undefined) + { + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(10).html() + }else{ + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["百色支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["百色支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["百色支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["百色支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + //console.log(window.localStorage["10"]==turnplate.restaraunts[3]) + $('.pointer').addClass("stop") + $("#endjieguo span").eq(10).html(window.localStorage["百色支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="玉林支队") + { + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) "]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=8 + if(window.localStorage["玉林支队场次"]==undefined) + { + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(9).html("") + }else{ + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["玉林支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["玉林支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["玉林支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["玉林支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(9).html(window.localStorage["玉林支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="北海支队") + { + //console.log(turnplate.startAngle) + /* turnplate.restaraunts = ["地王国际财富中心(模板)", "龙城地下商业街(模板)", "和安宁春城","广西东油沥青有限公司(模板)"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=4 + if(window.localStorage["北海支队场次"]==undefined) + { + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(5).html("") + }else{ + $('.pointer').addClass("stop") + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["北海支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["北海支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["北海支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["北海支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + + $("#endjieguo span").eq(5).html(window.localStorage["北海支队场次"]) + } + drawRouletteWheel() + }else if($(this).html().substring(0,4)=="桂林支队") + { + /* turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)","兴安油库","宏谋酒店"]; + turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; */ + num=2 + if(window.localStorage["桂林支队场次"]==undefined) + { + turnplate.startAngle=0 + $('.pointer').removeClass("stop") + $("#endjieguo span").eq(3).html("") + }else{ + if(item==2){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=3.2} + if(window.localStorage["桂林支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=0} + if(window.localStorage["桂林支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=1.5} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=4.7} + }else if(item==1){ + //if(window.localStorage["11"]==turnplate.restaraunts[3]){turnplate.startAngle=1.5} + if(window.localStorage["桂林支队场次"]==turnplate.restaraunts[0]){turnplate.startAngle=4.7} + if(window.localStorage["桂林支队场次"]==turnplate.restaraunts[1]){turnplate.startAngle=0} + //if(window.localStorage["11"]==turnplate.restaraunts[2]){turnplate.startAngle=3.2} + } + $('.pointer').addClass("stop") + $("#endjieguo span").eq(3).html(window.localStorage["桂林支队场次"]) + } + drawRouletteWheel() + } + + + }); + //console.log(turnplate.startAngle) + var zhuanpan=document.getElementById("zhuanpan") + var con1=document.getElementById("con1") + var dataLength=turnplate.restaraunts.length + //往localStorage里面写入数据 + if(num==0){ + window.localStorage.setItem( "南宁支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(1).html(window.localStorage["南宁支队场次"]) + $("#chooseZhi img").eq(0).show() + $('.pointer').addClass("stop") + }else if(num==1){ + window.localStorage.setItem( "柳州支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(2).html(window.localStorage["柳州支队场次"]) + $("#chooseZhi img").eq(1).show() + $('.pointer').addClass("stop") + }else if(num==2){ + window.localStorage.setItem( "桂林支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(3).html(window.localStorage["桂林支队场次"]) + $("#chooseZhi img").eq(2).show() + $('.pointer').addClass("stop") + }else if(num==3){ + window.localStorage.setItem( "梧州支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(4).html(window.localStorage["梧州支队场次"]) + $("#chooseZhi img").eq(3).show() + $('.pointer').addClass("stop") + } + else if(num==4){ + window.localStorage.setItem( "北海支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(5).html(window.localStorage["北海支队场次"]) + $("#chooseZhi img").eq(4).show() + $('.pointer').addClass("stop") + }else if(num==5){ + window.localStorage.setItem( "防城港支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(6).html(window.localStorage["防城港支队场次"]) + $("#chooseZhi img").eq(5).show() + $('.pointer').addClass("stop") + }else if(num==6){ + window.localStorage.setItem( "钦州支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(7).html(window.localStorage["钦州支队场次"]) + $("#chooseZhi img").eq(6).show() + $('.pointer').addClass("stop") + }else if(num==7){ + window.localStorage.setItem( "贵港支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(8).html(window.localStorage["贵港支队场次"]) + $("#chooseZhi img").eq(7).show() + $('.pointer').addClass("stop") + }else if(num==8){ + window.localStorage.setItem( "玉林支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(9).html(window.localStorage["玉林支队场次"]) + $("#chooseZhi img").eq(8).show() + $('.pointer').addClass("stop") + }else if(num==9){ + window.localStorage.setItem( "百色支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(10).html(window.localStorage["百色支队场次"]) + $("#chooseZhi img").eq(9).show() + $('.pointer').addClass("stop") + }else if(num==10){ + window.localStorage.setItem( "贺州支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(11).html(window.localStorage["贺州支队场次"]) + $("#chooseZhi img").eq(10).show() + $('.pointer').addClass("stop") + }else if(num==11){ + window.localStorage.setItem( "河池支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(12).html(window.localStorage["河池支队场次"]) + $("#chooseZhi img").eq(11).show() + $('.pointer').addClass("stop") + }else if(num==12){ + window.localStorage.setItem( "来宾支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(13).html(window.localStorage["来宾支队场次"]) + $("#chooseZhi img").eq(12).show() + $('.pointer').addClass("stop") + }else if(num==13){ + window.localStorage.setItem( "崇左支队场次", turnplate.restaraunts[item-1]); + $("#endjieguo span").eq(14).html(window.localStorage["崇左支队场次"]) + $("#chooseZhi img").eq(13).show() + $('.pointer').addClass("stop") + } + turnplate.bRotate = !turnplate.bRotate; + turnplate.startAngle=0 + } + }); + }; + + $('.pointer').click(function (){ + $("span[name='aaa']").addClass("stop") + if(turnplate.bRotate)return; + turnplate.bRotate = !turnplate.bRotate; + //获取随机数(奖品个数范围内) + var item=Math.floor(Math.random()*(2+1-1)+1); + /* if(num==0||num==3||num==8||num==13||num==14||num==17||num==22||num==27) + { + item=Math.floor(Math.random()*(4+1-1)+1); + }else if(num==1||num==11||num==15||num==25){ + item=Math.floor(Math.random()*(2+1-1)+1); + } + else{ + item=rnd(1,turnplate.restaraunts.length); + } */ + console.log(item) + //奖品数量等于10,指针落在对应奖品区域的中心角度[252, 216, 180, 144, 108, 72, 36, 360, 324, 288] + rotateFn(item, turnplate.restaraunts[item-1]); + /* switch (item) { + case 1: + rotateFn(252, turnplate.restaraunts[0]); + break; + case 2: + rotateFn(216, turnplate.restaraunts[1]); + break; + case 3: + rotateFn(180, turnplate.restaraunts[2]); + break; + case 4: + rotateFn(144, turnplate.restaraunts[3]); + break; + case 5: + rotateFn(108, turnplate.restaraunts[4]); + break; + case 6: + rotateFn(72, turnplate.restaraunts[5]); + break; + case 7: + rotateFn(36, turnplate.restaraunts[6]); + break; + case 8: + rotateFn(360, turnplate.restaraunts[7]); + break; + case 9: + rotateFn(324, turnplate.restaraunts[8]); + break; + case 10: + rotateFn(288, turnplate.restaraunts[9]); + break; + } */ + console.log(item); + }); + }); + + //控制中奖结果 + function rnd(n, m){ + var random = 4; + //var random = Math.floor(Math.random()*(m-n+1)+n); + return random; + + } + + + //页面所有元素加载完毕后执行drawRouletteWheel()方法对转盘进行渲染 + window.onload=function(){ + drawRouletteWheel(); + }; + + function drawRouletteWheel() { + var canvas = document.getElementById("wheelcanvas"); + if (canvas.getContext) { + //根据奖品个数计算圆周角度 + var arc = Math.PI / (turnplate.restaraunts.length/2); + var ctx = canvas.getContext("2d"); + //在给定矩形内清空一个矩形 + ctx.clearRect(0,0,422,422); + //strokeStyle 属性设置或返回用于笔触的颜色、渐变或模式 + ctx.strokeStyle = "#FFBE04"; + //font 属性设置或返回画布上文本内容的当前字体属性 + ctx.font = '18px Microsoft YaHei'; + for(var i = 0; i < turnplate.restaraunts.length; i++) { + var angle = turnplate.startAngle + i * arc; + ctx.fillStyle = turnplate.colors[i]; + ctx.beginPath(); + //arc(x,y,r,起始角,结束角,绘制方向) 方法创建弧/曲线(用于创建圆或部分圆) + ctx.arc(211, 211, turnplate.outsideRadius, angle, angle + arc, false); + ctx.arc(211, 211, turnplate.insideRadius, angle + arc, angle, true); + ctx.stroke(); + ctx.fill(); + //锁画布(为了保存之前的画布状态) + ctx.save(); + + //----绘制奖品开始---- + //ctx.fillStyle = "#E5302F"; + if(turnplate.colors[i]=="#FFEBEA"){ctx.fillStyle = "#ff4d29"} + else{ctx.fillStyle = "#FFF"} + /* for(var i=0;i<4;i++){ + console.log() + if(turnplate.colors[i]=="#FFEBEA"){ctx.fillStyle = "#FFF"} + else{ctx.fillStyle = "#E5302F"} + } */ + //ctx.fillStyle = "#FFF"; + var text = turnplate.restaraunts[i]; + var line_height = 17; + //translate方法重新映射画布上的 (0,0) 位置 + ctx.translate(211 + Math.cos(angle + arc / 2) * turnplate.textRadius, 211 + Math.sin(angle + arc / 2) * turnplate.textRadius); + + //rotate方法旋转当前的绘图 + ctx.rotate(angle + arc / 2 + Math.PI / 2); + + /** 下面代码根据奖品类型、奖品名称长度渲染不同效果,如字体、颜色、图片效果。(具体根据实际情况改变) **/ + if(text.indexOf("M")>0){//流量包 + var texts = text.split("M"); + for(var j = 0; j6){//奖品名称长度超过一定范围 + text = text.substring(0,6)+"||"+text.substring(6); + var texts = text.split("||"); + for(var j = 0; j0){ + var img= document.getElementById("shan-img"); + img.onload=function(){ + ctx.drawImage(img,-15,10); + }; + ctx.drawImage(img,-15,10); + }else if(text.indexOf("谢谢参与")>=0){ + var img= document.getElementById("sorry-img"); + img.onload=function(){ + ctx.drawImage(img,-15,10); + }; + ctx.drawImage(img,-15,10); + } + //把当前画布返回(调整)到上一个save()状态之前 + ctx.restore(); + //----绘制奖品结束---- + } + } + } +