feat: 处理我的权益的登录逻辑

This commit is contained in:
zoujing committed 2026-09-18 15:59:13 +08:00
1 parent 450325c986
commit d0a1427e12
2 files changed
+12 -5

No files matched your search

+1 -2
View File
@@ -117,8 +117,7 @@ onShareAppMessage(() => ({
</view>
<view v-if="!group.items.length"
class="h-[92px] rounded-card bg-alt border-[0.5px] border-line border-dashed flex flex-col items-center justify-center gap-[6px]">
<AppIcon name="info" tone="ink3" :size="22" />
class="h-[92px] rounded-card bg-alt border-[0.5px] border-line border-dashed flex items-center justify-center">
<text class="text-hint text-ink3">暂无商家</text>
</view>
</view>
+11 -3
View File
@@ -12,9 +12,10 @@
*/
import { computed, ref } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { BENEFIT_SUB_TABS, BENEFIT_TYPES } from "@/constant";
import { BENEFIT_SUB_TABS, BENEFIT_TYPES, ROUTES } from "@/constant";
import { getAccessToken } from "@/constant/token";
import { useBenefitStore } from "@/store";
import { requireLogin } from "@/utils/nav";
import { goLogin, requireLogin } from "@/utils/nav";
/** 接口不可领原因 → 提示文案(login_required / phone_required 走登录与绑定引导,不在此列) */
const CLAIM_REASON_TEXT = {
@@ -65,8 +66,15 @@ onShow(() => {
});
const onSegChange = (key) => {
// 我的权益需登录:未登录直接跳登录页且**不切分段**(用户没登录就退回权益中心),
// redirect 带 seg,登录成功后回跳到「我的权益」并拉数据
if (key === "mine" && !getAccessToken()) {
goLogin(`${ROUTES.BENEFIT}?seg=mine`);
return;
}
seg.value = key;
if (key === "mine") store.loadMine();
if (key !== "mine") return;
store.loadMine();
};
/** 权益中心:领取(入参是公开模板 id;不可领的原因由接口 claim_unavailable_reason 给出) */