diff --git a/src/components/lottery/LotteryGame.vue b/src/components/lottery/LotteryGame.vue index d6142e0..b4a0466 100644 --- a/src/components/lottery/LotteryGame.vue +++ b/src/components/lottery/LotteryGame.vue @@ -50,10 +50,10 @@ const gameInfo = reactive({ }); const choices = ref([ - { id: "1", name: "IDOL 1", active: false }, - { id: "2", name: "IDOL 2", active: false }, - { id: "3", name: "IDOL 3", active: false }, - { id: "4", name: "IDOL 4", active: false }, + // { id: "1", name: "IDOL 1", active: false }, + // { id: "2", name: "IDOL 2", active: false }, + // { id: "3", name: "IDOL 3", active: false }, + // { id: "4", name: "IDOL 4", active: false }, ]); const choicesSelected = computed(() => { @@ -89,8 +89,8 @@ onUnmounted(() => { }); const toggleChoice = (id) => { - const idx = choices.value.findIndex(e => e.id === id); - if(idx === -1) return; + const idx = choices.value.findIndex((e) => e.id === id); + if (idx === -1) return; choices.value[idx].active = !choices.value[idx].active; if (!choices.value[idx].active) { choices.value[idx].amount = 0; @@ -108,6 +108,16 @@ const getGameHistory = () => { ); }; +const GameInfo = () => { + handleRequest(axios.get(API.GAME_INFO + "/" + id)).then( + (res) => { + if (res.success) { + choices.value = res.data.info?.betOptions ?? [] + } + } + ) +}; + const confirmOrder = () => { if (choicesSelected.value.length === 0) { return showFailToast("Hãy chọn 1 con số"); @@ -122,10 +132,10 @@ const confirmOrder = () => { const cancelOrder = () => { choices.value.forEach((c) => { - c.active = false + c.active = false; }); - amount.value = "" -} + amount.value = ""; +}; const submit = () => { const data = { @@ -193,6 +203,9 @@ const formatResultText2 = (r) => { }, 0); return s % 2 ? "IDOL 3" : "IDOL 4"; }; + +GameInfo(); +