detail.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <route lang="json5">
  2. {
  3. style: {
  4. navigationStyle: 'custom',
  5. navigationBarTitleText: '',
  6. },
  7. }
  8. </route>
  9. <template>
  10. <image src="@/static/images/play/detailbg.png" class="w-full h-411rpx absolute top-70rpx"></image>
  11. <view class="w-full min-h-screen bg-bgc flex flex-col items-center">
  12. <view class="w-full text-48rpx font-700 text-white text-center mt-30rpx z-1">
  13. Increase in profit per hour
  14. </view>
  15. <view
  16. class="w-456rpx h-182rpx rounded-20rpx bg-cardlight flex flex-col items-center mt-40rpx z-1"
  17. >
  18. <view class="mt-50rpx">
  19. <view
  20. v-if="scoreData < correctData / 3"
  21. class="h-80rpx rounded-10rpx mb-10rpx flex items-center justify-between box-border p-x-30rpx"
  22. >
  23. <image src="@/static/images/play/shalou.png" class="w-35rpx h-35rpx"></image>
  24. <text class="text-white text-26rpx">{{ $t('play.again') }}</text>
  25. </view>
  26. <view
  27. v-else
  28. class="h-80rpx rounded-10rpx mb-10rpx flex flex-col items-center justify-between box-border p-x-30rpx"
  29. >
  30. <view
  31. class="flex items-center"
  32. v-if="scoreData >= correctData / 3 && scoreData < correctData / 3 + correctData / 3"
  33. >
  34. <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
  35. <image
  36. src="/static/images/play/no.png"
  37. mode="scaleToFill"
  38. class="w-38rpx h-38rpx mr-1"
  39. />
  40. <image src="/static/images/play/no.png" mode="scaleToFill" class="w-38rpx h-38rpx" />
  41. </view>
  42. <view
  43. class="flex items-center"
  44. v-if="
  45. scoreData >= correctData / 3 + correctData / 3 &&
  46. scoreData < correctData / 3 + correctData / 3 + correctData / 3
  47. "
  48. >
  49. <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
  50. <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
  51. <image src="/static/images/play/no.png" mode="scaleToFill" class="w-38rpx h-38rpx" />
  52. </view>
  53. <view
  54. class="flex items-center"
  55. v-if="scoreData >= correctData / 3 + correctData / 3 + correctData / 3"
  56. >
  57. <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
  58. <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
  59. <image src="/static/images/play/star.png" class="w-38rpx h-38rpx mr-1"></image>
  60. </view>
  61. <view class="w-130rpx flex items-center text-white justify-between mt-10rpx">
  62. <image src="@/static/images/play/shalou.png" class="w-35rpx h-35rpx"></image>
  63. <text class="text-26rpx">X{{ proportion }}%</text>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="w-690rpx h-266rpx rounded-20rpx bg-cardlight mt-190rpx flex flex-col items-center">
  69. <text class="w-616rpx mt-32rpx text-white flex items-center justify-center h-180rpx">
  70. <view class="w-616rpx flex justify-between items-center mb-20rpx">
  71. <text class="text-26rpx">{{ $t('play.Duration') }}:</text>
  72. <text class="text-24rpx">00:00:45</text>
  73. </view>
  74. <view class="w-616rpx flex justify-between items-center mb-20rpx">
  75. <text class="text-26rpx">Quantity of food:</text>
  76. <text class="text-24rpx">{{ correctData }}</text>
  77. </view>
  78. <view class="w-616rpx flex justify-between items-center mb-20rpx">
  79. <text class="text-26rpx">Received food:</text>
  80. <text class="text-24rpx">{{ scoreData }}</text>
  81. </view>
  82. </text>
  83. </view>
  84. <view
  85. @click="onConfirm"
  86. class="w-630rpx h-100rpx rounded-20rpx bg-primary flex items-center justify-center text-textc items-center mt-40rpx"
  87. >
  88. {{ $t('play.OK') }}
  89. </view>
  90. </view>
  91. </template>
  92. <script setup lang="ts">
  93. import { onLoad } from '@dcloudio/uni-app'
  94. import { useTelegramBackButton } from '@/hooks/useTelegramBackButton'
  95. const { isVisible } = useTelegramBackButton(() => {
  96. uni.navigateTo({
  97. url: '/pages/play/index',
  98. })
  99. })
  100. const correctData = ref(0)
  101. const scoreData = ref(0) // 点击数量
  102. // 当前比例
  103. const proportion = ref(0)
  104. const onConfirm = () => {
  105. uni.redirectTo({
  106. url: '/pages/play/index',
  107. })
  108. }
  109. // 判断比例方法
  110. const da = (bl: number) => {
  111. if (scoreData.value >= correctData.value / 3) {
  112. proportion.value = 5 + bl
  113. }
  114. if (scoreData.value >= correctData.value / 3 + correctData.value / 3) {
  115. proportion.value = 10 + bl
  116. }
  117. if (scoreData.value >= correctData.value / 3 + correctData.value / 3 + correctData.value / 3) {
  118. proportion.value = 15 + bl
  119. }
  120. }
  121. // 提交数据方法
  122. const submit = async () => {
  123. console.log(correctData.value)
  124. // 默认难度
  125. if (correctData.value === 30) {
  126. da(0)
  127. } else if (correctData.value === 60) {
  128. console.log('中级难度')
  129. da(1)
  130. } else {
  131. da(2)
  132. console.log('告级难度')
  133. }
  134. // 提交数据
  135. // const { data } = await postMusicRewardApi(proportion.value)
  136. }
  137. onLoad((res) => {
  138. if (res.correct !== '') {
  139. correctData.value = parseInt(res.correct)
  140. }
  141. if (res.score !== '') {
  142. scoreData.value = parseInt(res.score)
  143. if (scoreData.value >= correctData.value / 3) {
  144. submit()
  145. }
  146. }
  147. })
  148. </script>
  149. <style scoped>
  150. .header-bg {
  151. background: #636363;
  152. opacity: 0.4;
  153. }
  154. .tab-bg {
  155. background: #636363;
  156. }
  157. .button-bg {
  158. background: #8ae54a;
  159. }
  160. .page-container {
  161. position: relative;
  162. display: flex;
  163. flex-direction: column;
  164. width: 100%;
  165. height: 100vh;
  166. overflow: hidden;
  167. background: #10274e;
  168. }
  169. .header-bg {
  170. position: absolute;
  171. top: 0;
  172. left: 0;
  173. z-index: 1;
  174. width: 100%;
  175. height: 550rpx;
  176. background: #09090b;
  177. opacity: 0.4;
  178. }
  179. .content-container {
  180. position: relative;
  181. z-index: 2;
  182. flex: 1;
  183. height: 100%;
  184. }
  185. </style>