| | |
| | | import { useRefeshDidShow } from './infiniteLoading'; |
| | | import { LoginFormTabs } from '@/subpackages/login/constants'; |
| | | import { useLoginedJump } from './login'; |
| | | import { useLifeRechargeContext, APIgetLifePayWxIndentityParams } from '@life-payment/core-vue'; |
| | | import { |
| | | useLifeRechargeContext, |
| | | APIgetLifePayWxIndentityParams, |
| | | WxMiniAppIndentityInfo, |
| | | LifePayPhoneMesssageCodeLoginOutput, |
| | | } from '@life-payment/core-vue'; |
| | | import { isInWeChat } from '@/utils/env'; |
| | | |
| | | export function useVirtualUserInfo() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | const { data: virtualUserInfo } = useQuery({ |
| | | queryKey: ['blLifeRecharge/lifePayUserMesssageByIduser', blLifeRecharge.accountModel.userId], |
| | | queryFn: async () => { |
| | | return await blLifeRecharge.services.lifePayUserMesssageByIduser( |
| | | { |
| | | id: blLifeRecharge.accountModel.userId, |
| | | }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | }, |
| | | placeholderData: () => ({} as LifePayPhoneMesssageCodeLoginOutput), |
| | | enabled: computed(() => !!blLifeRecharge.accountModel.userId), |
| | | staleTime: Infinity, |
| | | }); |
| | | |
| | | return { virtualUserInfo }; |
| | | } |
| | | |
| | | export function useUser() { |
| | | const userStore = useUserStore(); |
| | |
| | | return userStore.getCurrentUserInfo(); |
| | | } |
| | | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | // const { virtualUserInfo } = useVirtualUserInfo(); |
| | | |
| | | const isChannelAccount = computed(() => blLifeRecharge.accountModel.isBackClientUser); |
| | | |
| | | return { |
| | | user: userInfo, |
| | | userDetail: userDetail, |
| | |
| | | virtualPhoneNumber, |
| | | wxCode, |
| | | wxOpenId, |
| | | isChannelAccount, |
| | | // virtualUserInfo, |
| | | }; |
| | | } |
| | | |
| | |
| | | } |
| | | if (!!code && !wxCode.value) { |
| | | userStore.setWxCode(router.params.code ?? ''); |
| | | // getLifePayWxIndentity(code); |
| | | getLifePayWxIndentity(code); |
| | | } |
| | | } catch (error) {} |
| | | }); |
| | | } |
| | | |
| | | let wxIndentityPromise: Promise<WxMiniAppIndentityInfo>; |
| | | |
| | | export function useLifePayWxIndentity() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | |
| | | let params: APIgetLifePayWxIndentityParams = { |
| | | code: code, |
| | | }; |
| | | let res = await blLifeRecharge.services.getLifePayWxIndentity(params, { |
| | | showLoading: false, |
| | | }); |
| | | if (!wxIndentityPromise) { |
| | | wxIndentityPromise = blLifeRecharge.services |
| | | .getLifePayWxIndentity(params, { |
| | | showLoading: false, |
| | | }) |
| | | .finally(() => { |
| | | wxIndentityPromise = undefined; |
| | | }); |
| | | } |
| | | |
| | | let res = await wxIndentityPromise; |
| | | if (res.openId) { |
| | | userStore.setWxOpenId(res.openId); |
| | | } |