diff --git a/src/app.config.ts b/src/app.config.ts index 8d9352f..8afabc4 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -11,5 +11,5 @@ export default defineAppConfig({ navigationBarTitleText: 'Game', navigationBarTextStyle: 'black' }, - // animation: false + animation: false }) diff --git a/src/pages/game_detail/index.scss b/src/pages/game_detail/index.scss index 6245036..e79f43b 100644 --- a/src/pages/game_detail/index.scss +++ b/src/pages/game_detail/index.scss @@ -1,5 +1,7 @@ .index { position: relative; + width: 100%; + height: 100vh; .swiper { background-color: white; diff --git a/src/pages/index/index.scss b/src/pages/index/index.scss index 76f6ba3..d0389df 100644 --- a/src/pages/index/index.scss +++ b/src/pages/index/index.scss @@ -1,4 +1,6 @@ .index { + width: 100%; + height: 100vh; .title { margin: 60px; font-size: 50px; diff --git a/src/pages/yaotouzi/index/index.scss b/src/pages/yaotouzi/index/index.scss index 01848ba..5f88f26 100644 --- a/src/pages/yaotouzi/index/index.scss +++ b/src/pages/yaotouzi/index/index.scss @@ -3,14 +3,14 @@ width: 100%; height: 100%; - .tips { - border-radius: 0; - width: 100%; - height: 60px; - } + //.tips { + // border-radius: 0; + // width: 100%; + // height: 60px; + //} .userInfo { - width: 680px; + width: 90%; margin: 20px auto; //margin: auto; padding: 20px; @@ -73,7 +73,7 @@ } .gameInfo { - width: 680px; + width: 90%; margin: 20px auto; padding: 20px; display: flex; @@ -90,7 +90,7 @@ .game_box { margin-left: 10px; - width: 250px; + width: 200px; // 文字超出显示省略号 overflow: hidden; white-space: nowrap; @@ -119,6 +119,10 @@ } } + .center { + font-size: 30px; + } + .right { .btn { @@ -178,25 +182,42 @@ .opt1 { display: flex; - justify-content: space-evenly; + justify-content: space-between; flex-wrap: wrap; text-align: center; + box-sizing: border-box; + height: 400px; + padding: 10px; + + .optt { + width: 27%; + height: 100%; + } .item { - width: 200px; + width: 100%; margin-bottom: 10px; text-align: center; - padding: 31px 0; border: 1px dashed #228960; position: relative; + height: 48%; .name { font-size: 55px; font-weight: bold; + position: absolute; + top: 40%; + left: 50%; + transform: translate(-50%, -50%); } .odd { font-size: 25px; + position: absolute; + width: 100%; + top: 60%; + left: 50%; + transform: translate(-50%, -10%); } .mask { @@ -222,8 +243,9 @@ .base { background-image: url("../../../static/cais.png"); background-size: 100% 100%; - width: 300px; - height: 400px; + //flex: 1; + width: 43%; + height: 100%; display: flex; flex-direction: column; justify-content: flex-end; @@ -234,8 +256,8 @@ .qz { background-image: url("../../../static/qz.png"); background-size: 100% 100%; - width: 300px; - height: 100px; + width: 100%; + height: 25%; margin-bottom: 20px; line-height: 100px; color: #FBE039; @@ -318,12 +340,15 @@ @keyframes flicker { 0% { border: 1px dashed #228960; + background-color: #228960; } 50% { border: 1px dashed white; + background: rgba(225, 225, 225, 0.5); } 100% { border: 1px dashed #228960; + background-color: #228960; } } diff --git a/src/pages/yaotouzi/index/index.vue b/src/pages/yaotouzi/index/index.vue index 62708c6..a4a76c2 100644 --- a/src/pages/yaotouzi/index/index.vue +++ b/src/pages/yaotouzi/index/index.vue @@ -2,110 +2,113 @@ - - - - - - {{ userInfo.nickName || '用户' }} - 积分: {{ userInfo.integral || 0 }} + + + + + + + {{ userInfo.nickName || '用户' }} + 积分: {{ userInfo.integral || 0 }} + + + + + {{ userInfo.pulse || 0 }} - - - {{ userInfo.pulse || 0 }} + + + + + + 第{{ kJData[0]?.Periods || 0 }}期开奖 + + {{ kJData[0]?.Start || 0 }} + {{ kJData[0]?.End || 0 }} + + + + + + 剩余{{ time }}s开奖 + + + 开奖记录 + 投注记录 + - - - - - - - 第{{ kJData[0]?.Periods || 0 }}期开奖 - - {{ kJData[0]?.Start || 0 }} - {{ kJData[0]?.End || 0 }} - + + + + {{ item.name }} + 赢{{ item.odds }}倍 + + {{ item.markNum }} - - 开奖记录 - 投注记录 - - - - - - {{ item.name }} - 赢{{ item.odds }}倍 - - {{ item.markNum }} - - - - - - - - {{ odds1[0].name }} - 赢{{ odds1[0].odds }}倍 - - {{ odds1[0].markNum }} + + + + {{ odds1[0].name }} + 赢{{ odds1[0].odds }}倍 + + {{ odds1[0].markNum }} + + + + {{ odds1[1].name }} + 赢{{ odds1[1].odds }}倍 + + {{ odds1[1].markNum }} + - - {{ odds1[1].name }} - 赢{{ odds1[1].odds }}倍 - - {{ odds1[1].markNum }} + + + + {{ qzTitle }} + + + {{ nowKJInfo.Start }} - {{ nowKJInfo.End }} + + + + {{ odds1[2].name }} + 赢{{ odds1[2].odds }}倍 + + {{ odds1[2].markNum }} + + + + {{ odds1[3].name }} + 赢{{ odds1[3].odds }}倍 + + {{ odds1[3].markNum }} + - - - - {{ qzTitle }} - - - {{ nowKJInfo.Start }} - {{ nowKJInfo.End }} - - - - {{ odds1[2].name }} - 赢{{ odds1[2].odds }}倍 - - {{ odds1[2].markNum }} - - - - {{ odds1[3].name }} - 赢{{ odds1[3].odds }}倍 - - {{ odds1[3].markNum }} - - - - - - - + - {{ item.name }} - 赢{{ item.odds }}倍 - - {{ item.markNum }} + > + {{ item.name }} + 赢{{ item.odds }}倍 + + {{ item.markNum }} + + - - + 重置 @@ -146,6 +149,8 @@ const odds2 = ref([]) const qzTitle = ref('请投注') +const time = ref(0) + const nowKJInfo = ref<{ Start?: string End?: string @@ -159,7 +164,7 @@ const userInfo = ref<{ avatarUrl?: string }>({}) -const zjObj = ref({}) +const zjObj = ref([]) const iMsgNum = ref(0) @@ -235,6 +240,7 @@ const initWs = () => { switch (res.code) { case 200: let num = Number(res.data) + time.value = num if (num === 5) { openDraw() } @@ -268,15 +274,12 @@ const initWs = () => { }) break case 666: + break + default: iMsgNum.value++ - const newObj = JSON.parse(res.data) - const arr = Object.values(newObj) - // zjObj.value = { - // ...zjObj.value, - // ...newObj - // } - console.log(arr) - if (iMsgNum.value === 19) { + const arr = Object.values(res) + zjObj.value.push(...arr) + if (iMsgNum.value === 3 || zjObj.value.length === 1) { iMsgNum.value = 0 startFlicker() } @@ -314,17 +317,17 @@ const openDraw = () => { }, 5000) } -const oddVal = ref(1) +const oddVal = ref(10) const changeOdd = () => { switch (oddVal.value) { - case 1: - oddVal.value = 10 - break case 10: oddVal.value = 100 break + // case 10: + // oddVal.value = 100 + // break case 100: - oddVal.value = 1 + oddVal.value = 10 break } } @@ -357,6 +360,12 @@ const addNum = (item: any) => { // 投注 const verifyBet = () => { + + if (isKj.value) return Taro.showToast({ + title: '正在开奖,不能下注', + icon: 'none' + }) + let numCount = 0 odds.value.forEach((item: any) => { @@ -424,7 +433,9 @@ const verifyBet = () => { data: data })) - getUserInfo() + setTimeout(() => { + getUserInfo() + }, 1000) qzTitle.value = '已投注' clearBet() @@ -448,22 +459,22 @@ const playAminExpand = () => { // 开始闪烁 const startFlicker = () => { - console.log('开始闪烁', zjObj.value) flickerItems(odds.value) flickerItems(odds1.value) flickerItems(odds2.value) + zjObj.value = [] } const flickerItems = (items: any[]) => { items.forEach((item) => { - for (const val in zjObj.value) { - if (item.name === zjObj.value[val]) { + zjObj.value.forEach((item2: any) => { + if (item.name === item2) { item.flicker = true setTimeout(() => { item.flicker = false }, 3000) } - } + }) }) } diff --git a/src/pages/yaotouzi/records/index.config.ts b/src/pages/yaotouzi/records/index.config.ts index 7ca222c..6ec8e4e 100644 --- a/src/pages/yaotouzi/records/index.config.ts +++ b/src/pages/yaotouzi/records/index.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ - navigationBarBackgroundColor: '#23684B' + navigationBarBackgroundColor: '#23684B', + enablePullDownRefresh: true }) diff --git a/src/pages/yaotouzi/records/index.vue b/src/pages/yaotouzi/records/index.vue index 183e23a..9045958 100644 --- a/src/pages/yaotouzi/records/index.vue +++ b/src/pages/yaotouzi/records/index.vue @@ -13,23 +13,29 @@ @@ -46,17 +52,26 @@ const typeNum = ref(0) Taro.useLoad((options) => { typeNum.value = Number(options.type) Taro.setNavigationBarTitle({title: options.type === '1' ? '开奖记录' : '投注记录'}) - getData(options.type) + getData() }) -const getData = async (type: string) => { +Taro.usePullDownRefresh(() => { + getData() +}) + +const getData = async () => { let res: any - if (type === '1') { + if (typeNum.value === 1) { res = await getKaiJiangList() + list.value = res.data.data } else { res = await getTzJl(Taro.getStorageSync('uid')) + console.log(res) + list.value = res.data.data.sort( + (a: any, b: any) => b.Periods - a.Periods + ) } - list.value = res.data.data + Taro.stopPullDownRefresh() } @@ -65,8 +80,11 @@ const getData = async (type: string) => { display: flex; flex-direction: column; align-items: center; - justify-content: center; + //justify-content: center; font-size: 35px; + width: 100%; + padding: 10px; + box-sizing: border-box; } .card { @@ -86,6 +104,7 @@ const getData = async (type: string) => { display: flex; justify-content: space-between; align-items: center; + width: 100%; } diff --git a/src/utils/request.ts b/src/utils/request.ts index e904284..d08c005 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -9,6 +9,9 @@ export interface RequestParams { } const request = (request: RequestParams): Promise => { + Taro.showLoading({ + title: '加载中', + }) return new Promise((resolve, reject) => { Taro.request({ url: `${app.API_URL()}${request.url}`, @@ -19,9 +22,11 @@ const request = (request: RequestParams): Promise => { data: request.data || {}, success: (res) => { resolve(res.data); + Taro.hideLoading(); }, fail: (err) => { reject(err); + Taro.hideLoading(); }, }); });