1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-11-13 22:11:42 +08:00

feat: 恋爱模块入口校验与强制解锁弹窗

- 首页快捷导航/我的页跳转恋爱日记前拦截:设密码且无有效 token 先弹解锁弹窗
- love 页初始化与清单/相册/故事三模块页防分享直达:不可关闭密码弹窗,解锁后才加载数据
- 模块数据接口 401 locked 时自动弹解锁弹窗
- 解锁弹窗开启验证码时打开即拉取显示
- 抽取 useLoveModuleUnlock 共享 hook 统一解锁流程
This commit is contained in:
小莫唐尼
2026-09-13 02:34:17 +08:00
parent 713646fc93
commit 2327cfa312
9 changed files with 345 additions and 78 deletions
+18
View File
@@ -4,6 +4,7 @@
import { getBlogStatistics } from '@/api/halo'
import { useAppConfigStore } from '@/store/appConfig'
import { useFavoritesStore } from '@/store/favorites'
import { useLoveModuleUnlock } from '@/hooks/useLoveModuleUnlock'
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
import { t } from '@/locale'
import type { IBlogStats } from '@/api/types/halo'
@@ -158,10 +159,22 @@
}
/* ---------------- 交互 ---------------- */
/* 恋爱模块解锁拦截(目前仅恋爱日记设密码,命中锁定则先解锁再跳转;样式不变) */
const {
unlockModalVisible,
unlockTip,
handleUnlockRequest,
handleUnlockSuccess,
interceptNavigateByPath,
} = useLoveModuleUnlock()
function handleNavGoTo(data : { path : string }) {
const { path } = data
if (!path) { return }
// 命中恋爱模块且锁定 → 弹解锁弹窗,解锁成功后由 hook 自动跳转
if (interceptNavigateByPath(path)) { return }
uni.navigateTo({ url: path })
}
@@ -294,5 +307,10 @@
</template>
<uh-page-copyright />
<!-- 恋爱模块解锁弹窗(解锁成功自动跳转) -->
<uh-unlock-popup v-model:show="unlockModalVisible" title="请解锁" captcha-enabled
:tip="unlockTip" placeholder="请输入密码" confirm-text="进入" :request="handleUnlockRequest"
@success="handleUnlockSuccess" />
</view>
</template>