update:对接会员限制次数

This commit is contained in:
2026-06-25 18:16:13 +08:00
parent 4bea563109
commit 4c32bbfb13
13 changed files with 351 additions and 52 deletions

View File

@@ -3,21 +3,23 @@ import { computed, ref } from "vue";
import { onShow } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import Avatar from "@/components/Avatar.vue";
import ModalDialog from "@/components/ModalDialog.vue";
import { topThreeColors } from "@/constants";
import {
getDailyCountAPI,
getSeasonList,
getSeasonStats,
getScoreRankList,
getTenRingRankList,
getMvpRankList,
} from "@/apis";
import { canEenter } from "@/util";
import { canEenter, getLimitCountText, isLimitReached } from "@/util";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { user, device, online, game } = storeToRefs(store);
const { getLvlName } = store;
const { user, device, online, game, dailyCount } = storeToRefs(store);
const { getLvlName, updateDailyCount } = store;
const defaultSeasonStats = {
nickName: "",
@@ -55,8 +57,12 @@ const rankLoading = ref(false);
const scoreRankList = ref([]);
const mvpRankList = ref([]);
const tenRingRankList = ref([]);
const showLimitModal = ref(false);
const isSVip = computed(() => user.value.sVip === true);
const isVip = computed(() => user.value.vip === true && !isSVip.value);
const rankedLimitText = computed(() =>
getLimitCountText("排位", dailyCount.value.ranked)
);
const isMember = (item = {}) => item.vip === true || item.sVip === true;
@@ -115,12 +121,40 @@ const toMatchPage = async (gameType, teamSize) => {
uni.$showHint(1);
return;
}
const countData = await loadDailyCount();
if (isLimitReached(countData.ranked)) {
showLimitModal.value = true;
return;
}
await uni.$checkAudio();
uni.navigateTo({
url: `/pages/match-page?gameType=${gameType}&teamSize=${teamSize}`,
});
};
const closeLimitModal = () => {
showLimitModal.value = false;
};
const goVipPage = () => {
showLimitModal.value = false;
uni.navigateTo({
url: "/pages/member/be-vip",
});
};
const loadDailyCount = async () => {
if (!user.value.id) return dailyCount.value;
try {
const result = await getDailyCountAPI();
updateDailyCount(result);
return result || dailyCount.value;
} catch (error) {
console.log("load daily count error", error);
return dailyCount.value;
}
};
const toMyGrowthPage = () => {
uni.navigateTo({
url: "/pages/my-growth",
@@ -246,7 +280,10 @@ const onChangeSeason = async (seasonId, name) => {
// 页面显示时先拿赛季列表,再拉当前赛季统计和默认榜单数据。
onShow(async () => {
try {
const seasonResult = await getSeasonList();
const [seasonResult] = await Promise.all([
getSeasonList(),
loadDailyCount(),
]);
seasonData.value = seasonResult.list || [];
if (!seasonData.value.length) {
@@ -283,12 +320,12 @@ onShow(async () => {
<template>
<Container
:title="'排位赛'"
:title="rankedLimitText ? rankedLimitText : '排位赛'"
:titleStyle="rankedLimitText ? { fontSize: '24rpx', fontWeight: 'normal' } : {}"
:showBackToGame="true"
:bgType="6"
>
<view class="battle-types-box">
<!-- :title="'今日排位次数2/2'" :titleStyle="{ fontSize: '24rpx', fontWeight: 'normal' }" -->
<view class="battle-types">
<view class="first">
<image src="../static/rank/battle-choose.png" mode="widthFix" />
@@ -585,6 +622,14 @@ onShow(async () => {
</view>
</view>
</Container>
<ModalDialog
:show="showLimitModal"
:content="'今日排位赛次数已经用完\n开通会员可增加次数'"
cancelText="知道了"
confirmText="去开通"
:onCancel="closeLimitModal"
:onConfirm="goVipPage"
/>
</template>
<style scoped>