日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

html转盘游戏,html5大转盘抽奖实例源码(基于vue.js)

發布時間:2023/12/19 vue 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html转盘游戏,html5大转盘抽奖实例源码(基于vue.js) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

【實例簡介】

【調試步驟】

# 安裝依賴

npm install

# 開啟本地服務器localhost:8088

npm run dev

# 發布環境

npm run build

#然后靜待你的瀏覽器打開一個網頁,按F12 進入手機模擬器,查看效果最佳(推薦chrome瀏覽器,前端開發者的必備)

【實例截圖】

【核心代碼】

{{item.count}}

{{item.name}}

今日免費抽獎次數: {{ lottery_ticket}}活動規則

1.每日簽到后,即可獲得一次幸運大轉盤的機會,僅限當天有效,過期作廢。 2.金幣抽獎,每10個金豆可兌換一次大轉盤機會。

2.金幣抽獎,每10個金豆可以兌換一次大轉盤抽獎機會

3.所中金豆或積分到【我的賬戶】中查詢。累計達到100金豆及以上,可以兌換相應獎品

{{toast_title}}

關閉

export default {

data() {

return {

easejoy_bean: 0, //金豆

lottery_ticket: 0, //抽獎次數

prize_list: [

{

icon: require("../assets/img/bean_500.png"), // 獎品圖片

count: 10, // 獎品數量

name: "易趣豆", // 獎品名稱

isPrize: 1 // 該獎項是否為獎品

},

{

icon: require("../assets/img/bean_five.png"),

count: 5,

name: "豆",

isPrize: 1

},

{

icon: require("../assets/img/bean_one.png"),

count: 10,

name: "易趣豆",

isPrize: 1

},

{

icon: require("../assets/img/point_five.png"),

count: 5,

name: "積分",

isPrize: 1

},

{

icon: require("../assets/img/point_ten.png"),

count: 10,

name: "積分",

isPrize: 1

},

{

icon: require("../assets/img/bean_500.png"),

count: 10,

name: "易趣豆",

isPrize: 1

},

{

icon: require("../assets/img/give_up.png"),

count: 0,

name: "未中獎",

isPrize: 0

},

{

icon: require("../assets/img/bean_500.png"),

count: 10,

name: "易趣豆",

isPrize: 1

}

], //獎品列表

toast_control: false, //抽獎結果彈出框控制器

hasPrize: false, //是否中獎

start_rotating_degree: 0, //初始旋轉角度

rotate_angle: 0, //將要旋轉的角度

start_rotating_degree_pointer: 0, //指針初始旋轉角度

rotate_angle_pointer: 0, //指針將要旋轉的度數

rotate_transition: "transform 6s ease-in-out", //初始化選中的過度屬性控制

rotate_transition_pointer: "transform 12s ease-in-out", //初始化指針過度屬性控制

click_flag: true, //是否可以旋轉抽獎

index: 0

};

},

created() {

this.init_prize_list();

},

computed: {

toast_title() {

return this.hasPrize

? "恭喜您,獲得" this.prize_list[this.index].count ' ' this.prize_list[this.index].name

: "未中獎";

},

toast_pictrue() {

return this.hasPrize

? require("../assets/img/congratulation.png")

: require("../assets/img/sorry.png");

}

},

methods: {

//此方法為處理獎品數據

init_prize_list(list) {},

rotate_handle() {

this.index = 1 //指定每次旋轉到的獎品下標

this.rotating();

},

rotating() {

if (!this.click_flag) return;

var type = 0; // 默認為 0 轉盤轉動 1 箭頭和轉盤都轉動(暫且遺留)

var during_time = 5; // 默認為1s

var random = Math.floor(Math.random() * 7);

var result_index = this.index ; // 最終要旋轉到哪一塊,對應prize_list的下標

var result_angle = [337.5, 292.5, 247.5, 202.5, 157.5, 112.5, 67.5, 22.5]; //最終會旋轉到下標的位置所需要的度數

var rand_circle = 6; // 附加多轉幾圈,2-3

this.click_flag = false; // 旋轉結束前,不允許再次觸發

if (type == 0) {

// 轉動盤子

var rotate_angle =

this.start_rotating_degree

rand_circle * 360

result_angle[result_index] -

this.start_rotating_degree % 360;

this.start_rotating_degree = rotate_angle;

this.rotate_angle = "rotate(" rotate_angle "deg)";

// // //轉動指針

// this.rotate_angle_pointer = "rotate(" this.start_rotating_degree_pointer 360*rand_circle "deg)";

// this.start_rotating_degree_pointer =360*rand_circle;

var that = this;

// 旋轉結束后,允許再次觸發

setTimeout(function() {

that.click_flag = true;

that.game_over();

}, during_time * 1000 1500); // 延時,保證轉盤轉完

} else {

//

}

},

game_over() {

this.toast_control = true;

this.hasPrize = this.prize_list[this.index].isPrize

},

//關閉彈窗

close_toast() {

this.toast_control = false;

}

}

};

.container {

width: 100%;

}

.lucky-wheel {

width: 100%;

height: 31.5625rem;

background: rgb(252, 207, 133) url("../assets/img/color_pillar.png") no-repeat

center bottom;

background-size: 100%;

padding-top: 1.5625rem;

}

.lucky-title {

width: 100%;

height: 8.125rem;

background: url("../assets/img/lucky_title.png") no-repeat center top;

background-size: 100%;

}

.wheel-main {

display: flex;

align-items: center;

justify-content: center;

position: relative;

}

.wheel-bg {

width: 18.4375rem;

height: 18.4375rem;

background: url("../assets/img/draw_wheel.png") no-repeat center top;

background-size: 100%;

color: #fff;

font-weight: 500;

display: flex;

flex-direction: column;

justify-content: center;

align-content: center;

transition: transform 3s ease;

}

