refactor(composable): 删除已废弃的 usePlanPermission
- 已统一使用 requireLogin,不再需要 usePlanPermission - 删除冗余的 composable 文件 影响文件: - src/composables/usePlanPermission.js (删除) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Showing
1 changed file
with
0 additions
and
65 deletions
src/composables/usePlanPermission.js
deleted
100644 → 0
| 1 | -/** | ||
| 2 | - * 计划书权限检查 Composable(重构版) | ||
| 3 | - * | ||
| 4 | - * @description 统一处理制作计划书的登录权限检查,内部调用通用 usePermission | ||
| 5 | - * @module composables/usePlanPermission | ||
| 6 | - * @author Claude Code | ||
| 7 | - * @created 2026-02-12 | ||
| 8 | - * @updated 2026-02-13 - 重构为使用通用 usePermission | ||
| 9 | - */ | ||
| 10 | - | ||
| 11 | -import { usePermission } from '@/composables/usePermission' | ||
| 12 | - | ||
| 13 | -/** | ||
| 14 | - * 计划书权限检查 Hook | ||
| 15 | - * | ||
| 16 | - * @description 提供统一的权限检查逻辑,用于制作计划书前的登录验证 | ||
| 17 | - * @returns {Object} 权限检查方法 | ||
| 18 | - * | ||
| 19 | - * @example | ||
| 20 | - * const { checkPlanPermission } = usePlanPermission() | ||
| 21 | - * | ||
| 22 | - * // 在点击计划书按钮时使用 | ||
| 23 | - * checkPlanPermission(() => { | ||
| 24 | - * // 已登录时的回调逻辑 | ||
| 25 | - * openPlanPopup(productId) | ||
| 26 | - * }) | ||
| 27 | - */ | ||
| 28 | -export function usePlanPermission() { | ||
| 29 | - // 获取通用权限检查方法 | ||
| 30 | - const { requireLogin } = usePermission() | ||
| 31 | - | ||
| 32 | - /** | ||
| 33 | - * 检查计划书权限 | ||
| 34 | - * | ||
| 35 | - * @description 判断用户是否登录,未登录时提示并引导登录,已登录时执行回调 | ||
| 36 | - * @param {Function} callback - 已登录时执行的回调函数 | ||
| 37 | - * @param {Object} customOptions - 自定义配置选项(可选) | ||
| 38 | - * @returns {boolean} 是否有权限(true=已登录,false=未登录) | ||
| 39 | - * | ||
| 40 | - * @example | ||
| 41 | - * // 使用默认配置 | ||
| 42 | - * const hasPermission = checkPlanPermission(() => { | ||
| 43 | - * console.log('用户已登录,可以制作计划书') | ||
| 44 | - * }) | ||
| 45 | - * | ||
| 46 | - * @example | ||
| 47 | - * // 自定义提示文案 | ||
| 48 | - * const hasPermission = checkPlanPermission(() => { | ||
| 49 | - * openPlanPopup(productId) | ||
| 50 | - * }, { | ||
| 51 | - * content: '请先登录后制作专属计划书', | ||
| 52 | - * confirmText: '立即登录' | ||
| 53 | - * }) | ||
| 54 | - */ | ||
| 55 | - const checkPlanPermission = (callback, customOptions = {}) => { | ||
| 56 | - console.log('[usePlanPermission] 检查计划书权限') | ||
| 57 | - | ||
| 58 | - // 调用通用权限检查(登录权限) | ||
| 59 | - return requireLogin(callback, customOptions) | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - return { | ||
| 63 | - checkPlanPermission | ||
| 64 | - } | ||
| 65 | -} |
-
Please register or login to post a comment