|
@@ -26,11 +26,14 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <div class="guide-footer">
|
|
|
|
|
- <button class="btn-finish" @click="$emit('next')">
|
|
|
|
|
- <span>{{ isReplay ? '🚀' : '🎁' }}</span> {{ isReplay ? '开始探索' : '立即领取' }}
|
|
|
|
|
|
|
+ <div class="guide-footer" v-if="hasClaimed !== null">
|
|
|
|
|
+ <button class="btn-finish" v-if="hasClaimed" @click="$emit('next')">
|
|
|
|
|
+ <span>🚀</span> 开始探索
|
|
|
</button>
|
|
</button>
|
|
|
- <button class="btn-prev" v-if="!isFirst" @click="$emit('prev')">
|
|
|
|
|
|
|
+ <button class="btn-finish" v-else @click="handleClaim">
|
|
|
|
|
+ <span>🎁</span> 立即领取
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button class="btn-prev" @click="$emit('prev')">
|
|
|
上一步
|
|
上一步
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
@@ -38,6 +41,9 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import { Message } from 'element-ui'
|
|
|
|
|
+import { hasClaimedEntryIntegral, claimEntryIntegral } from '@/api/allApi'
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
name: 'RewardGuide',
|
|
name: 'RewardGuide',
|
|
|
props: {
|
|
props: {
|
|
@@ -47,6 +53,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ hasClaimed: null,
|
|
|
rewards: [
|
|
rewards: [
|
|
|
{ id: 1, icon: '💰', name: '积分奖励', value: '+200 积分' },
|
|
{ id: 1, icon: '💰', name: '积分奖励', value: '+200 积分' },
|
|
|
{ id: 2, icon: '🏅', name: '引导完成成就徽章', value: '新手成就解锁' },
|
|
{ id: 2, icon: '🏅', name: '引导完成成就徽章', value: '新手成就解锁' },
|
|
@@ -54,6 +61,33 @@ export default {
|
|
|
],
|
|
],
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ created() {
|
|
|
|
|
+ const userId = this.$store.getters.userInfo.loginId
|
|
|
|
|
+ if (userId) {
|
|
|
|
|
+ hasClaimedEntryIntegral({ userId }).then(res => {
|
|
|
|
|
+ if (res.data && res.data.data) {
|
|
|
|
|
+ this.hasClaimed = !!res.data.data.hasClaimed
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ // 接口异常默认已领过,显示「开始探索」
|
|
|
|
|
+ this.hasClaimed = true
|
|
|
|
|
+ })
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.hasClaimed = true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ handleClaim() {
|
|
|
|
|
+ const userId = this.$store.getters.userInfo.loginId
|
|
|
|
|
+ claimEntryIntegral({ userId }).then(() => {
|
|
|
|
|
+ Message.success('奖励领取成功!')
|
|
|
|
|
+ this.hasClaimed = true
|
|
|
|
|
+ this.$emit('next')
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ Message.error('领取失败,请稍后重试')
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|