9
src/app.config.js
Normal file
@@ -0,0 +1,9 @@
|
||||
export default defineAppConfig({
|
||||
pages: ["pages/aoshi/index", "pages/aoshi/records/index"],
|
||||
window: {
|
||||
backgroundTextStyle: "light",
|
||||
navigationBarBackgroundColor: "#fff",
|
||||
navigationBarTitleText: "澳拾幸运大转盘",
|
||||
navigationBarTextStyle: "black",
|
||||
},
|
||||
});
|
||||
13
src/app.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { createApp } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import "./app.scss";
|
||||
|
||||
const App = createApp({
|
||||
onLaunch({ query }) {
|
||||
Taro.setStorageSync("uid", query.uid);
|
||||
Taro.setStorageSync("id", query.id);
|
||||
},
|
||||
onShow(options) {},
|
||||
});
|
||||
|
||||
export default App;
|
||||
0
src/app.scss
Normal file
35
src/components/Popup.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<view class="mask" v-if="show" @click="isShowFn">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(["isShow"]);
|
||||
|
||||
const isShowFn = () => {
|
||||
emits("isShow");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
22
src/index.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
||||
<meta
|
||||
content="width=device-width,initial-scale=1,user-scalable=no"
|
||||
name="viewport"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-touch-fullscreen" content="yes" />
|
||||
<meta name="format-detection" content="telephone=no,address=no" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="white" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<title>jdt-aoshi</title>
|
||||
<script>
|
||||
<%= htmlWebpackPlugin.options.script %>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
3
src/pages/aoshi/index/index.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "澳拾幸运大转盘",
|
||||
});
|
||||
567
src/pages/aoshi/index/index.scss
Normal file
@@ -0,0 +1,567 @@
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.page {
|
||||
background-image: url("../../../static/bg.png");
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
height: 100dvh;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
.header {
|
||||
margin-top: 30px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.left-box {
|
||||
width: 378px;
|
||||
height: 40px;
|
||||
background: linear-gradient(90deg, #d19116 65%, #330706 95%);
|
||||
|
||||
.text {
|
||||
background: linear-gradient(180deg, #fffccd 0%, #ffe08e 100%);
|
||||
-webkit-background-clip: text;
|
||||
color: transparent;
|
||||
font-size: 25px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.right-box {
|
||||
display: flex;
|
||||
|
||||
.btn {
|
||||
background-size: 100% 100%;
|
||||
width: 149px;
|
||||
height: 46px;
|
||||
|
||||
&:active {
|
||||
animation: btnClick 0.1s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
.tz-btn {
|
||||
background-image: url("../../../static/tz_btn.png");
|
||||
transform-origin: center center;
|
||||
}
|
||||
|
||||
.kj-btn {
|
||||
background-image: url("../../../static/kj_btn.png");
|
||||
transform-origin: center center;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.user-box {
|
||||
width: 646px;
|
||||
height: 115px;
|
||||
background: rgba(98, 98, 98, 0.3);
|
||||
border-radius: 30px;
|
||||
margin: 35px auto;
|
||||
position: relative;
|
||||
backdrop-filter: blur(10px);
|
||||
|
||||
.avatar-box {
|
||||
position: absolute;
|
||||
left: -5%;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
|
||||
.bg {
|
||||
background-image: url("../../../static/avatar_border.png");
|
||||
background-size: 100% 100%;
|
||||
border-radius: 50%;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
animation: bgRevolve 10s linear infinite;
|
||||
transform-origin: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
position: absolute;
|
||||
width: 92px;
|
||||
height: 92px;
|
||||
border-radius: 50%;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.user-info {
|
||||
position: absolute;
|
||||
left: 100px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: linear-gradient(180deg, #fffccd 0%, #ffe08e 100%);
|
||||
-webkit-background-clip: text;
|
||||
color: transparent;
|
||||
|
||||
.name {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.jf {
|
||||
margin-top: 20px;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.dz-box {
|
||||
position: absolute;
|
||||
right: 160px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.dz-bg {
|
||||
background-image: url("../../../static/dz.png");
|
||||
background-size: 100% 100%;
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
.text {
|
||||
background: linear-gradient(180deg, #fffccd 0%, #ffe08e 100%);
|
||||
-webkit-background-clip: text;
|
||||
color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.rule-btn {
|
||||
position: absolute;
|
||||
right: -8%;
|
||||
top: 45%;
|
||||
transform: translateY(-50%);
|
||||
background-image: url("../../../static/rule_btn.png");
|
||||
background-size: 100% 100%;
|
||||
width: 173px;
|
||||
height: 176px;
|
||||
transform-origin: center center;
|
||||
|
||||
&:active {
|
||||
animation: ruleBtnClick 0.1s ease-in-out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.kj-box {
|
||||
text-align: center;
|
||||
margin-top: -10px;
|
||||
|
||||
.title {
|
||||
background: linear-gradient(180deg, #fffccd 0%, #ffe08e 100%);
|
||||
-webkit-background-clip: text;
|
||||
color: transparent;
|
||||
font-size: 40px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.num-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 10px;
|
||||
|
||||
.item {
|
||||
background-image: url("../../../static/num.png");
|
||||
background-size: 100% 100%;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
text-align: center;
|
||||
line-height: 72px;
|
||||
font-weight: bold;
|
||||
color: #b2150b;
|
||||
}
|
||||
|
||||
.item:nth-child(1) {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.item:nth-child(2) {
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.turntable-box {
|
||||
position: relative;
|
||||
height: 670px;
|
||||
overflow: hidden;
|
||||
|
||||
.star {
|
||||
position: absolute;
|
||||
animation: starFlashing 1s ease-in-out infinite alternate;
|
||||
}
|
||||
|
||||
.star-1 {
|
||||
left: 100px;
|
||||
width: 139px;
|
||||
height: 171px;
|
||||
background-image: url("../../../static/1-1.png");
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.star-2 {
|
||||
top: 100px;
|
||||
width: 205px;
|
||||
height: 251px;
|
||||
background-image: url("../../../static/1-2.png");
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.star-3 {
|
||||
right: 50px;
|
||||
width: 205px;
|
||||
height: 251px;
|
||||
background-image: url("../../../static/2-2.png");
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.star-4 {
|
||||
top: 200px;
|
||||
right: 0;
|
||||
width: 140px;
|
||||
height: 171px;
|
||||
background-image: url("../../../static/2-1.png");
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.turntable-wrap {
|
||||
background-image: url("../../../static/turntable_bg.png");
|
||||
background-size: 100% 100%;
|
||||
width: 650px;
|
||||
height: 650px;
|
||||
position: relative;
|
||||
border-radius: 50%;
|
||||
transform-origin: center center;
|
||||
left: 50%;
|
||||
top: 20px;
|
||||
transform: translateX(-50%);
|
||||
overflow: hidden;
|
||||
//animation: turntableRevolve 5s linear infinite;
|
||||
|
||||
.light {
|
||||
.lightItem {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 auto;
|
||||
width: 10px;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
transform-origin: center center;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 auto;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.lightItem:nth-of-type(even):before {
|
||||
background: transparent;
|
||||
animation: white-to-yellow 1.5s linear infinite;
|
||||
}
|
||||
|
||||
.lightItem:nth-of-type(odd):before {
|
||||
background: #fefc87;
|
||||
animation: white-to-yellow 1.5s linear reverse infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.turntable {
|
||||
position: absolute;
|
||||
width: 530px;
|
||||
height: 530px;
|
||||
border-radius: 50%;
|
||||
// background: url('../../../static/wu.png') no-repeat;
|
||||
// background-size: contain;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) rotate(-0.8deg);
|
||||
|
||||
.prize {
|
||||
position: absolute;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) rotate(-200deg);
|
||||
|
||||
.item {
|
||||
position: absolute;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border-radius: 50%;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
transform-origin: right bottom;
|
||||
|
||||
&:nth-child(1) {
|
||||
top: -10px;
|
||||
transform: rotate(70deg);
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
top: -10px;
|
||||
left: -10px;
|
||||
transform: rotate(-60deg);
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
transform: rotate(190deg);
|
||||
}
|
||||
|
||||
.img {
|
||||
display: block;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
transform: rotate(-45deg) scale(1.1);
|
||||
}
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
background-image: url("../../../static/dz.png");
|
||||
background-size: 100% 100%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
transform: rotate(-45deg) scale(1.6);
|
||||
top: -10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bet-btn {
|
||||
position: absolute;
|
||||
background-image: url("../../../static/bet_btn.png");
|
||||
background-size: 100% 100%;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
//&:active {
|
||||
// animation: betBtnClick .1s ease-in-out;
|
||||
//}
|
||||
}
|
||||
|
||||
.pointer {
|
||||
position: absolute;
|
||||
background-image: url("../../../static/pointer.png");
|
||||
background-size: 100% 100%;
|
||||
width: 47px;
|
||||
height: 111px;
|
||||
top: 15px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.countdown-box {
|
||||
margin-top: 30px;
|
||||
background-image: url("../../../static/countdown_bg.png");
|
||||
background-size: 100% 100%;
|
||||
width: 750px;
|
||||
height: 96px;
|
||||
text-align: center;
|
||||
line-height: 96px;
|
||||
|
||||
.title {
|
||||
font-size: 38px;
|
||||
font-weight: bold;
|
||||
color: #b81801;
|
||||
text-shadow: -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff,
|
||||
2px 2px 0 #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-box {
|
||||
width: 100%;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-gap: 10px;
|
||||
margin-top: 30px;
|
||||
|
||||
.item {
|
||||
background-size: 100% 100%;
|
||||
width: 220px;
|
||||
min-width: 220px;
|
||||
height: 75px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 10px auto;
|
||||
|
||||
.icon {
|
||||
background-image: url("../../../static/dz.png");
|
||||
background-size: 100% 100%;
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
margin: auto 15px;
|
||||
}
|
||||
|
||||
.name {
|
||||
background: linear-gradient(180deg, #fffccd 0%, #ffe08e 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-stroke: 2px #000;
|
||||
color: transparent;
|
||||
font-size: 40px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.item-active {
|
||||
background-image: url("../../../static/dz_active.png");
|
||||
}
|
||||
|
||||
.item-no-active {
|
||||
background-image: url("../../../static/dz_opt.png");
|
||||
}
|
||||
}
|
||||
|
||||
#lottie {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
|
||||
.lottie-text {
|
||||
position: absolute;
|
||||
top: 59%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
color: #b81801;
|
||||
text-shadow: -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff,
|
||||
2px 2px 0 #fff;
|
||||
font-size: 80px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.lottie-bg {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 5%;
|
||||
transform: translateX(-50%);
|
||||
background-image: url("../../../static/img_0.png");
|
||||
background-size: 100% 100%;
|
||||
// width: 700px;
|
||||
height: 300px;
|
||||
animation: lottie 0.3s linear forwards;
|
||||
text-align: center;
|
||||
line-height: 310px;
|
||||
overflow: hidden;
|
||||
|
||||
.lottie-num {
|
||||
color: #b81801;
|
||||
text-shadow: -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff,
|
||||
2px 2px 0 #fff;
|
||||
font-size: 60px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes btnClick {
|
||||
from {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes betBtnClick {
|
||||
from {
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translate(-50%, -50%) scale(1.1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes ruleBtnClick {
|
||||
from {
|
||||
transform: scale(1) translateY(-50%);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: scale(1.1) translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes bgRevolve {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes starFlashing {
|
||||
from {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes turntableRevolve {
|
||||
from {
|
||||
transform: translateX(-50%) rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: translateX(-50%) rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes white-to-yellow {
|
||||
0% {
|
||||
background: transparent;
|
||||
}
|
||||
100% {
|
||||
background: #fefc87;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes lottie {
|
||||
0% {
|
||||
width: 0;
|
||||
}
|
||||
100% {
|
||||
width: 700px;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
background-color: #fff;
|
||||
width: 70%;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
502
src/pages/aoshi/index/index.vue
Normal file
@@ -0,0 +1,502 @@
|
||||
<script setup>
|
||||
import { onBeforeUnmount, onMounted, ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import Lottie from "lottie-web";
|
||||
import HPopup from "../../../components/Popup.vue";
|
||||
import * as dayjs from "dayjs";
|
||||
import dan from "../../../static/dan.png";
|
||||
import he from "../../../static/he.png";
|
||||
import shuang from "../../../static/shuang.png";
|
||||
import kd from "../../../static/kd.png";
|
||||
import kh from "../../../static/kh.png";
|
||||
import ks from "../../../static/ks.png";
|
||||
import wu from "../../../static/wu.png";
|
||||
import wzj from "../../../static/wzj.json";
|
||||
import zj from "../../../static/zj.json";
|
||||
import "./index.scss";
|
||||
|
||||
Taro.useDidShow(() => {
|
||||
startMusic(
|
||||
"https://files.wanzhuanyongcheng.com/file/music/yaotouzi/3.mp3",
|
||||
true
|
||||
);
|
||||
getUserInfo();
|
||||
getBetList();
|
||||
getList();
|
||||
});
|
||||
|
||||
const innerAudioContext = Taro.createInnerAudioContext();
|
||||
|
||||
const startMusic = (path, loop = false) => {
|
||||
// const innerAudioContext = Taro.createInnerAudioContext()
|
||||
innerAudioContext.autoplay = true;
|
||||
innerAudioContext.src = path;
|
||||
innerAudioContext.loop = loop;
|
||||
innerAudioContext.onPlay(() => {
|
||||
console.log("开始播放");
|
||||
});
|
||||
innerAudioContext.onError(() => {
|
||||
console.log("播放失败");
|
||||
});
|
||||
};
|
||||
|
||||
const user_info = ref({
|
||||
nickName: "游客",
|
||||
avatarUrl: "",
|
||||
pulse: 0,
|
||||
integral: 0,
|
||||
});
|
||||
|
||||
const bet_options = ref([]);
|
||||
|
||||
const newKjNum = ref(1);
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
const kjData = ref({});
|
||||
|
||||
const bet_index = ref(null);
|
||||
|
||||
const timeStr = ref("");
|
||||
|
||||
const getUserInfo = async () => {
|
||||
Taro.request({
|
||||
url: `${
|
||||
process.env.TARO_APP_AOSHI_API
|
||||
}/australia/user/info?uid=${Taro.getStorageSync("uid")}`,
|
||||
method: "GET",
|
||||
success: ({ data: res }) => {
|
||||
user_info.value = res.data.data || {};
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const getList = () => {
|
||||
Taro.request({
|
||||
url: `${process.env.TARO_APP_AOSHI_API}/australia/history/list`,
|
||||
method: "GET",
|
||||
success: ({ data: res }) => {
|
||||
list.value = res.data.data.data || [];
|
||||
newKjNum.value = list.value[0]?.preDrawIssue + 1;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handelBetClick = (index) => {
|
||||
bet_index.value = index;
|
||||
};
|
||||
|
||||
// 转盘相关
|
||||
const light = ref({
|
||||
container: null,
|
||||
num: 8,
|
||||
itemNum: 3,
|
||||
});
|
||||
|
||||
const turntable_light = ref();
|
||||
const turntable = ref();
|
||||
const isRunning = ref(false);
|
||||
|
||||
const turntable_list = ref([
|
||||
{
|
||||
id: 3,
|
||||
url: he,
|
||||
name: "和",
|
||||
isActive: false,
|
||||
activeUrl: kh,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
url: dan,
|
||||
name: "单",
|
||||
isActive: false,
|
||||
activeUrl: kd,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "双",
|
||||
url: shuang,
|
||||
isActive: false,
|
||||
activeUrl: ks,
|
||||
},
|
||||
]);
|
||||
|
||||
const getBetList = () => {
|
||||
Taro.request({
|
||||
url: `${process.env.TARO_APP_AOSHI_API}/australia/list`,
|
||||
method: "GET",
|
||||
success: ({ data: res }) => {
|
||||
bet_options.value = res.data.data || [];
|
||||
kjData.value = res.data;
|
||||
|
||||
timeId.value = setInterval(() => {
|
||||
countdownFn();
|
||||
}, 1000);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const bgUrl = ref(wu);
|
||||
|
||||
const handelDzClick = (item) => {
|
||||
turntable_list.value.forEach((itm) => {
|
||||
itm.isActive = false;
|
||||
});
|
||||
item.isActive = true;
|
||||
bgUrl.value = item.activeUrl;
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
// 初始化轮盘灯
|
||||
let lightFragment = document.createDocumentFragment();
|
||||
for (let i = 0; i < light.value.num; i++) {
|
||||
let lightItem = document.createElement("view");
|
||||
let deg = (360 / light.value.num) * i;
|
||||
lightItem.className = "lightItem";
|
||||
lightItem.style.transform = `rotate(${deg}deg)`;
|
||||
lightFragment.appendChild(lightItem);
|
||||
}
|
||||
turntable_light.value.appendChild(lightFragment);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
turntable_light.value = document.querySelector("#turntable_light");
|
||||
turntable.value = document.querySelector("#turntable");
|
||||
init();
|
||||
|
||||
// startRun('单')
|
||||
});
|
||||
|
||||
const timeId = ref();
|
||||
|
||||
const time_i = ref();
|
||||
|
||||
const countdownFn = () => {
|
||||
const currentTimestamp = dayjs().valueOf();
|
||||
const timeLeft =
|
||||
dayjs(kjData.value.drawTime).unix() * 1000 - currentTimestamp;
|
||||
timeStr.value = dayjs(timeLeft).format("mm分ss秒");
|
||||
|
||||
const m = Number(dayjs(timeLeft).format("mm"));
|
||||
const s = Number(dayjs(timeLeft).format("ss"));
|
||||
|
||||
if (m === 0 && s === 0) {
|
||||
clearInterval(timeId.value);
|
||||
clearInterval(time_i.value);
|
||||
getList();
|
||||
setTimeout(() => {
|
||||
startRun(list.value[0].name);
|
||||
}, 1500);
|
||||
}
|
||||
};
|
||||
|
||||
const startRun = (name) => {
|
||||
if (!name)
|
||||
return Taro.showToast({
|
||||
title: "未知开奖结果",
|
||||
mask: true,
|
||||
icon: "none",
|
||||
duration: 1000,
|
||||
});
|
||||
isRunning.value = true;
|
||||
|
||||
innerAudioContext.stop();
|
||||
|
||||
startMusic(
|
||||
"https://files.wanzhuanyongcheng.com/file/music/yaotouzi/1.mp3",
|
||||
false
|
||||
);
|
||||
|
||||
turntable_list.value.forEach((item) => {
|
||||
item.isActive = false;
|
||||
});
|
||||
|
||||
bet_index.value = null;
|
||||
|
||||
let kj_num = 0;
|
||||
|
||||
switch (name) {
|
||||
case "单":
|
||||
kj_num = 1;
|
||||
break;
|
||||
case "双":
|
||||
kj_num = 2;
|
||||
break;
|
||||
case "和":
|
||||
kj_num = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
let rotateItemDeg = (kj_num - 1) * (360 / turntable_list.value.length);
|
||||
|
||||
let rotate = rotateItemDeg + 5 * 360 - 70;
|
||||
|
||||
const rotateSpeed = Number((rotateItemDeg / 360 + 5).toFixed(2));
|
||||
|
||||
turntable.value.removeAttribute("style");
|
||||
setTimeout(() => {
|
||||
turntable.value.style.background = `url(${bgUrl.value}) no-repeat`;
|
||||
turntable.value.style.backgroundSize = "contain";
|
||||
turntable.value.style.transform = `translate(-50%, -50%) rotate(${rotate}deg)`;
|
||||
turntable.value.style.transition = `transform ${rotateSpeed}s ease-out`;
|
||||
}, 10);
|
||||
|
||||
setTimeout(() => {
|
||||
isRunning.value = false;
|
||||
getBetJl();
|
||||
setTimeout(() => {
|
||||
bgUrl.value = wu;
|
||||
getUserInfo();
|
||||
startMusic(
|
||||
"https://files.wanzhuanyongcheng.com/file/music/yaotouzi/3.mp3",
|
||||
true
|
||||
);
|
||||
}, 2000);
|
||||
}, rotateSpeed * 1000);
|
||||
};
|
||||
|
||||
const betFn = () => {
|
||||
if (bet_index.value === null)
|
||||
return Taro.showToast({
|
||||
title: "请选择豆子",
|
||||
icon: "none",
|
||||
});
|
||||
const arr = turntable_list.value.filter((item) => item.isActive === true);
|
||||
|
||||
const betObj = bet_options.value[bet_index.value];
|
||||
|
||||
if (arr.length === 0)
|
||||
return Taro.showToast({
|
||||
title: "请选择投注项",
|
||||
icon: "none",
|
||||
});
|
||||
Taro.request({
|
||||
url: `${process.env.TARO_APP_AOSHI_API}/australia/user/dice`,
|
||||
method: "POST",
|
||||
data: {
|
||||
name: arr[0].name,
|
||||
uid: Taro.getStorageSync("uid"),
|
||||
aid: String(betObj.ID),
|
||||
game_id: String(Taro.getStorageSync("id")),
|
||||
},
|
||||
success: ({ data: res }) => {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
setTimeout(() => {
|
||||
getUserInfo();
|
||||
}, 500);
|
||||
};
|
||||
|
||||
// 前往开奖和投注记录
|
||||
const toPage = (type) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/aoshi/records/index?type=${type}`,
|
||||
});
|
||||
};
|
||||
|
||||
// 动画相关
|
||||
const isLottie = ref(false); // 是否显示动画
|
||||
|
||||
const lottieFn = (type, num = 0) => {
|
||||
isLottie.value = true;
|
||||
|
||||
const lottieEle = document.getElementById("lottie");
|
||||
|
||||
const ctx = Lottie.loadAnimation({
|
||||
container: lottieEle,
|
||||
renderer: "svg",
|
||||
loop: false,
|
||||
autoplay: true,
|
||||
animationData: type === 1 ? zj : wzj,
|
||||
});
|
||||
|
||||
if (type === 1) {
|
||||
const text = document.createElement("view");
|
||||
text.className = "lottie-text";
|
||||
// text.innerHTML = `单`
|
||||
const view = document.createElement("view");
|
||||
view.className = "lottie-bg";
|
||||
view.innerHTML = `<view class="lottie-num">${num}积分</view>`;
|
||||
const els = [view, text];
|
||||
|
||||
for (const i in els) {
|
||||
lottieEle.appendChild(els[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ctx.addEventListener("complete", () => {
|
||||
isLottie.value = false;
|
||||
ctx.destroy();
|
||||
});
|
||||
};
|
||||
|
||||
const getBetJl = () => {
|
||||
Taro.request({
|
||||
url: `${
|
||||
process.env.TARO_APP_AOSHI_API
|
||||
}/australia/user/record?uid=${Taro.getStorageSync("uid")}`,
|
||||
method: "GET",
|
||||
success: ({ data: res }) => {
|
||||
const data = res.data.data[0];
|
||||
const t = dayjs().format("YYYY-MM-DD");
|
||||
|
||||
// 是否为今天
|
||||
if (data.DrawTime === t) {
|
||||
// console.log('1')
|
||||
// 是否下注
|
||||
if (newKjNum.value - data.Periods === 0) {
|
||||
// console.log('2')
|
||||
// 是否中奖
|
||||
if (data.DrawNum > 0) {
|
||||
lottieFn(1, data.DrawNum);
|
||||
// console.log('3')
|
||||
} else {
|
||||
lottieFn(2);
|
||||
// console.log('4')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
getBetList();
|
||||
getList();
|
||||
};
|
||||
|
||||
Taro.useDidHide(() => {
|
||||
clearInterval(timeId.value);
|
||||
clearInterval(time_i.value);
|
||||
innerAudioContext.stop();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearInterval(timeId.value);
|
||||
clearInterval(time_i.value);
|
||||
innerAudioContext.stop();
|
||||
});
|
||||
|
||||
const showPopup = ref(false);
|
||||
const game_info = ref({});
|
||||
|
||||
Taro.useDidShow(() => {
|
||||
// game_info.value = Taro.getStorageSync('gameItem')
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="header">
|
||||
<view class="left-box">
|
||||
<text class="text">公告: 开奖结果同步澳拾</text>
|
||||
</view>
|
||||
<view class="right-box">
|
||||
<view class="btn tz-btn" @click="toPage(2)"></view>
|
||||
<view class="btn kj-btn" @click="toPage(1)"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-box">
|
||||
<view class="avatar-box">
|
||||
<view class="bg"></view>
|
||||
<image
|
||||
class="avatar"
|
||||
:src="user_info.avatarUrl || '../../../static/default_avatar.png'"
|
||||
/>
|
||||
</view>
|
||||
<view class="user-info">
|
||||
<view class="name">{{ user_info.nickName }}</view>
|
||||
<view class="jf">积分: {{ user_info.integral || 0 }}</view>
|
||||
</view>
|
||||
<view class="dz-box">
|
||||
<view class="dz-bg"></view>
|
||||
<view class="text">{{ user_info.pulse || 0 }}</view>
|
||||
</view>
|
||||
<view class="rule-btn" @click="showPopup = true"></view>
|
||||
</view>
|
||||
<view class="kj-box">
|
||||
<text class="title">第{{ list[0]?.preDrawIssue || 0 }}期已开奖</text>
|
||||
<view class="num-box">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in list[0]?.preDrawCode?.split(',')"
|
||||
:key="index"
|
||||
>
|
||||
{{ Number(item) }}
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="num-box" style="justify-content: center">
|
||||
<view class="item">
|
||||
{{ list[0]?.Name }}
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
flex-direction: column;
|
||||
margin-top: 6%;
|
||||
"
|
||||
>
|
||||
<view class="turntable-box">
|
||||
<view class="star star-1"></view>
|
||||
<view class="star star-2"></view>
|
||||
<view class="star star-3"></view>
|
||||
<view class="star star-4"></view>
|
||||
|
||||
<view class="turntable-wrap" id="turntable-wrap">
|
||||
<view class="light" id="turntable_light"></view>
|
||||
<view
|
||||
:style="{
|
||||
background: `url(${bgUrl}) no-repeat`,
|
||||
backgroundSize: 'contain',
|
||||
}"
|
||||
class="turntable"
|
||||
id="turntable"
|
||||
>
|
||||
<view class="prize" v-if="turntable_list && turntable_list.length">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in turntable_list"
|
||||
:key="index"
|
||||
@click="handelDzClick(item)"
|
||||
>
|
||||
<image class="img" :src="item.url" />
|
||||
<!-- <view v-if="item.url" :class="item.isActive ? 'icon' : ''"></view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bet-btn" @click="betFn"></view>
|
||||
<view class="pointer"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="countdown-box">
|
||||
<text class="title" v-if="!isRunning"
|
||||
>第{{ newKjNum }}期开奖还剩:{{ timeStr || "00" }}</text
|
||||
>
|
||||
<text v-else class="title">正在开奖中...</text>
|
||||
</view>
|
||||
<view class="footer-box">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in bet_options"
|
||||
:key="index"
|
||||
:class="bet_index === index ? 'item-active' : 'item-no-active'"
|
||||
@click="handelBetClick(index)"
|
||||
>
|
||||
<view class="icon"></view>
|
||||
<view class="name">{{ item.max }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view id="lottie" v-show="isLottie"></view>
|
||||
<!-- 弹窗 -->
|
||||
<!-- <HPopup :show="showPopup" @isShow="showPopup = false">
|
||||
<view class="popup-content">
|
||||
<rich-text :nodes="game_info.introduction"></rich-text>
|
||||
</view>
|
||||
</HPopup> -->
|
||||
</view>
|
||||
</template>
|
||||
4
src/pages/aoshi/records/index.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarBackgroundColor: "#23684B",
|
||||
enablePullDownRefresh: true,
|
||||
});
|
||||
143
src/pages/aoshi/records/index.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<view class="app">
|
||||
<template v-if="typeNum === 1">
|
||||
<view class="card" v-for="(item, index) in list" :key="index">
|
||||
<view>
|
||||
<view>
|
||||
第{{ item.preDrawIssue }}期开奖:
|
||||
<text
|
||||
:style="{
|
||||
color: numColor(item.name),
|
||||
}"
|
||||
>
|
||||
{{ item.name }}
|
||||
</text>
|
||||
<view>
|
||||
{{ item.preDrawCode }}
|
||||
</view>
|
||||
</view>
|
||||
<view>开奖时间: {{ item.preDrawTime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view v-if="list.length > 0">
|
||||
<view class="card desc" v-for="(item, index) in list" :key="index">
|
||||
<view>
|
||||
<view>第{{ item.Periods }}期投注:</view>
|
||||
<view>
|
||||
点数:
|
||||
<text style="color: red">{{ item.Name }}</text>
|
||||
</view>
|
||||
<view class="sub">
|
||||
投注时间:
|
||||
<text>{{ item.DrawTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view style="text-align: right">
|
||||
<view style="color: red" v-if="item.State === 1">
|
||||
+{{ item.DrawNum }}积分
|
||||
</view>
|
||||
<view style="color: green">-{{ item.Number }}豆子</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view style="margin-top: 100px">暂无记录.....</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
const typeNum = ref(0);
|
||||
|
||||
Taro.useLoad((options) => {
|
||||
typeNum.value = Number(options.type);
|
||||
Taro.setNavigationBarTitle({
|
||||
title: options.type === "1" ? "开奖记录" : "投注记录",
|
||||
});
|
||||
getData();
|
||||
});
|
||||
|
||||
Taro.usePullDownRefresh(() => {
|
||||
getData();
|
||||
});
|
||||
|
||||
const numColor = (num) => {
|
||||
switch (num) {
|
||||
case "单":
|
||||
return "orange";
|
||||
case "双":
|
||||
return "blue";
|
||||
case "和":
|
||||
return "purple";
|
||||
default:
|
||||
return "black";
|
||||
}
|
||||
};
|
||||
|
||||
const getData = async () => {
|
||||
if (typeNum.value === 1) {
|
||||
Taro.request({
|
||||
url: `${process.env.TARO_APP_AOSHI_API}/australia/history/list`,
|
||||
method: "GET",
|
||||
success: ({ data: res }) => {
|
||||
list.value = res.data.data.data || [];
|
||||
},
|
||||
});
|
||||
} else {
|
||||
Taro.request({
|
||||
url: `${
|
||||
process.env.TARO_APP_AOSHI_API
|
||||
}/australia/user/record?uid=${Taro.getStorageSync("uid")}`,
|
||||
method: "GET",
|
||||
success: ({ data: res }) => {
|
||||
list.value = res.data.data || [];
|
||||
},
|
||||
});
|
||||
}
|
||||
Taro.stopPullDownRefresh();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.taro_page {
|
||||
background-color: #f5f5f5 !important;
|
||||
}
|
||||
.app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
//justify-content: center;
|
||||
font-size: 35px;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 95%;
|
||||
padding: 20px;
|
||||
background-color: #fff;
|
||||
margin-top: 10px;
|
||||
border-radius: 10px;
|
||||
|
||||
.sub {
|
||||
margin-top: 10px;
|
||||
color: #555555;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
BIN
src/static/1-1.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src/static/1-2.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
src/static/2-1.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src/static/2-2.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
src/static/avatar_border.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
src/static/bet_btn.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
src/static/bg.png
Normal file
|
After Width: | Height: | Size: 861 KiB |
BIN
src/static/countdown_bg.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
src/static/dan.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src/static/default_avatar.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/static/dz.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
src/static/dz_active.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src/static/dz_opt.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
src/static/he.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
src/static/img_0.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src/static/kX.png
Normal file
|
After Width: | Height: | Size: 183 KiB |
BIN
src/static/kd-1.png
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
src/static/kd.png
Normal file
|
After Width: | Height: | Size: 187 KiB |
BIN
src/static/kh-1.png
Normal file
|
After Width: | Height: | Size: 171 KiB |
BIN
src/static/kh.png
Normal file
|
After Width: | Height: | Size: 177 KiB |
BIN
src/static/kj_btn.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
src/static/kk.png
Normal file
|
After Width: | Height: | Size: 135 KiB |
BIN
src/static/ks.png
Normal file
|
After Width: | Height: | Size: 178 KiB |
BIN
src/static/num.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
src/static/pointer.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
src/static/rule_btn.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src/static/shuang.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src/static/turntable_bg.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
src/static/turntable_bg_1.png
Normal file
|
After Width: | Height: | Size: 138 KiB |
BIN
src/static/tz_btn.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
src/static/wu.png
Normal file
|
After Width: | Height: | Size: 140 KiB |