Commit 43fc2a7b by GiottoMaster

update

parent 5a3d633e
...@@ -28,12 +28,13 @@ export function switchTab(e: string) { ...@@ -28,12 +28,13 @@ export function switchTab(e: string) {
// 时间戳转换 // 时间戳转换
export const timestempToDate = (timestamp: number, n: string = '-') => { export const timestempToDate = (timestamp: number, n: string = '-') => {
const date = new Date(timestamp + 3600000 * 9) const date = new Date(timestamp + 3600000 * 9) // UTC+9 时区偏移
const pad = (num: number) => (num < 10 ? `0${num}` : `${num}`)
const year = date.getUTCFullYear() const year = date.getUTCFullYear()
const month = date.getUTCMonth() - 1 < 10 ? `0${date.getUTCMonth() - 1}` : date.getUTCMonth() - 1 const month = pad(date.getUTCMonth() + 1) // 修正:月份 +1
const day = date.getUTCDate() < 10 ? `0${date.getUTCDate()}` : date.getUTCDate() const day = pad(date.getUTCDate())
const hour = date.getUTCHours() < 10 ? `0${date.getUTCHours()}` : date.getUTCHours() const hour = pad(date.getUTCHours())
const minute = date.getUTCMinutes() < 10 ? `0${date.getUTCMinutes()}` : date.getUTCMinutes() const minute = pad(date.getUTCMinutes())
return `${year}${n}${month}${n}${day} ${hour}:${minute}` return `${year}${n}${month}${n}${day} ${hour}:${minute}`
} }
......
...@@ -546,8 +546,10 @@ const messages = { ...@@ -546,8 +546,10 @@ const messages = {
guajiangRecord: '当選記録', guajiangRecord: '当選記録',
guajiangTitle: '優勝おめでとうございます', guajiangTitle: '優勝おめでとうございます',
guajiangButton: '確認', guajiangButton: '確認',
guajiangSuccess: '優勝', guajiangSuccess: '当選履歴',
guajiangFail: 'ごめん' guajiangFail: 'ごめん',
guajiangCount1: 'そちらのスクラッチ残り回数は',
guajiangCount2: '回です。'
}, },
gupiaoDetail: { gupiaoDetail: {
title: '銘柄詳細', title: '銘柄詳細',
......
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
} }
}, },
{ {
"path": "guajiang/guajiang", "path": "scratchLottery/scratchLottery",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
......
...@@ -218,11 +218,11 @@ const button4 = computed(() => t('index.button4')) ...@@ -218,11 +218,11 @@ const button4 = computed(() => t('index.button4'))
const button6 = computed(() => t('hongli.title')) const button6 = computed(() => t('hongli.title'))
const button8 = computed(() => t('rongzi.title')) const button8 = computed(() => t('rongzi.title'))
const button7 = computed(() => t('index.button2')) const button7 = computed(() => t('index.button2'))
// const guajiang = computed(() => t('index.guajiang')) const guajiang = computed(() => t('index.guajiang'))
const buttonList = [ const buttonList = [
{ label: button1, icon: '/static/image/index/icon_1.png', url: '/subPackages/index/ipo/ipo' }, { label: button1, icon: '/static/image/index/icon_1.png', url: '/subPackages/index/ipo/ipo' },
{ label: button6, icon: '/static/image/index/icon_6.png', url: '/subPackages/index/hongli/hongli' }, { label: button6, icon: '/static/image/index/icon_6.png', url: '/subPackages/index/hongli/hongli' },
// { label: guajiang, icon: '/static/image/index/guajiang2.png', url: '/subPackages/index/guajiang/guajiang' }, { label: guajiang, icon: '/static/image/index/guajiang2.png', url: '/subPackages/index/scratchLottery/scratchLottery' },
{ label: button2, icon: '/static/image/index/icon_5.png', url: '/subPackages/index/dadan/dadan' }, { label: button2, icon: '/static/image/index/icon_5.png', url: '/subPackages/index/dadan/dadan' },
// { label: button2, icon: '/static/image/index/icon_2.png', url: '/subPackages/customerService/customerService' }, // { label: button2, icon: '/static/image/index/icon_2.png', url: '/subPackages/customerService/customerService' },
......
<template> <template>
<div class="container"> <div class="container">
<div class="bg"> <div class="bg">
<div class="navigator">
<image src="@/static/4.png" @click="goBack"></image>
</div>
<div class="bgTitle"></div> <div class="bgTitle"></div>
<div class="content" @click="openCanvas"> <div class="count">
<span>{{ t('index.guajiangCount1') }}</span>
<span>{{ showCount }}</span>
<span>{{ t('index.guajiangCount2') }}</span>
</div>
<!-- <div class="content" @click="openCanvas">
<img :src="guajiangStatus ? yigua : weigua" alt="" /> <img :src="guajiangStatus ? yigua : weigua" alt="" />
<div class="center">{{ guajiangResult }}</div> <div class="center">{{ guajiangResult }}</div>
</div> </div> -->
<div class="canvasWrap" @click="choose"> <div class="canvasWrap">
<canvas ref="bottomCanvas" canvas-id="bottomCanvas" class="bottomCanvas"></canvas> <canvas ref="bottomCanvas" canvas-id="bottomCanvas" class="bottomCanvas"></canvas>
<canvas ref="topCanvas" canvas-id="topCanvas" class="topCanvas" @touchmove="touchmove"></canvas> <canvas ref="topCanvas" canvas-id="topCanvas" class="topCanvas" @touchmove="touchmove"></canvas>
<img class="jiangpin" :src="guajiangIcon" alt="" />
<div class="center">{{ guajiangResult }}</div> <div class="center">{{ guajiangResult }}</div>
</div> </div>
<div class="bottom"> <div class="bottom">
...@@ -19,11 +28,11 @@ ...@@ -19,11 +28,11 @@
</div> </div>
</div> </div>
</div> </div>
<van-popup v-model:show="showWindow" class="window"> <!-- <van-popup v-model:show="showWindow" class="window">
<div class="title">{{ t('index.guajiangTitle') }}</div> <div class="title">{{ t('index.guajiangTitle') }}</div>
<div class="center">{{ guajiangResult }}</div> <div class="center">{{ guajiangResult }}</div>
<div class="button" @click="showWindow = false">{{ t('index.guajiangButton') }}</div> <div class="button" @click="showWindow = false">{{ t('index.guajiangButton') }}</div>
</van-popup> </van-popup> -->
<van-popup v-model:show="recordWindow" position="bottom" class="recordWindow"> <van-popup v-model:show="recordWindow" position="bottom" class="recordWindow">
<div class="close" @click="recordWindow = false"> <div class="close" @click="recordWindow = false">
...@@ -40,32 +49,35 @@ ...@@ -40,32 +49,35 @@
</div> </div>
</van-popup> </van-popup>
<van-popup v-model:show="canvasShow" class="canvasWindow"> <!-- <van-popup v-model:show="canvasShow" class="canvasWindow">
<div class="canvasWrap" @click="choose"> <div class="canvasWrap" @click="choose">
<canvas ref="bottomCanvas" canvas-id="bottomCanvas" class="bottomCanvas"></canvas> <canvas ref="bottomCanvas" canvas-id="bottomCanvas" class="bottomCanvas"></canvas>
<canvas ref="topCanvas" canvas-id="topCanvas" class="topCanvas" @touchmove="touchmove"></canvas> <canvas ref="topCanvas" canvas-id="topCanvas" class="topCanvas" @touchmove="touchmove"></canvas>
<div class="center">{{ guajiangResult }}</div> <div class="center">{{ guajiangResult }}</div>
</div> </div>
</van-popup> </van-popup> -->
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
import { getLotteryHistoryApi, getLotteryDrawApi, getLotteryCountApi } from '@/api/index' import { getLotteryHistoryApi, getLotteryDrawApi, getLotteryCountApi } from '@/api/index'
import { onShow } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import weigua from '@/static/image/index/guajiang/weigua.png' import weigua from '@/static/image/index/guajiang/weigua.png'
import yigua from '@/static/image/index/guajiang/yigua.png' import yigua from '@/static/image/index/guajiang/yigua3.png'
// import jiangpin from '@/static/image/index/guajiang/jiangpin.png'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { timestempToDate } from '@/common/common' import { timestempToDate, goBack } from '@/common/common'
const { t } = useI18n() const { t } = useI18n()
const guajiangStatus = ref(false) const guajiangStatus = ref(false)
const showWindow = ref(false) // const showWindow = ref(false)
const recordWindow = ref(false) const recordWindow = ref(false)
const guajiangResult = ref('') const guajiangResult = ref('')
const guajiangIcon = ref('')
const recordList = ref([]) const recordList = ref([])
const guajiangCount = ref(0) const guajiangCount = ref(0)
const showCount = ref(0)
onShow(() => { onLoad(() => {
// getLotteryCount() // getLotteryCount()
getLotteryHistoryList() getLotteryHistoryList()
getLotteryCount() getLotteryCount()
...@@ -77,13 +89,13 @@ const bottomCtx = ref(null) ...@@ -77,13 +89,13 @@ const bottomCtx = ref(null)
const bottomCanvas = ref(null) const bottomCanvas = ref(null)
const topCtx = ref(null) const topCtx = ref(null)
const topCanvas = ref(null) const topCanvas = ref(null)
const canvasShow = ref(false) // const canvasShow = ref(false)
const openCanvas = () => { // const openCanvas = () => {
canvasShow.value = true // canvasShow.value = true
initBottomCanvas() // initBottomCanvas()
initTopCanvas() // initTopCanvas()
} // }
const initBottomCanvas = () => { const initBottomCanvas = () => {
setTimeout(() => { setTimeout(() => {
...@@ -112,7 +124,6 @@ const initTopCanvas = () => { ...@@ -112,7 +124,6 @@ const initTopCanvas = () => {
} }
const touchmove = (e) => { const touchmove = (e) => {
console.log(e)
if (!guajiangStatus.value) { if (!guajiangStatus.value) {
guajiang() guajiang()
guajiangStatus.value = true guajiangStatus.value = true
...@@ -160,15 +171,20 @@ const getLotteryCount = async () => { ...@@ -160,15 +171,20 @@ const getLotteryCount = async () => {
const res = await getLotteryCountApi() const res = await getLotteryCountApi()
console.log(res) console.log(res)
guajiangCount.value = res.data.count guajiangCount.value = res.data.count
showCount.value = res.data.count
} }
const guajiang = async () => { const guajiang = async () => {
showCount.value = 0
guajiangStatus.value = false guajiangStatus.value = false
guajiangResult.value = '' guajiangResult.value = ''
guajiangIcon.value = ''
const res = await getLotteryDrawApi() const res = await getLotteryDrawApi()
if (res.code === 1) { if (res.code === 1) {
guajiangResult.value = res.data?.product?.name guajiangResult.value = res.data?.product?.name
guajiangIcon.value = res.data?.product?.icon
getLotteryHistoryList() getLotteryHistoryList()
// getLotteryCount()
} }
} }
</script> </script>
...@@ -186,6 +202,20 @@ const guajiang = async () => { ...@@ -186,6 +202,20 @@ const guajiang = async () => {
background-repeat: no-repeat; background-repeat: no-repeat;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
.navigator {
position: absolute;
height: 3.13rem;
display: flex;
align-items: center;
justify-content: center;
// padding-left: 1.0625rem;
image {
width: 0.625rem;
height: 1.0547rem;
padding: 0 1rem;
box-sizing: content-box;
}
}
.bgTitle { .bgTitle {
background: url('@/static/image/index/guajiang/title.png'); background: url('@/static/image/index/guajiang/title.png');
width: calc(100vw - 2.5rem); width: calc(100vw - 2.5rem);
...@@ -196,6 +226,12 @@ const guajiang = async () => { ...@@ -196,6 +226,12 @@ const guajiang = async () => {
background-repeat: no-repeat; background-repeat: no-repeat;
margin: 5vh auto 0; margin: 5vh auto 0;
} }
.count {
text-align: center;
color: #fff;
position: relative;
top: -1rem;
}
} }
.content { .content {
...@@ -235,6 +271,7 @@ const guajiang = async () => { ...@@ -235,6 +271,7 @@ const guajiang = async () => {
z-index: 100; z-index: 100;
} }
.center { .center {
display: none;
position: absolute; position: absolute;
text-align: center; text-align: center;
width: 80%; width: 80%;
...@@ -245,6 +282,18 @@ const guajiang = async () => { ...@@ -245,6 +282,18 @@ const guajiang = async () => {
top: 43%; top: 43%;
z-index: 50; z-index: 50;
} }
.jiangpin {
position: absolute;
text-align: center;
width: 80%;
object-fit: contain;
left: 10%;
color: #8ebbff;
font-size: 1.63rem;
font-weight: bold;
top: 10%;
z-index: 50;
}
} }
.bottom { .bottom {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment