wupengfei
3 天以前 0cf1b417c68013df89504088c471fd113676391a
apps/bMiniApp/src/stores/modules/user.ts
@@ -31,7 +31,7 @@
  userInfo?: Nullable<API.LoginCommandCallback>;
  token?: Nullable<string>;
  refreshToken?: Nullable<string>;
  userDetail?: Nullable<API.UserInfoV2>;
  userDetail?: Nullable<API.GetEnterpriseLoginInfoQueryResult>;
  firstGetUserDetail?: boolean;
  locationCity?: string;
@@ -83,6 +83,10 @@
    accountInfo(): Partial<AccountInfo> {
      return getAccountInfoFromAccessToken(this.userInfo?.accessToken);
    },
    userId: (state) => {
      return state.userDetail?.id;
    },
    // matchMakingIdentity(state): MatchMakingIdentityEnum {
@@ -152,7 +156,7 @@
      try {
        this.setUserInfoAction(res);
        this.setTokenAction(res);
        // await this.getCurrentUserInfo();
        await this.getCurrentUserInfo();
      } catch (error) {}
    },
@@ -187,21 +191,21 @@
      // } catch (error) {}
    },
    // async getCurrentUserInfo() {
    //   try {
    //     let res = await userServices.getUserInfo({ showLoading: false });
    //     if (res) {
    async getCurrentUserInfo() {
      try {
        let res = await authServices.getEnterpriseLoginInfo({}, { showLoading: false });
        if (res) {
    //       res.frontStatus = getUserCertificationFrontStatusAdapter(
    //         res.userCertificationStatus,
    //         res.userCertificationAuditStatus
    //       );
    //       res.originalAvatarUrl = res.avatarUrl;
    //       res.avatarUrl = res.avatarUrl ? setOSSLink(res.avatarUrl) : DefaultAvatar;
    //       this.setUserDetail(res);
    //       this.firstGetUserDetail = false;
    //     }
    //   } catch (error) {}
    // },
          res.originalAvatar = res.avatar;
          res.avatar = res.avatar ? setOSSLink(res.avatar) : DefaultAvatar;
          this.setUserDetail(res);
          this.firstGetUserDetail = false;
        }
      } catch (error) {}
    },
    setTokenAction(tokenInfo: API.IdentityModelTokenCacheItem) {
      this.token = tokenInfo?.accessToken;
@@ -213,7 +217,7 @@
      setUserInfo(info);
    },
    setUserDetail(detail: API.UserInfoV2) {
    setUserDetail(detail: API.GetEnterpriseLoginInfoQueryResult) {
      this.userDetail = detail;
      setUserDetail(detail);
    },
@@ -232,7 +236,7 @@
     */
    logout() {
      this.resetState();
      myClient.removeQueries();
      // myClient.removeQueries();
      goAuthorization();
    },