diff --git a/.env.development b/.env.development index c1a0512..1cb4a82 100644 --- a/.env.development +++ b/.env.development @@ -12,4 +12,22 @@ TARO_APP_GAME='https://jdt-test-tz.wanzhuanyongcheng.cn/pages/index/index?uid=' # TARO_APP_GAME='http://192.168.31.225:10086?uid=' # 捕鱼游戏链接 -TARO_APP_FISH_GAME='https://jdt-test-fish.wanzhuanyongcheng.cn/?uid=' \ No newline at end of file +TARO_APP_FISH_GAME='https://jdt-test-fish.wanzhuanyongcheng.cn/?uid=' + +# 游戏API +TARO_APP_HALL_API='https://game.wanzhuanyongcheng.cn' + +# 游戏大厅 +TARO_APP_HOME= 'https://test.wanzhuanyongcheng.cn/app/game' + +# 游戏ws链接 +TARO_APP_WS='wss://game.wanzhuanyongcheng.cn/dice/home' + +# 大转盘ws +TARO_APP_TURNTABLE_WS='wss://game2.wanzhuanyongcheng.cn/turntable/home' + +# 大转盘api +TARO_APP_TURNTABLE_API='https://game2.wanzhuanyongcheng.cn/turntable' + +# 澳拾 +TARO_APP_AOSHI_API='https://game3.wanzhuanyongcheng.cn' \ No newline at end of file diff --git a/.env.test b/.env.test index 25f3860..8f3f3b4 100644 --- a/.env.test +++ b/.env.test @@ -11,4 +11,22 @@ TARO_APP_API='https://test.wanzhuanyongcheng.cn/app' TARO_APP_GAME='https://jdt-test-tz.wanzhuanyongcheng.cn/pages/index/index?uid=' # 捕鱼游戏链接 -TARO_APP_FISH_GAME='https://jdt-test-fish.wanzhuanyongcheng.cn/?uid=' \ No newline at end of file +TARO_APP_FISH_GAME='https://jdt-test-fish.wanzhuanyongcheng.cn/?uid=' + +# 游戏API +TARO_APP_HALL_API='https://game.wanzhuanyongcheng.cn' + +# 游戏大厅 +TARO_APP_HOME= 'https://test.wanzhuanyongcheng.cn/app/game' + +# 游戏ws链接 +TARO_APP_WS='wss://game.wanzhuanyongcheng.cn/dice/home' + +# 大转盘ws +TARO_APP_TURNTABLE_WS='wss://game2.wanzhuanyongcheng.cn/turntable/home' + +# 大转盘api +TARO_APP_TURNTABLE_API='https://game2.wanzhuanyongcheng.cn/turntable' + +# 澳拾 +TARO_APP_AOSHI_API='https://game3.wanzhuanyongcheng.cn' \ No newline at end of file diff --git a/src/app.config.ts b/src/app.config.ts index 67a7e87..cb22172 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -6,7 +6,6 @@ export default defineAppConfig({ 'pages/user/index', 'pages/allClassList/index', 'pages/game/gamedetail/index', - 'pages/game/gameview/index', 'pages/game/view/index', 'pages/fastBuy/index', ], diff --git a/src/config/index.ts b/src/config/index.ts new file mode 100644 index 0000000..f0f6768 --- /dev/null +++ b/src/config/index.ts @@ -0,0 +1,10 @@ +// 用于配置项目的一些常量,如接口地址、websocket地址等 +import Taro from '@tarojs/taro'; + +export const app = { + API_URL: () => `${process.env.TARO_APP_HALL_API}`, + API_WS: () => + `${process.env.TARO_APP_WS}?uid=${Taro.getStorageSync('uid')}&game_id=${ + Taro.getStorageSync('gameItem').ID + }`, +}; diff --git a/src/pages/game/gamedetail/index.config.ts b/src/pages/game/gamedetail/index.config.ts index 1492435..fab5802 100644 --- a/src/pages/game/gamedetail/index.config.ts +++ b/src/pages/game/gamedetail/index.config.ts @@ -1,4 +1,4 @@ export default definePageConfig({ navigationBarTitleText: '游戏详情', - navigationStyle: 'custom', + // navigationStyle: 'custom', }); diff --git a/src/pages/game/gamedetail/index.scss b/src/pages/game/gamedetail/index.scss new file mode 100644 index 0000000..b814512 --- /dev/null +++ b/src/pages/game/gamedetail/index.scss @@ -0,0 +1,43 @@ +// page { +// font-size: 10px; +// } + +.index { + position: relative; + width: 100%; + height: 100vh; + + .swiper { + background-color: white; + width: 100%; + } + + .container { + z-index: 1; + position: absolute; + top: 260px; + background-color: white; + box-sizing: border-box; + width: 100%; + padding: 10px; + text-align: center; + border-top-left-radius: 20px; + border-top-right-radius: 20px; + + .btn { + margin: 20px auto; + padding: 10px; + border-radius: 50px; + background-color: #7950f2; + color: #fff; + width: 300px; + text-align: center; + border: 1px solid #f5f5f5; + } + } +} +.text { + padding: 10px; + font-size: 30px; + text-align: left; +} diff --git a/src/pages/game/gamedetail/index.vue b/src/pages/game/gamedetail/index.vue index b0bc081..4f701f6 100644 --- a/src/pages/game/gamedetail/index.vue +++ b/src/pages/game/gamedetail/index.vue @@ -1,153 +1,48 @@ - - - diff --git a/src/pages/game/gamehome/index.config.ts b/src/pages/game/gamehome/index.config.ts index cd37b3f..f3208eb 100644 --- a/src/pages/game/gamehome/index.config.ts +++ b/src/pages/game/gamehome/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '', + navigationBarTitleText: '游戏大厅', + // navigationStyle: 'custom', }); diff --git a/src/pages/game/gamehome/index.vue b/src/pages/game/gamehome/index.vue index 7203024..abc64ac 100644 --- a/src/pages/game/gamehome/index.vue +++ b/src/pages/game/gamehome/index.vue @@ -1,20 +1,31 @@ - + diff --git a/src/pages/game/gameview/index.config.ts b/src/pages/game/gameview/index.config.ts deleted file mode 100644 index c59824f..0000000 --- a/src/pages/game/gameview/index.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default definePageConfig({ - navigationBarTitleText: 'GameView', -}); diff --git a/src/pages/game/gameview/index.vue b/src/pages/game/gameview/index.vue deleted file mode 100644 index e7a0ac0..0000000 --- a/src/pages/game/gameview/index.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/src/pages/game/view/index.vue b/src/pages/game/view/index.vue index f24dc17..a06cb3c 100644 --- a/src/pages/game/view/index.vue +++ b/src/pages/game/view/index.vue @@ -1,5 +1,5 @@ - + diff --git a/src/utils/game_request.ts b/src/utils/game_request.ts new file mode 100644 index 0000000..da0b312 --- /dev/null +++ b/src/utils/game_request.ts @@ -0,0 +1,32 @@ +import {app} from '@/config'; +import Taro from '@tarojs/taro'; + +export interface RequestParams { + url: string; + method: 'GET' | 'POST' | 'PUT' | 'DELETE'; + header?: object; + data?: string | object; +} + +const request = (request: RequestParams): Promise => { + return new Promise((resolve, reject) => { + Taro.request({ + url: `${app.API_URL()}${request.url}`, + method: request.method, + timeout: 5000, + dataType: 'json', + header: request.header || {}, + data: request.data || {}, + success: res => { + resolve(res.data); + // Taro.hideLoading() + }, + fail: err => { + reject(err); + Taro.hideLoading(); + }, + }); + }); +}; + +export default request;