Browse Source

[修改]重置左右按键代表不同功能

master
chenjingyu 4 years ago
parent
commit
92fc11d4a7
  1. 4
      src/app/ui/luck-draw/luck-draw.component.html
  2. 3
      src/app/ui/reset/reset.component.ts
  3. 26
      src/assets/js/zhuanpan.js

4
src/app/ui/luck-draw/luck-draw.component.html

@ -4,7 +4,7 @@
* @Author: sueRimn * @Author: sueRimn
* @Date: 2020-09-25 08:48:50 * @Date: 2020-09-25 08:48:50
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2020-10-18 10:41:21 * @LastEditTime: 2020-10-18 14:09:42
--> -->
<html> <html>
@ -50,7 +50,7 @@
</div> </div>
</div> </div>
<div class="chongzhi" style="height: 20%;"><button type="button" (click)="nextStep()" class="button">下一步</button></div> <div class="chongzhi" style="height: 20%;display: none;"><button type="button" (click)="nextStep()" class="button">下一步</button></div>
</div> </div>

3
src/app/ui/reset/reset.component.ts

@ -4,9 +4,10 @@
* @Author: sueRimn * @Author: sueRimn
* @Date: 2020-10-07 15:38:37 * @Date: 2020-10-07 15:38:37
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2020-10-14 09:17:22 * @LastEditTime: 2020-10-18 13:28:58
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import '../../../assets/js/zhuanpan'
@Component({ @Component({
selector: 'app-reset', selector: 'app-reset',

26
src/assets/js/zhuanpan.js

@ -17,12 +17,20 @@ function chongzhi(){
$(document).ready(function(){ $(document).ready(function(){
console.log(url) console.log(url)
if(url=="twoStep"){ if(url=="twoStep"||url=="Reset"){
$('.chongzhi').addClass("stop") //$('.chongzhi').addClass("stop")
$("#Reset").on("click",function(){ $("#Reset").on("click",function(){
drawRouletteWheel() drawRouletteWheel()
$("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png") $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png")
localStorage.clear(); localStorage.clear();
localStorage.setItem("Luckdraw","succed")
$('.pointer').removeClass("stop")
})
$("#Reset").on("contextmenu",function(){
drawRouletteWheel()
$("#clickButton").attr("src", "../../../assets/images/turnplate-pointer.png")
localStorage.clear();
localStorage.removeItem("Luckdraw")
$('.pointer').removeClass("stop") $('.pointer').removeClass("stop")
}) })
for(var i=0;i<14;i++){ for(var i=0;i<14;i++){
@ -80,7 +88,7 @@ $(document).ready(function(){
drawRouletteWheel() drawRouletteWheel()
}else if($(this).html().substring(0,4)=="南宁支队") }else if($(this).html().substring(0,4)=="南宁支队")
{ {
turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) ","地王财富中心(模板)"]; turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)","地王财富中心(模板)", "兴安油库(模板)"];
turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"];
num=0 num=0
if(window.localStorage["0"]==undefined) if(window.localStorage["0"]==undefined)
@ -625,6 +633,7 @@ $(document).ready(function(){
$("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png") $("#clickButton").attr("src", "../../../assets/images/turnplate-pointer-hui.png")
$("span[name='aaachen']").removeClass("stop") $("span[name='aaachen']").removeClass("stop")
$('.chongzhi').removeClass("stop") $('.chongzhi').removeClass("stop")
$('.chongzhi').show()
//抽签完成后左侧表格点击事件 //抽签完成后左侧表格点击事件
$("span[name='aaachen']").on("click",function(){ $("span[name='aaachen']").on("click",function(){
@ -669,7 +678,7 @@ $(document).ready(function(){
drawRouletteWheel() drawRouletteWheel()
}else if($(this).html().substring(0,4)=="南宁支队") }else if($(this).html().substring(0,4)=="南宁支队")
{ {
turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)", "兴安油库(模板) ","地王财富中心(模板)"]; turnplate.restaraunts = ["钦州吾悦广场(模板)", "龙城地下商业街(模板)","地王财富中心(模板)", "兴安油库(模板) "];
turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"]; turnplate.colors = ["#FFEBEA", "#FF7245", "#FFEBEA", "#FF7245"];
num=0 num=0
if(window.localStorage["0"]==undefined) if(window.localStorage["0"]==undefined)
@ -1304,17 +1313,20 @@ $(document).ready(function(){
turnplate.bRotate = !turnplate.bRotate; turnplate.bRotate = !turnplate.bRotate;
//获取随机数(奖品个数范围内) //获取随机数(奖品个数范围内)
var item var item
if(num==0||num==3||num==8||num==13||num==14||num==17||num==22||num==27) if(window.localStorage["Luckdraw"]=="succed"){
if(num==3||num==8||num==13)
{ {
item=Math.floor(Math.random()*(4+1-1)+1); item=Math.floor(Math.random()*(4+1-1)+1);
}else if(num==1||num==11||num==15||num==25){ }else if(num==1||num==11||num==15||num==25){
item=Math.floor(Math.random()*(2+1-1)+1); item=Math.floor(Math.random()*(2+1-1)+1);
}/* else if(num==12){ } else if(num==0){
item=Math.floor(Math.random()*(3+1-1)+1); item=Math.floor(Math.random()*(3+1-1)+1);
} */ }
else{ else{
item=rnd(1,turnplate.restaraunts.length); item=rnd(1,turnplate.restaraunts.length);
} }
}else{item=Math.floor(Math.random()*(4+1-1)+1);}
console.log(item) console.log(item)
//奖品数量等于10,指针落在对应奖品区域的中心角度[252, 216, 180, 144, 108, 72, 36, 360, 324, 288] //奖品数量等于10,指针落在对应奖品区域的中心角度[252, 216, 180, 144, 108, 72, 36, 360, 324, 288]
rotateFn(item, turnplate.restaraunts[item-1]); rotateFn(item, turnplate.restaraunts[item-1]);

Loading…
Cancel
Save