123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <route lang="json5">
- {
- style: {
- navigationStyle: 'custom',
- navigationBarTitleText: '',
- },
- }
- </route>
- <template>
- <image src="@/static/images/play/detailbg.png" class="w-full h-411rpx absolute top-70rpx"></image>
- <view class="w-full min-h-screen bg-bgc flex flex-col items-center">
- <view class="w-full text-48rpx font-700 text-white text-center mt-30rpx z-1">
- Increase in profit per hour
- </view>
- <view
- class="w-456rpx h-182rpx rounded-20rpx bg-cardlight flex flex-col items-center mt-40rpx z-1"
- >
- <view class="mt-50rpx">
- <view
- v-if="scoreData < correctData / 3"
- class="h-80rpx rounded-10rpx mb-10rpx flex items-center justify-between box-border p-x-30rpx"
- >
- <image src="@/static/images/play/shalou.png" class="w-35rpx h-35rpx"></image>
- <text class="text-white text-26rpx">{{ $t('play.again') }}</text>
- </view>
- <view
- v-else
- class="h-80rpx rounded-10rpx mb-10rpx flex flex-col items-center justify-between box-border p-x-30rpx"
- >
- <view
- class="flex items-center"
- v-if="scoreData >= correctData / 3 && scoreData < correctData / 3 + correctData / 3"
- >
- <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
- <image
- src="/static/images/play/no.png"
- mode="scaleToFill"
- class="w-38rpx h-38rpx mr-1"
- />
- <image src="/static/images/play/no.png" mode="scaleToFill" class="w-38rpx h-38rpx" />
- </view>
- <view
- class="flex items-center"
- v-if="
- scoreData >= correctData / 3 + correctData / 3 &&
- scoreData < correctData / 3 + correctData / 3 + correctData / 3
- "
- >
- <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
- <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
- <image src="/static/images/play/no.png" mode="scaleToFill" class="w-38rpx h-38rpx" />
- </view>
- <view
- class="flex items-center"
- v-if="scoreData >= correctData / 3 + correctData / 3 + correctData / 3"
- >
- <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
- <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
- <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
- </view>
- <view class="w-130rpx flex items-center text-white justify-between mt-10rpx">
- <image src="@/static/images/play/shalou.png" class="w-35rpx h-35rpx"></image>
- <text class="text-26rpx">X{{ proportion }}%</text>
- </view>
- </view>
- </view>
- </view>
- <view class="w-690rpx h-266rpx rounded-20rpx bg-cardlight mt-190rpx flex flex-col items-center">
- <text class="w-616rpx mt-32rpx text-white flex items-center justify-center h-180rpx">
- <view class="w-616rpx flex justify-between items-center mb-20rpx">
- <text class="text-26rpx">{{ $t('play.Duration') }}:</text>
- <text class="text-24rpx">00:00:45</text>
- </view>
- <view class="w-616rpx flex justify-between items-center mb-20rpx">
- <text class="text-26rpx">Quantity of food:</text>
- <text class="text-24rpx">{{ correctData }}</text>
- </view>
- <view class="w-616rpx flex justify-between items-center mb-20rpx">
- <text class="text-26rpx">Received food:</text>
- <text class="text-24rpx">{{ scoreData }}</text>
- </view>
- </text>
- </view>
- <view
- @click="onConfirm"
- class="w-630rpx h-100rpx rounded-20rpx bg-primary flex items-center justify-center text-textc items-center mt-40rpx"
- >
- {{ $t('play.OK') }}
- </view>
- </view>
- </template>
- <script setup lang="ts">
- import { onLoad } from '@dcloudio/uni-app'
- import { useTelegramBackButton } from '@/hooks/useTelegramBackButton'
- const { isVisible } = useTelegramBackButton(() => {
- uni.navigateTo({
- url: '/pages/play/index',
- })
- })
- const correctData = ref(0)
- const scoreData = ref(0) // 点击数量
- // 当前比例
- const proportion = ref(0)
- const onConfirm = () => {
- uni.redirectTo({
- url: '/pages/play/index',
- })
- }
- // 判断比例方法
- const da = (bl: number) => {
- if (scoreData.value >= correctData.value / 3) {
- proportion.value = 5 + bl
- }
- if (scoreData.value >= correctData.value / 3 + correctData.value / 3) {
- proportion.value = 10 + bl
- }
- if (scoreData.value >= correctData.value / 3 + correctData.value / 3 + correctData.value / 3) {
- proportion.value = 15 + bl
- }
- }
- // 提交数据方法
- const submit = async () => {
- console.log(correctData.value)
- // 默认难度
- if (correctData.value === 30) {
- da(0)
- } else if (correctData.value === 60) {
- console.log('中级难度')
- da(1)
- } else {
- da(2)
- console.log('告级难度')
- }
- // 提交数据
- // const { data } = await postMusicRewardApi(proportion.value)
- }
- onLoad((res) => {
- if (res.correct !== '') {
- correctData.value = parseInt(res.correct)
- }
- if (res.score !== '') {
- scoreData.value = parseInt(res.score)
- if (scoreData.value >= correctData.value / 3) {
- submit()
- }
- }
- })
- </script>
- <style scoped>
- .header-bg {
- background: #636363;
- opacity: 0.4;
- }
- .tab-bg {
- background: #636363;
- }
- .button-bg {
- background: #8ae54a;
- }
- .page-container {
- position: relative;
- display: flex;
- flex-direction: column;
- width: 100%;
- height: 100vh;
- overflow: hidden;
- background: #10274e;
- }
- .header-bg {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 1;
- width: 100%;
- height: 550rpx;
- background: #09090b;
- opacity: 0.4;
- }
- .content-container {
- position: relative;
- z-index: 2;
- flex: 1;
- height: 100%;
- }
- </style>
|