Przeglądaj źródła

feat: 提醒按钮显示优化

lvkun996 2 lat temu
rodzic
commit
0ee52fef46

+ 0 - 2
src/api/card.ts

@@ -16,8 +16,6 @@ export const getCardDetailById = (id: string, mode: CardModeEnum) => {
 }
 
 
-
-
 /**
  * 提交学习计划
  * @param params 

+ 8 - 6
src/components/luojigou-board/luojigou-board.vue

@@ -7,7 +7,7 @@
           <image class="dog" :src="staticImg.trumptDog"   />
           <image
             class="trumpt-icon"
-            :src="props.playLoading ? staticImg.trumptGif : staticImg.trumptPng" 
+            :src="props.playLoading ? staticImg.trumptGif : staticImg.trumptPng"
           />
         </view>
         <view class="tip " :key="props.cardDesc">
@@ -31,8 +31,9 @@
     </view>
 
     <view
-      class="mark-button" 
-      :style="{ 
+      class="mark-button"
+      v-if="props.tipsButton === 1"
+      :style="{
         width: 357 * rate + 'rpx', 
         height: 466 * rate + 'rpx',
         top: 102 * rate + 'rpx',
@@ -42,16 +43,16 @@
     >
       <view
         v-for="item in props.board.buttons"
-        class="movable-image" 
+        class="movable-image"
         :style="{
-          top: Number(item.y) * rate + 'rpx', 
+          top: Number(item.y) * rate + 'rpx',
           left: Number(item.x) * rate + 'rpx',
           width: 46 * rate + 'rpx', 
           height: 46 * rate + 'rpx',
           backgroundColor: colorMap.get(item.color),
           scale: 0.7,
           borderRadius: '50%'
-        }"  
+        }"
       />
     </view>
 
@@ -130,6 +131,7 @@ interface IProps {
   cardDesc: string,
   playLoading: boolean,
   getExpose: (records: any) => void
+  tipsButton: number
 }
 
 const staticImg = useStaticImg()

+ 11 - 17
src/pages/GameView/index.vue

@@ -19,6 +19,7 @@
         :cardType="state.card?.cardType"
         :board="state.card?.board"
         :mode="state.mode"
+        :tipsButton="state.card.tipsButton"
         :cardDesc="state.card.cardDesc"
         :playLoading="state.playLoading"
         @playAudio="playAudio"
@@ -45,8 +46,6 @@ import riveAni from '@/components/rive-ani/rive-ani.vue';
 import { ref } from 'vue';
 import { useAppBridge } from '@/hooks/app';
 
-
-
 /**
  *  README.md 里有详细的参数说明
  */
@@ -107,7 +106,7 @@ const riveAniRef = ref()
 
 const navbarState = reactive({
   progress: 1,
-  countdownTotal: 60,
+  countdownTotal: 0,
   mode: CardModeEnum.PREVIEW
 })
 
@@ -131,29 +130,26 @@ const state = reactive<State>({
 })
 
 const stx = useScheduler(() => {
-  navbarState.countdownTotal--
-  if (navbarState.countdownTotal <= 0) {
-    stx.stop()
-  }
+  navbarState.countdownTotal++
 }, 1000)
 
 // 控制游戏开始
 const gameStart = () => {
-  navbarState.countdownTotal = 60
+  navbarState.countdownTotal = 0
   stx.start()
   playAudio()
 }
 
 // 提交单张题卡数据
 const onSubmitCard = async () => {
-  
+
   stx.stop()
-  
+
   // 触发做题完成的动画
   await riveAniRef.value.start(calcQuantityStore.getStar(), state.card?.cardType)
 
   wisdomCoinStore.itemCoin += calcQuantityStore.getStar()
-  
+
   // 保存做题记录
   opraRecordStore.push({
     correctQuantity: calcQuantityStore.correctQuantity,
@@ -163,12 +159,11 @@ const onSubmitCard = async () => {
   })
 
   // 保存做题时间
-  gameCountdownStore.sum(60 - navbarState.countdownTotal)
+  gameCountdownStore.sum(navbarState.countdownTotal)
 
   // 触发游戏结束
   if (navbarState.progress == state.cardIds.length) {
-    console.log('我会触发吗');
-    
+
     gameCompleted()
 
     return
@@ -179,7 +174,7 @@ const onSubmitCard = async () => {
   if (state.opraMode == OpraModeEnum.PRACTICE) {
 
     // state.cardId
- 
+
   } else {
     navbarState.progress++
 
@@ -209,12 +204,11 @@ const gameCompleted = async () => {
   }
 
   const data = await submitlearnPortAns($par, state.queryParams?.submitUrl!)
-
   
   opraRecordStore.clear()
   // 如果opraMode 的是learn 则跳转到app-web页面
   if (state.opraMode == OpraModeEnum.LEARN) {
-    window.location.href = `https://nginx.test.luojigou.vip/app_web/learn-plan.html#/?from='exercise'`
+    // window.location.href = `https://nginx.test.luojigou.vip/app_web/learn-plan.html#/?from='exercise'`
   }
   
 }

+ 1 - 1
src/store/gameTool.ts

@@ -69,7 +69,7 @@ export const useCalcQuantityStore = defineStore(ConstantStore.QUANTITY, () => {
   })
 
   const _getStar = () => {
-    const r = state.totalQuantity - state.wrongCount
+    const r = 6 - state.wrongCount
     return r <= 0 ? 1 : r
   }
 

+ 7 - 5
src/store/opraRecords.ts

@@ -3,7 +3,6 @@ import { ConstantStore } from '@/utils/constant'
 import { defineStore } from 'pinia'
 import { useLocalStorageState } from 'vue-hooks-plus'
 
-
 export const useOpraRecordStore = defineStore(ConstantStore.OPRARECORDS, () => {
 
   const [ state, setState ] = useLocalStorageState<API.LearnPlanRecords[]>(ConstantLocalStorage.OPRARECORDS, {
@@ -17,12 +16,13 @@ export const useOpraRecordStore = defineStore(ConstantStore.OPRARECORDS, () => {
   const _get = () => state.value
 
   const _correctQuantityTotal = () => {
-
-    return state.value?.length && state.value?.map( item => item.totalQuantity - item.wrongCount).reduce( (pre, next) => pre + next )
+    return state.value?.length && state.value?.map( item => {
+      return 6 - item.wrongCount <=  0 ? 0 : 6 - item.wrongCount
+    }).reduce( (pre, next) => pre + next )
   }
 
   const _totalQuantity = () => state.value?.length && state.value?.map( item => item.totalQuantity).reduce( (pre, next) => pre + next )
- 
+
   return {
     push: _push,
     get: _get,
@@ -32,4 +32,6 @@ export const useOpraRecordStore = defineStore(ConstantStore.OPRARECORDS, () => {
     length: state.value?.length
   }
 
-})
+})
+
+

+ 2 - 0
src/typing.d.ts

@@ -51,6 +51,7 @@ declare namespace API {
     stage: Stage // 学段
     audio: string
     board: Board
+    tipsButton: string
   }
 
   interface Board {
@@ -58,6 +59,7 @@ declare namespace API {
     ansUrl: string
     buttons: {x: string, y: string, color: Color}[]
     ansList: {pos: 0 | 1 | 2 | 3 | 4 | 5 , color: Color, ans: Color, name: string}[]
+    tipsButton: number
   }
 
   interface Collect {