diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index a993687..7b166dc 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -238,6 +238,7 @@ import { GetUserInfo, GetLotteryRecord, GetPeriod, + GetBetRecord, } from "../../api"; import "tcplayer.js/dist/tcplayer.min.css"; // import Srs from "../../utils/srs.sdk"; @@ -280,7 +281,7 @@ const initWs = (options) => { }, 10000); }; - ws.value.onmessage = ({ data }) => { + ws.value.onmessage = async ({ data }) => { const res = JSON.parse(data); switch (res.code) { case 5: @@ -299,11 +300,9 @@ const initWs = (options) => { } tStr.value = `${res.data}秒`; break; - case 778: - lottieFn(1, res.data); - break; - case 779: - lottieFn(2); + case 201: + await getNum(); + await getBetJl(); break; } }; @@ -502,33 +501,33 @@ const onChange = async ({ name, value }) => { await getBetList(); }; -const showOpt = ref(false); +// const showOpt = ref(false); -const selectorOpt = ref([ - { - name: "开奖记录", - value: "/pages/lottery_record/index", - }, - { - name: "投注记录", - value: "/pages/bet_record/index", - }, - { - name: "玩法说明", - value: "/pages/about/index", - }, -]); +// const selectorOpt = ref([ +// { +// name: "开奖记录", +// value: "/pages/lottery_record/index", +// }, +// { +// name: "投注记录", +// value: "/pages/bet_record/index", +// }, +// { +// name: "玩法说明", +// value: "/pages/about/index", +// }, +// ]); -const onChangeOpt = ({ value }) => { - if (!value) - return Taro.showToast({ - title: "开发中", - icon: "none", - }); - Taro.navigateTo({ - url: `${value}?uid=${uid.value}`, - }); -}; +// const onChangeOpt = ({ value }) => { +// if (!value) +// return Taro.showToast({ +// title: "开发中", +// icon: "none", +// }); +// Taro.navigateTo({ +// url: `${value}?uid=${uid.value}`, +// }); +// }; const showTable = ref(false); @@ -626,663 +625,10 @@ const columns = ref([ }, ]); -// const data = ref([ -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// { -// qs: "4157期", -// hm: [ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ], -// tt: "21", -// tw: "42", -// tm: "26", -// ds: "27", -// }, -// ]); - const data = ref([]); const openTable = () => {}; -// const numList = ref([ -// { -// num: 21, -// color: "#088207", -// }, -// { -// num: 42, -// color: "#0500FA", -// }, -// { -// num: 26, -// color: "#0500FA", -// }, -// { -// num: 27, -// color: "#088207", -// }, -// { -// num: 46, -// color: "#FF0204", -// }, -// { -// num: 14, -// color: "#0500FA", -// }, -// { -// num: "", -// color: "#fff", -// }, -// { -// num: 45, -// color: "#FF0204", -// }, -// ]); - const numList = ref([]); const formData = ref({ @@ -1305,8 +651,6 @@ const getTotalNum = computed(() => { return num; }); -const btnStatus = ref(true); - const betList = ref([]); const betSelect = (item) => { @@ -1383,11 +727,33 @@ const submit = async () => { data: arr, }) ); + isBet.value = true; clearbet(); }; +const isBet = ref(false); + +const getBetJl = async () => { + const res = await GetBetRecord(uid.value); + const data = res.data.data[0]; + const t = dayjs().format("YYYY-MM-DD"); + + // 是否为今天 + if (data.DrawTime === t) { + // 是否下注 + if (isBet.value) { + // 是否中奖 + if (data.DrawNum > 0) { + lottieFn(1, data.DrawNum); + } else { + lottieFn(2); + } + isBet.value = false; + } + } +}; + const lottieFn = (type, num = 0) => { - console.log(type, num); isLottie.value = true; const lottieEle = document.getElementById("lottie");