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

View File

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

View File

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