|
|
@@ -12,6 +12,14 @@
|
|
|
>
|
|
|
请翻开相同的企业logo
|
|
|
</div>
|
|
|
+ <!-- 左上角按钮 -->
|
|
|
+ <div class="btn-group">
|
|
|
+ <button
|
|
|
+ class="return-home"
|
|
|
+ @click="onClickReturnHome"
|
|
|
+ />
|
|
|
+ <button class="game-rule" />
|
|
|
+ </div>
|
|
|
<!-- 卡牌列表 -->
|
|
|
<div
|
|
|
v-show="!isOver"
|
|
|
@@ -49,14 +57,6 @@
|
|
|
>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- 左上角按钮 -->
|
|
|
- <div class="btn-group">
|
|
|
- <button
|
|
|
- class="return-home"
|
|
|
- @click="onClickReturnHome"
|
|
|
- />
|
|
|
- <button class="game-rule" />
|
|
|
- </div>
|
|
|
<!-- 底部信息栏 -->
|
|
|
<div
|
|
|
v-show="!isOver"
|
|
|
@@ -69,7 +69,7 @@
|
|
|
alt=""
|
|
|
draggable="false"
|
|
|
>
|
|
|
- <span class="number">{{ bonusPoint }}</span>
|
|
|
+ <span class="number">{{ bonusPointForShow }}</span>
|
|
|
</div>
|
|
|
<div class="info-item time-count">
|
|
|
<img
|
|
|
@@ -98,6 +98,7 @@ import { useStore } from "vuex"
|
|
|
import dayjs from 'dayjs'
|
|
|
import { shuffle } from 'lodash'
|
|
|
import PairUpOver from '@/components/PairUpOver.vue'
|
|
|
+import { addScore, getScore } from '@/api.js'
|
|
|
|
|
|
const route = useRoute()
|
|
|
const router = useRouter()
|
|
|
@@ -119,7 +120,7 @@ const isOver = ref(false)
|
|
|
/**
|
|
|
* 倒计时
|
|
|
*/
|
|
|
-const timeCount = ref(120)
|
|
|
+const timeCount = ref(store.state.gameRuleList[2].second)
|
|
|
let timeCountIntervalId = null
|
|
|
timeCountIntervalId = setInterval(() => {
|
|
|
timeCount.value--
|
|
|
@@ -139,7 +140,13 @@ const timeCountForShow = computed(() => {
|
|
|
* 本次游戏积分
|
|
|
*/
|
|
|
const bonusPoint = ref(0)
|
|
|
-
|
|
|
+const bonusPointForShow = computed(() => {
|
|
|
+ if (!store.state.ifScoreLimitReached) {
|
|
|
+ return bonusPoint.value
|
|
|
+ } else {
|
|
|
+ return `已达本日上限${store.state.scoreLimit}分`
|
|
|
+ }
|
|
|
+})
|
|
|
/**
|
|
|
* 本次游戏识别企业数
|
|
|
*/
|
|
|
@@ -150,7 +157,8 @@ const recognizedCorpList = ref([])
|
|
|
*/
|
|
|
function replay() {
|
|
|
isOver.value = false
|
|
|
- timeCount.value = 10
|
|
|
+ bonusPoint.value = 0
|
|
|
+ timeCount.value = store.state.gameRuleList[2].second
|
|
|
timeCountIntervalId = setInterval(() => {
|
|
|
timeCount.value--
|
|
|
if (timeCount.value === 0) {
|
|
|
@@ -161,6 +169,19 @@ function replay() {
|
|
|
recognizedCorpList.value = 0
|
|
|
}
|
|
|
|
|
|
+watch(isOver, (vNew) => {
|
|
|
+ if (vNew) {
|
|
|
+ if (store.state.loginStatus && !store.state.ifScoreLimitReached) {
|
|
|
+ addScore(bonusPoint.value).then(() => {
|
|
|
+ getScore().then((res) => {
|
|
|
+ store.commit('setScore', res.total)
|
|
|
+ store.commit('setIfScoreLimitReached', res.hasOver)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
/**
|
|
|
* 具体游戏规则
|
|
|
*/
|
|
|
@@ -241,7 +262,6 @@ function onClickCard(card, cardIdx) {
|
|
|
setTimeout(() => {
|
|
|
cardList.value[toDeleteValue1].isDone = true
|
|
|
cardList.value[toDeleteValue2].isDone = true
|
|
|
- bonusPoint.value += 1
|
|
|
if (!recognizedCorpList.value.includes(logoIdx)) {
|
|
|
recognizedCorpList.value.push(logoIdx)
|
|
|
}
|
|
|
@@ -258,6 +278,7 @@ function onClickCard(card, cardIdx) {
|
|
|
if (cardList.value.every((item) => {
|
|
|
return item.isDone
|
|
|
})) {
|
|
|
+ bonusPoint.value += store.state.gameRuleList[2].score
|
|
|
setCardList()
|
|
|
}
|
|
|
}, 400)
|
|
|
@@ -310,6 +331,31 @@ function onClickCard(card, cardIdx) {
|
|
|
color: #FFFFFF;
|
|
|
line-height: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
}
|
|
|
+ >.btn-group{
|
|
|
+ position: absolute;
|
|
|
+ top: calc(36 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ right: calc(12 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ z-index: 1;
|
|
|
+ >button.return-home{
|
|
|
+ background-image: url(@/assets/images/icon_home.png);
|
|
|
+ background-size: contain;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-position: center center;
|
|
|
+ width: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ height: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ }
|
|
|
+ >button.game-rule{
|
|
|
+ background-image: url(@/assets/images/icon_rules.png);
|
|
|
+ background-size: contain;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-position: center center;
|
|
|
+ width: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ height: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ }
|
|
|
+ }
|
|
|
>.card-list{
|
|
|
position: absolute;
|
|
|
top: calc(163 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
@@ -372,30 +418,6 @@ function onClickCard(card, cardIdx) {
|
|
|
transform: scale(0) rotateZ(360deg);
|
|
|
}
|
|
|
}
|
|
|
- >.btn-group{
|
|
|
- position: absolute;
|
|
|
- top: calc(36 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
- right: calc(12 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- gap: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
- >button.return-home{
|
|
|
- background-image: url(@/assets/images/icon_home.png);
|
|
|
- background-size: contain;
|
|
|
- background-repeat: no-repeat;
|
|
|
- background-position: center center;
|
|
|
- width: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
- height: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
- }
|
|
|
- >button.game-rule{
|
|
|
- background-image: url(@/assets/images/icon_rules.png);
|
|
|
- background-size: contain;
|
|
|
- background-repeat: no-repeat;
|
|
|
- background-position: center center;
|
|
|
- width: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
- height: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
- }
|
|
|
- }
|
|
|
>.common-info-group{
|
|
|
position: absolute;
|
|
|
left: 50%;
|