|
@@ -4,9 +4,9 @@
|
|
|
<view class="coin-logo" id="coin-logo" :animation="state.heartbeatAni" >
|
|
|
<img :src="staticImg.coinTotal" alt="">
|
|
|
</view>
|
|
|
- <span>{{userStore.wisdomCoin}}</span>
|
|
|
+ <span>{{wisdomCoinStore.total}}</span>
|
|
|
</view>
|
|
|
- <view class="coin-ani" id="coin-ani" v-show="state.visible" >
|
|
|
+ <view class="coin-ani" id="coin-ani" v-if="state.visible" >
|
|
|
<view
|
|
|
class="coin-item"
|
|
|
v-for="item in state.cointCount"
|
|
@@ -26,7 +26,7 @@
|
|
|
import { onMounted, ref, reactive, getCurrentInstance, defineExpose, nextTick} from 'vue'
|
|
|
import { Rive } from "@rive-app/canvas"
|
|
|
import { useStaticImg, useQueryElInfo, useSchedulerOnce } from '@/hooks/index'
|
|
|
-import { useUserStore } from '@/store'
|
|
|
+import { useWisdomCoinStore } from '@/store'
|
|
|
|
|
|
enum AniEnum {
|
|
|
'one',
|
|
@@ -44,11 +44,6 @@ enum AniEnum {
|
|
|
* 3. 出现金币 +n 的字样
|
|
|
* 4. 金币飞到右上角金币框
|
|
|
*/
|
|
|
-
|
|
|
-const staticImg = useStaticImg()
|
|
|
-
|
|
|
-const userStore = useUserStore()
|
|
|
-
|
|
|
interface State {
|
|
|
rive: Rive,
|
|
|
animation: any,
|
|
@@ -66,6 +61,10 @@ const state = reactive<Partial<State>>({
|
|
|
comVisable: false
|
|
|
})
|
|
|
|
|
|
+const staticImg = useStaticImg()
|
|
|
+
|
|
|
+const wisdomCoinStore = useWisdomCoinStore()
|
|
|
+
|
|
|
const emit = defineEmits(['onEnd'])
|
|
|
|
|
|
const coinLoginRef = ref()
|
|
@@ -116,9 +115,10 @@ const initRive = () => {
|
|
|
fadeOutRive()
|
|
|
useSchedulerOnce(() => {
|
|
|
state.visible = true
|
|
|
- goBezier()
|
|
|
+ useSchedulerOnce(() => document.getElementById('coin-count')!.style.display = 'none', 800)
|
|
|
+ useSchedulerOnce(() => goBezier(), 1000)
|
|
|
}, 1000)
|
|
|
- useSchedulerOnce(() => document.getElementById('coin-count')!.style.display = 'none', 500)
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -129,6 +129,7 @@ const createAnimationStep = (animation: UniApp.Animation, count: number) => {
|
|
|
for (let i = 0; i < count; i++) {
|
|
|
state.animation.push(animation.step({duration: 1000 + i * 600}).export())
|
|
|
useSchedulerOnce(() => {
|
|
|
+ wisdomCoinStore.total ++
|
|
|
document.getElementById(`coin-item-${i + 1}`)!.style.display = 'none'
|
|
|
state.heartbeatAni = initHeartbeatAni()
|
|
|
}, 1000 + i * 600)
|
|
@@ -159,8 +160,10 @@ const goBezier = () => {
|
|
|
|
|
|
useSchedulerOnce(() => {
|
|
|
console.log('触发emit');
|
|
|
- _resolve(2)
|
|
|
+ _resolve()
|
|
|
state.comVisable = false
|
|
|
+ state.visible = false
|
|
|
+ document.getElementById('coin-count')!.style.display = 'block'
|
|
|
}, 1200 + state.cointCount! * 600)
|
|
|
|
|
|
}
|