| import { useUserStore } from '@/stores/modules/user'; | 
| import Taro from '@tarojs/taro'; | 
| import { Message } from '@12333/utils'; | 
| import { useIsLogin, useUser } from './user'; | 
|   | 
| /** | 
|  * 需要登录 | 
|  */ | 
| export function useAccessLogin<T extends (...args: any[]) => any>(fn: T) { | 
|   const isLogin = useIsLogin(); | 
|   const router = Taro.useRouter(); | 
|   | 
|   const _fn = (...args2) => { | 
|     if (!isLogin.value) { | 
|       Message.confirm({ message: '请前往登录' }).then(() => { | 
|         Taro.navigateTo({ | 
|           url: `${RouterPath.authorization}`, | 
|         }); | 
|       }); | 
|       return; | 
|     } | 
|     fn?.(...args2); | 
|   }; | 
|   return _fn as T; | 
| } | 
|   | 
| type UseAccessRealOptions = { | 
|   message?: string; | 
| }; | 
|   | 
| export function useAccessReal<T extends (...args: any[]) => any>( | 
|   fn: T, | 
|   options: UseAccessRealOptions = { message: '请前往实名认证' } | 
| ) { | 
|   const { message } = options; | 
|   const { isCertified } = useUser(); | 
|   | 
|   const _fn = useAccessLogin((...args2) => { | 
|     if (!isCertified.value) { | 
|       Message.confirm({ message: message }).then(() => { | 
|         Taro.navigateTo({ | 
|           url: `${RouterPath.authenticationHome}`, | 
|         }); | 
|       }); | 
|       return; | 
|     } | 
|     fn?.(...args2); | 
|   }); | 
|   return _fn as T; | 
| } |