增加游戏大厅

This commit is contained in:
2023-10-18 18:41:09 +08:00
parent 998391413c
commit 0227f87216
8 changed files with 45 additions and 38 deletions

View File

@@ -3,4 +3,6 @@
TARO_APP_API = 'https://game.wanzhuanyongcheng.cn/dice'
TARO_APP_WS = 'wss://game.wanzhuanyongcheng.cn/dice/home?uid='
TARO_APP_WS = 'wss://game.wanzhuanyongcheng.cn/dice/home'
TARO_APP_HOME= 'https://test.wanzhuanyongcheng.cn/app/game'

View File

@@ -1,4 +1,7 @@
# TARO_APP_ID="生产环境下的小程序appid"
TARO_APP_API = 'https://www.jdt168.com/dice'
TARO_APP_WS = 'wss://www.jdt168.com/dice/home?uid='
TARO_APP_WS = 'wss://www.jdt168.com/dice/home'
TARO_APP_HOME= 'https://www.wanzhuanyongcheng.cn/app/game'

View File

@@ -2,4 +2,7 @@
TARO_APP_API = 'https://game.wanzhuanyongcheng.cn/dice'
TARO_APP_WS = 'wss://game.wanzhuanyongcheng.cn/dice/home?uid='
TARO_APP_WS = 'wss://game.wanzhuanyongcheng.cn/dice/home'
TARO_APP_HOME= 'https://test.wanzhuanyongcheng.cn/app/game'

View File

@@ -3,5 +3,8 @@ import Taro from "@tarojs/taro";
export const app = {
API_URL: () => `${process.env.TARO_APP_API}`,
API_WS: () => `${process.env.TARO_APP_WS}${Taro.getStorageSync("uid")}`,
API_WS: () =>
`${process.env.TARO_APP_WS}?uid=${Taro.getStorageSync("uid")}&gema_id=${
Taro.getStorageSync("gameItem").ID
}`,
};

View File

@@ -1,3 +1,7 @@
page {
font-size: 10px;
}
.index {
position: relative;
width: 100%;

View File

@@ -7,30 +7,8 @@
</swiper>
<view class="container">
<!-- <view>摇骰子</view> -->
<view>游戏介绍</view>
<view class="text">
<view>用户需要购买平台促销商品获得游戏豆;</view>
<view>竞猜游戏消耗游戏豆;</view>
<view>游戏积分作为竞猜奖品;</view>
<view>竞猜限制: 用户进行竞猜大小两格限制20000/其它限制5000/;</view>
<view>活动时间: 我们将在活动页面提示活动时间</view>
</view>
<view>骰子竞猜规则</view>
<view class="text">
<view
>竞猜方式:
参与者需要在规定时间内提交自己的竞猜范围参与者需要预测两个骰子相加的点数或大小范围请确保你的预测在正确范围内;</view
>
<view
>结算方式:
我们将根据所有参与者的猜测结果进行统计和比对找出与实际骰子点数相同的预测实时开奖发送奖励;</view
>
<view
>奖励机制:
奖励将根据活动参与人竞猜游戏豆数额做结算将以游戏积分方式发放给猜中相同开奖点数的的幸运者;</view
>
</view>
<rich-text :nodes="info.introduction"></rich-text>
<view class="btn" @click="startGame()">开始游戏</view>
</view>
</view>
@@ -41,6 +19,12 @@ import { ref } from "vue";
import Taro from "@tarojs/taro";
import "./index.scss";
const info = ref({});
Taro.useLoad(() => {
info.value = Taro.getStorageSync("gameItem");
});
const list = ref([
"https://files.wanzhuanyongcheng.com/file/img/yaotouzi/banner/qietu.png",
]);

View File

@@ -3,8 +3,8 @@
<view class="title">游戏大厅</view>
<view class="card_list">
<view class="card_item" v-for="item in list" :key="item.id">
<view class="btn" @click="toPage(item.id)"></view>
<view class="card_item" v-for="item in list" :key="item.ID">
<view class="btn" @click="toPage(item)"></view>
</view>
</view>
</view>
@@ -22,6 +22,7 @@ Taro.useLoad((options) => {
title: `登陆成功`,
icon: "none",
});
getList();
} else {
Taro.showToast({
title: "登陆失败,请重新进入游戏大厅",
@@ -30,16 +31,23 @@ Taro.useLoad((options) => {
}
});
const list = ref([
{
id: 1,
name: "摇骰子",
},
]);
const list = ref([]);
const toPage = (id: number) => {
const getList = async () => {
Taro.request({
url: process.env.TARO_APP_HOME,
method: "POST",
success: ({ data: res }) => {
console.log(res);
list.value = res.data.data || [];
},
});
};
const toPage = (item: any) => {
Taro.setStorageSync("gameItem", item);
Taro.navigateTo({
url: `/pages/game_detail/index?id=${id}`,
url: `/pages/game_detail/index?id=${item.ID}`,
});
};
</script>

View File

@@ -284,11 +284,11 @@ const numColor = (num: string) => {
};
Taro.useDidShow(() => {
console.log("useDidShow");
startMusic(
"https://files.wanzhuanyongcheng.com/file/music/yaotouzi/bg.MP3",
true
);
initWs();
initData();
});