zhengyiming
6 天以前 34e523d5ed7f25a0bc20532577ccde90386352aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { useUserStore } from '@/store/modules/user';
import { UserUtils } from '@bole-core/core';
// import * as userRoleServices from '@/services/api/UserRole';
import * as userServices from '@/services/api/User';
import * as ParkBountyApplyServices from '@/services/api/ParkBountyApply';
import { useQuery, useQueryClient } from '@tanstack/vue-query';
 
export function useIsSystemAdmin() {
  const userStore = useUserStore();
  const { accountInfo } = storeToRefs(userStore);
  const isSystemAdmin = computed(() => UserUtils.isSystemRole(accountInfo.value));
  return isSystemAdmin;
}
 
export function useUser() {
  const userStore = useUserStore();
 
  const { userId, userInfo } = storeToRefs(userStore);
 
  const { data: userDetail } = useQuery({
    queryKey: ['ParkBountyApplyServices/get818UserInfo'],
    queryFn: async () => {
      return await ParkBountyApplyServices.get818UserInfo();
    },
    placeholderData: () => ({} as API.UserInfoV2),
  });
 
  return {
    user: userInfo,
    userId: userId,
    userDetail: userDetail,
  };
}