.wheel-pointer-box {

position: absolute;

top: 50%;

left: 50%;

z-index: 100;

transform: translate(-50%, -60%);

width: 5.3125rem;

height: 5.3125rem;

}

.wheel-pointer {

width: 5.3125rem;

height: 5.3125rem;

background: url("../assets/img/draw_btn.png") no-repeat center top;

background-size: 100%;

transform-origin: center 60%;

}

.wheel-bg div {

text-align: center;

}

.prize-list {

width: 100%;

height: 100%;

position: relative;

}

.prize-list .prize-item {

position: absolute;

top: 0;

left: 0;

z-index: 2;

}

.prize-list .prize-item:first-child {

top: 0;

left: 8.3125rem;

transform: rotate(20deg);

}

.prize-list .prize-item:nth-child(2) {

top: 2.8rem;

left: 10.8rem;

transform: rotate(67deg);

}

.prize-list .prize-item:nth-child(3) {

top: 6.4rem;

left: 10.6rem;

transform: rotate(-250deg);

}

.prize-list .prize-item:nth-child(4) {

top: 9rem;

left: 8.2125rem;

transform: rotate(-210deg);

}

.prize-list .prize-item:nth-child(5) {

top: 9.2125rem;

left: 4.4rem;

transform: rotate(-160deg);

}

.prize-list .prize-item:nth-child(6) {

top: 6.3875rem;

left: 1.9rem;

transform: rotate(-111deg);

}

.prize-list .prize-item:nth-child(7) {

top: 2.8rem;

left: 1.8125rem;

transform: rotate(-69deg);

}

.prize-list .prize-item:nth-child(8) {

top: 0;

left: 4.5rem;

transform: rotate(-20deg);

}

.prize-item {

width: 5.875rem;

height: 9rem;

}

.prize-pic img {

width: 4.0625rem;

height: 2.5rem;

margin-top: 1.5625rem;

}

.prize-count {

font-size: 0.875rem;

}

.prize-type {

font-size: 0.75rem;

}

.main {

position: relative;

width: 100%;

min-height: 14.25rem;

background: rgb(243, 109, 86);

padding-bottom: 1.6875rem;

}

.main-bg {

width: 100%;

height: 6.5625rem;

position: absolute;

top: -3.4375rem;

left: 0;

background: url("../assets/img/luck_bg.png") no-repeat center top;

background-size: 100%;

}

.bg-p {

width: 100%;

height: 2.95rem;

background: rgb(252, 207, 133);

}

.content {

position: absolute;

top: 0.175rem;

left: 0;

background: rgb(243, 109, 86);

width: 100%;

height: 5.1875rem;

font-size: 1.125rem;

color: #ffeb39;

padding-left: 6.75rem;

}

.content div {

text-align: left;

}

.tip {

position: relative;

margin: 2.5rem auto 0;

width: 17.5rem;

border: 1px solid #fbc27f;

}

.tip-title {

position: absolute;

top: -1rem;

left: 50%;

transform: translate(-50%, 0);

font-size: 1rem;

color: #fccc6e;

background: rgb(243, 109, 86);

padding: 0.3125rem 0.625rem;

}

.tip-content {

padding: 1.5625rem 0.625rem;

font-size: 0.875rem;

color: #fff8c5;

line-height: 1.5;

}

.toast-mask {

position: fixed;

top: 0;

left: 0;

background: rgba(0, 0, 0, 0.6);

z-index: 10000;

width: 100%;

height: 100%;

}

.toast {

position: fixed;

top: 50%;

left: 50%;

z-index: 20000;

transform: translate(-50%, -50%);

width: 15.4375rem;

background: #fff;

border-radius: 0.3125rem;

padding: 0.3125rem;

background-color: rgb(252, 244, 224);

}

.toast-container {

position: relative;

width: 100%;

height: 100%;

border: 1px dotted #fccc6e;

}

.toast-picture {

position: absolute;

top: -6.5rem;

left: -1.5rem;

width: 18.75rem;

height: 8.5625rem;

}

.toast-pictrue-change {

position: absolute;

top: -1.5rem;

left: -1.375rem;

width: 17.5rem;

height: 3.125rem;

}

.toast-title {

padding: 2.8125rem 0;

font-size: 18px;

color: #fc7939;

text-align: center;

}

.toast-btn {

display: flex;

align-items: center;

justify-content: center;

margin-bottom: 0.9375rem;

}

.toast-btn div {

background-image: -moz-linear-gradient(

-18deg,

rgb(242, 148, 85) 0%,

rgb(252, 124, 88) 51%,

rgb(252, 124, 88) 99%

);

background-image: -ms-linear-gradient(

-18deg,

rgb(242, 148, 85) 0%,

rgb(252, 124, 88) 51%,

rgb(252, 124, 88) 99%

);

background-image: -webkit-linear-gradient(

-18deg,

rgb(242, 148, 85) 0%,

rgb(252, 124, 88) 51%,

rgb(252, 124, 88) 99%

);

box-shadow: 0px 4px 0px 0px rgba(174, 34, 5, 0.7);

width: 4.6875rem;

height: 1.875rem;

border-radius: 1.875rem;

text-align: center;

line-height: 1.875rem;

color: #fff;

}

.close {

position: absolute;

top: -0.9375rem;

right: -0.9375rem;

width: 2rem;

height: 2rem;

background: url("../assets/img/close_store.png") no-repeat center top;

background-size: 100%;

}

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的html转盘游戏,html5大转盘抽奖实例源码(基于vue.js)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。