update
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-07-15 19:48:40 +08:00
parent f479863d7d
commit 8b4484d8ab
4 changed files with 33 additions and 9 deletions

View File

@@ -9,3 +9,6 @@ export const GetBetRecord = async (uid) =>
export const GetLotteryRecord = async (uid) => export const GetLotteryRecord = async (uid) =>
await alovaInst.Get(`/dice/draw?uid=${uid}`); await alovaInst.Get(`/dice/draw?uid=${uid}`);
export const GetPeriod = async () => await alovaInst.Get(`/dice/periods`); export const GetPeriod = async () => await alovaInst.Get(`/dice/periods`);
export const GetIsWin = async (uid) =>
await alovaInst.Get(`/dice/user/win?uid=${uid}`);

View File

@@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<view class="p-[30px]"> <view class="p-[30px]" v-if="data.length !== 0">
<view <view
class="pt-[10px] pb-[10px] line" class="pt-[10px] pb-[10px] line"
v-for="(item, index) in data" v-for="(item, index) in data"
@@ -56,6 +56,7 @@
</view> </view>
</view> </view>
</view> </view>
<view v-else class="text-[#959BB1] text-center">暂无记录</view>
</view> </view>
</template> </template>
@@ -99,6 +100,9 @@ const data = ref([]);
Taro.useLoad((opt) => { Taro.useLoad((opt) => {
uid.value = opt.uid; uid.value = opt.uid;
});
Taro.useDidShow(() => {
getList(); getList();
}); });
@@ -111,6 +115,9 @@ const getList = async () => {
hm: [item.Name], hm: [item.Name],
t: item.DrawTime, t: item.DrawTime,
j: item.Number, j: item.Number,
draw_num: item.DrawNumber,
state: item.State,
periods_num: item.PeriodsNum,
})); }));
}; };
</script> </script>

View File

@@ -162,7 +162,7 @@
: getTextColor(item.label), : getTextColor(item.label),
}" }"
><view>{{ item.label }}</view> ><view>{{ item.label }}</view>
<view class="text-[25px] text-[#EB1313] leading-[50px]">{{ <view class="text-[28px] text-[#EB1313] leading-[50px]">{{
item.odds item.odds
}}</view> }}</view>
<!-- <view>{{ item.betVal }}</view> --> <!-- <view>{{ item.betVal }}</view> -->
@@ -188,7 +188,7 @@
}}</text> }}</text>
豆子</view 豆子</view
> >
<view> 单注最多可赢 <text class="text-[#EB1313]">100</text> 积分 </view> <!-- <view> 单注最多可赢 <text class="text-[#EB1313]">100</text> 积分 </view> -->
</view> </view>
<view <view
class="bg-white p-[30px] w-full text-[28px] flex justify-between items-center" class="bg-white p-[30px] w-full text-[28px] flex justify-between items-center"
@@ -243,6 +243,7 @@ import {
GetLotteryRecord, GetLotteryRecord,
GetPeriod, GetPeriod,
GetBetRecord, GetBetRecord,
GetIsWin,
} from "../../api"; } from "../../api";
import "tcplayer.js/dist/tcplayer.min.css"; import "tcplayer.js/dist/tcplayer.min.css";
// import Srs from "../../utils/srs.sdk"; // import Srs from "../../utils/srs.sdk";
@@ -277,7 +278,7 @@ const pStr = ref("");
const initWs = (options) => { const initWs = (options) => {
ws.value = new WebSocket( ws.value = new WebSocket(
`wss://${process.env.TARO_APP_WS}/dice/home?uid=${options.uid}&game_id=${options.game_id}` `wss://${process.env.TARO_APP_WS}/dice/home?uid=${options.uid}&game_id=4`
); );
ws.value.onopen = () => { ws.value.onopen = () => {
@@ -293,21 +294,23 @@ const initWs = (options) => {
case 400: case 400:
case 302: case 302:
case 301: case 301:
case 401:
case 400:
case 402:
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: "none",
}); });
break; break;
case 200: case 200:
if (Number(res.data) === 1) { if (Number(res.data) === 0 || Number(res.data) === 1) {
tStr.value = "开奖中"; tStr.value = "开奖中";
return; return;
} }
tStr.value = `${res.data}`; tStr.value = `${res.data}`;
break; break;
case 201: case 201:
await getNum(); await getWin();
await getBetJl();
break; break;
} }
}; };
@@ -353,6 +356,16 @@ const getRecord = async () => {
numList.value = data.value[0].hm; numList.value = data.value[0].hm;
}; };
const getWin = async () => {
await getNum();
await getRecord();
const res = await GetIsWin(uid.value);
if (res.number > 0) {
console.log(res.number);
lottieFn(1, res.number);
}
};
const getNum = async () => { const getNum = async () => {
const res = await GetPeriod(); const res = await GetPeriod();
pStr.value = res.periods; pStr.value = res.periods;
@@ -801,8 +814,8 @@ const submit = async () => {
data: arr, data: arr,
}) })
); );
await getUserInfo();
isBet.value = true; isBet.value = true;
getUserInfo();
clearbet(); clearbet();
}; };

View File

@@ -4,11 +4,12 @@ import AdapterTaroVue from "@alova/adapter-taro/vue";
const alovaInst = createAlova({ const alovaInst = createAlova({
baseURL: process.env.TARO_APP_API, baseURL: process.env.TARO_APP_API,
localCache: null,
...AdapterTaroVue(), ...AdapterTaroVue(),
beforeRequest: (instance) => { beforeRequest: (instance) => {
instance.config.headers = { instance.config.headers = {
"Content-Type": "application/json", "Content-Type": "application/json",
token: getStorageSync("token"), // token: getStorageSync("token"),
}; };
}, },
responded: { responded: {