diff --git a/src/pages/aoshi/index/index.scss b/src/pages/aoshi/index/index.scss
index 08854e4..c2256e2 100644
--- a/src/pages/aoshi/index/index.scss
+++ b/src/pages/aoshi/index/index.scss
@@ -143,10 +143,10 @@
font-weight: bold;
color: red;
}
- .item:nth-child(3) {
- font-weight: bold;
- color: red;
- }
+ // .item:nth-child(3) {
+ // font-weight: bold;
+ // color: red;
+ // }
}
}
diff --git a/src/pages/aoshi/index/index.vue b/src/pages/aoshi/index/index.vue
index 765431d..abc4e7f 100644
--- a/src/pages/aoshi/index/index.vue
+++ b/src/pages/aoshi/index/index.vue
@@ -55,7 +55,7 @@
- {{ item.max }}豆子
+ {{ item }}豆子
| 游戏规则 |
@@ -70,38 +70,20 @@ import * as dayjs from 'dayjs'
const userInfo = ref({})
-const nums = ref([
- {
- optActive: false,
- active: false,
- value: 1,
- },
- {
- optActive: false,
- active: false,
- value: 2,
- },
- {
- optActive: false,
- active: false,
- value: 4,
- },
- {
- optActive: false,
- active: false,
- value: 3,
- },
-])
+interface NumsType {
+ ID: number
+ name: string
+ optActive?: boolean
+ active?: boolean
+ value?: string
+ list?: number[]
+}
+
+const nums = ref([])
const kjNums = ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
-interface BetOpts {
- ID?: number
- max?: number
- odds?: number
-}
-
-const betOpts = ref([])
+const betOpts = ref([100, 500, 1000, 2000, 3000, 5000])
Taro.useDidShow(() => {
get_info()
@@ -117,14 +99,20 @@ const get_list = async () => {
kjData.value = res.data || {}
kjNums.value = kjData.value.nowDraw.split(',').map((item) => Number(item))
- betOpts.value = kjData.value.list
+ nums.value = kjData.value.list.map((item) => ({
+ optActive: false,
+ active: false,
+ value: item.name,
+ ID: item.ID,
+ list: item.list.split(/[,-.]/).map((item: string) => Number(item)),
+ }))
nums.value.forEach((item) => {
- if (item.value === kjData.value.drawNumber) {
- item.active = true
- } else {
- item.active = false
- }
+ item.list?.forEach((itm) => {
+ if (itm === Number(kjData.value.drawNumber)) {
+ item.active = true
+ }
+ })
})
timeId.value = setInterval(() => {
countdownFn()
@@ -145,10 +133,8 @@ const countdownFn = () => {
if (m === 0 && s === 0) {
clearInterval(timeId.value)
- // setTimeout(() => {
get_list()
get_info()
- // }, 5000)
}
isKj.value = m === 0 && s < 40 ? true : false
}
@@ -165,7 +151,7 @@ const handleClick = (itemOpt) => {
itemOpt.optActive = true
}
-const handleBet = (item: BetOpts) => {
+const handleBet = (item: number) => {
const newNums = nums.value.filter((item) => item.optActive === true)
if (newNums.length === 0)
return Taro.showToast({
@@ -174,15 +160,15 @@ const handleBet = (item: BetOpts) => {
})
Taro.showModal({
title: '确认投注吗?',
- content: `投注豆子:${item.max}`,
+ content: `投注豆子:${item}`,
success: async (res) => {
if (res.confirm) {
const game_info = Taro.getStorageSync('gameItem')
const uid = Taro.getStorageSync('uid')
const res = await turntable_bet({
uid: uid,
- number: nums.value.filter((item) => item.optActive === true)[0].value,
- aid: item.ID,
+ number: nums.value.filter((item) => item.optActive === true)[0].ID,
+ aid: item,
game_id: game_info.ID,
})
Taro.showToast({