wupengfei
2025-02-25 7160c12ee6c5eb9ffbce1caea864110f3585c0e1
Merge branch 'master' of http://120.26.58.240:8888/r/LifePaymentFront
4个文件已修改
48 ■■■■ 已修改文件
apps/taro/config/dev.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
apps/taro/config/prod.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
apps/taro/config/staging.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
apps/taro/src/hooks/user.ts 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
apps/taro/config/dev.js
@@ -7,7 +7,7 @@
    OSS_URL: '"https://waterdroptest2.oss-cn-hangzhou.aliyuncs.com/"',
    WEMAP_KEY: 'T2UBZ-N563J-ZCHFF-XDOXN-VCH7S-CJB2T',
    WXPayAppId: 'wxf940ff1d35a98493',
    WXPayAppId: '"wxf940ff1d35a98493"',
  },
  defineConstants: {},
  mini: {},
apps/taro/config/prod.js
@@ -10,7 +10,7 @@
    OSS_URL: '"https://parkmanagement.oss-cn-hangzhou.aliyuncs.com"',
    WEMAP_KEY: 'DYRBZ-ZGPCF-X3OJN-N2AA3-JWUCE-HEBXJ',
    WXPayAppId: 'wxf940ff1d35a98493',
    WXPayAppId: '"wxf940ff1d35a98493"',
  },
  defineConstants: {},
  mini: {},
apps/taro/config/staging.js
@@ -12,7 +12,7 @@
    APP_ENV: '"staging"',
    WEMAP_KEY: 'T2UBZ-N563J-ZCHFF-XDOXN-VCH7S-CJB2T',
    WXPayAppId: 'wxf940ff1d35a98493',
    WXPayAppId: '"wxf940ff1d35a98493"',
  },
  h5: {
    output: {
apps/taro/src/hooks/user.ts
@@ -8,6 +8,7 @@
import { LoginFormTabs } from '@/subpackages/login/constants';
import { useLoginedJump } from './login';
import { useLifeRechargeContext, APIgetLifePayWxIndentityParams } from '@life-payment/core-vue';
import { isInWeChat } from '@/utils/env';
export function useUser() {
  const userStore = useUserStore();
@@ -57,6 +58,8 @@
  const isAuth = computed(() => !needAuth || isLogin.value);
  const router = Taro.useRouter();
  console.log('222', 222);
  useInitWeixinJSBridge();
  Taro.useReady(async () => {
    if (isLogin.value && userStore.firstGetUserDetail) {
@@ -83,29 +86,30 @@
  const { blLifeRecharge } = useLifeRechargeContext();
  Taro.useReady(async () => {
    if (!code && !!WeixinJSBridge && !wxCode) {
      location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf940ff1d35a98493&redirect_uri=${location.href}&response_type=code&scope=snsapi_base#wechat_redirect`;
    }
    if (!!code && !wxCode) {
      try {
    try {
      //@ts-ignore
      if (!code && isInWeChat && !wxCode.value) {
        location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf940ff1d35a98493&redirect_uri=${location.href}&response_type=code&scope=snsapi_base#wechat_redirect`;
      }
      if (!!code && !wxCode.value) {
        userStore.setWxCode(router.params.code ?? '');
        let res = await getLifePayWxIndentity();
        userStore.setWxOpenId(res.openId);
      } catch (error) {}
    }
    async function getLifePayWxIndentity() {
      try {
        let params: APIgetLifePayWxIndentityParams = {
          code: code,
        };
        let res = await blLifeRecharge.services.getLifePayWxIndentity(params, {
          showLoading: false,
        });
        return res;
      } catch (error) {}
    }
      }
    } catch (error) {}
  });
  async function getLifePayWxIndentity() {
    try {
      let params: APIgetLifePayWxIndentityParams = {
        code: code,
      };
      let res = await blLifeRecharge.services.getLifePayWxIndentity(params, {
        showLoading: false,
      });
      return res;
    } catch (error) {}
  }
}
export function useGoLogin() {