Merge branch 'dev' into 'test'

增加游戏大厅

See merge request YuanHuakk/newgame!1
This commit is contained in:
2023-10-18 18:44:02 +08:00
9 changed files with 105 additions and 85 deletions

View File

@@ -3,4 +3,6 @@
TARO_APP_API = 'https://game.wanzhuanyongcheng.cn/dice' 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_ID="生产环境下的小程序appid"
TARO_APP_API = 'https://www.jdt168.com/dice' 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_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 = { export const app = {
API_URL: () => `${process.env.TARO_APP_API}`, 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 { .index {
position: relative; position: relative;
width: 100%; width: 100%;

View File

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

View File

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

View File

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

View File

@@ -1,16 +1,21 @@
<template> <template>
<view class="app"> <view class="app">
<template v-if="typeNum===1"> <template v-if="typeNum === 1">
<view class="card" v-for="(item,index) in list as any[]" :key="index"> <view class="card" v-for="(item,index) in list as any[]" :key="index">
<view> <view>
<view>{{ item.Periods }}期开奖: <view
<!-- <text style="color: red">{{ item.Start }},{{ item.End }}</text>--> >{{ item.Periods }}期开奖:
<text v-for="(num,i) in item.Name" :key="i" :style="{ <!-- <text style="color: red">{{ item.Start }},{{ item.End }}</text>-->
color: numColor(num) <text
}">{{ num }}, v-for="(num, i) in item.Name"
:key="i"
:style="{
color: numColor(num),
}"
>{{ num }},
</text> </text>
</view> </view>
<!-- <view class="sub">开奖个数:--> <!-- <view class="sub">开奖个数:-->
<!-- <text v-for="(num,i) in item.Name" :key="i" :style="{--> <!-- <text v-for="(num,i) in item.Name" :key="i" :style="{-->
<!-- color: numColor(num)--> <!-- color: numColor(num)-->
<!-- }">{{ num }},--> <!-- }">{{ num }},-->
@@ -21,14 +26,24 @@
</template> </template>
<template v-else> <template v-else>
<view v-if="list.length > 0"> <view v-if="list.length > 0">
<view class="card desc" v-for="(item,index) in list as any[]" :key="index"> <view
class="card desc"
v-for="(item,index) in list as any[]"
:key="index"
>
<view> <view>
<view>{{ item.Periods }}期投注:</view> <view>{{ item.Periods }}期投注:</view>
<view>点数:<text style="color: red">{{ item.Name }}</text></view> <view
<view class="sub">投注时间:<text>{{ item.DrawTime }}</text></view> >点数:<text style="color: red">{{ item.Name }}</text></view
>
<view class="sub"
>投注时间:<text>{{ item.DrawTime }}</text></view
>
</view> </view>
<view style="text-align: right"> <view style="text-align: right">
<view style="color: red" v-if="item.State === 1">+{{ item.DrawNum }}积分</view> <view style="color: red" v-if="item.State === 1"
>+{{ item.DrawNum }}积分</view
>
<view style="color: green">-{{ item.Number }}豆子</view> <view style="color: green">-{{ item.Number }}豆子</view>
</view> </view>
</view> </view>
@@ -36,65 +51,64 @@
<view v-else> <view v-else>
<view style="margin-top: 100px">暂无记录.....</view> <view style="margin-top: 100px">暂无记录.....</view>
</view> </view>
</template> </template>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref} from 'vue' import { ref } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {getKaiJiangList, getTzJl} from '@/api' import { getKaiJiangList, getTzJl } from "@/api";
const list = ref<any[]>([]) const list = ref<any[]>([]);
const typeNum = ref(0) const typeNum = ref(0);
Taro.useLoad((options) => { Taro.useLoad((options) => {
typeNum.value = Number(options.type) typeNum.value = Number(options.type);
Taro.setNavigationBarTitle({title: options.type === '1' ? '开奖记录' : '投注记录'}) Taro.setNavigationBarTitle({
getData() title: options.type === "1" ? "开奖记录" : "投注记录",
}) });
getData();
});
Taro.usePullDownRefresh(() => { Taro.usePullDownRefresh(() => {
getData() getData();
}) });
const numColor = (num: string) => { const numColor = (num: string) => {
switch (num) { switch (num) {
case '大': case "大":
return 'red' return "red";
case '小': case "小":
return 'green' return "green";
case '单': case "单":
return 'orange' return "orange";
case '双': case "双":
return 'blue' return "blue";
case '和': case "和":
return 'purple' return "purple";
default: default:
return 'black' return "black";
} }
} };
const getData = async () => { const getData = async () => {
let res: any let res: any;
if (typeNum.value === 1) { if (typeNum.value === 1) {
res = await getKaiJiangList() res = await getKaiJiangList();
list.value = res.data.data.map((item: any) => { list.value = res.data.data.map((item: any) => {
return { return {
...item, ...item,
Name: item.Name.split('-') Name: item.Name.split("-"),
} };
}) });
} else { } else {
res = await getTzJl(Taro.getStorageSync('uid')) res = await getTzJl(Taro.getStorageSync("uid"));
list.value = res.data.data.sort( list.value = res.data.data || [];
(a: any, b: any) => b.Periods - a.Periods
)
} }
Taro.stopPullDownRefresh() Taro.stopPullDownRefresh();
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -128,5 +142,4 @@ const getData = async () => {
align-items: center; align-items: center;
width: 100%; width: 100%;
} }
</style> </style>