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_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();
});

View File

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