用户信息接口对接Mock数据
This commit is contained in:
@@ -126,10 +126,10 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
/** 获取用户组织配额权限 */
|
/** 获取用户组织配额权限 */
|
||||||
if (!localStorage.getItem('group_quota')) {
|
// if (!localStorage.getItem('group_quota')) {
|
||||||
const { getUserCreateOrg } = getOrgInfo();
|
// const { getUserCreateOrg } = getOrgInfo();
|
||||||
getUserCreateOrg();
|
// getUserCreateOrg();
|
||||||
}
|
// }
|
||||||
checkoutFirstTime();
|
checkoutFirstTime();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ export function getUserToken(): catchRt<any> {
|
|||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
export function getUserInfo(): catchRt<any> {
|
export function getUserInfo(): catchRt<any> {
|
||||||
return reqCatchV2(() => request({
|
return reqCatchV2(() => request({
|
||||||
url: '/api/v1/user/oauth/userInfo',
|
url: '/api/v1/user/info',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
}, {
|
}, {
|
||||||
customError: true
|
customError: true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-link to="/personalCenter?status=all&message_type=mr">
|
<router-link to="/personalCenter?status=all&message_type=mr">
|
||||||
<d-badge class="g-notice" :count="counts" :offset="[-2, 4]" :hidden="!counts" status="danger">
|
<d-badge class="g-notice" :count="accountInfo.noticeUnreadNum" :offset="[-2, 4]" :hidden="!accountInfo.noticeUnreadNum" status="danger">
|
||||||
<d-icon style="font-size: 16px" name="notice" />
|
<d-icon style="font-size: 16px" name="notice" />
|
||||||
</d-badge>
|
</d-badge>
|
||||||
</router-link>
|
</router-link>
|
||||||
@@ -11,7 +11,9 @@ import { ref, onMounted, onBeforeUnmount } from 'vue';
|
|||||||
import { getMessageCount } from '@/api/notice';
|
import { getMessageCount } from '@/api/notice';
|
||||||
import { addEventListener, offEvent } from '@/utils/eventBus';
|
import { addEventListener, offEvent } from '@/utils/eventBus';
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
|
import { useAccount } from '@/utils/hooks/useAccount';
|
||||||
|
|
||||||
|
const { accountInfo, RemoveInfo } = useAccount();
|
||||||
const counts = ref(9);
|
const counts = ref(9);
|
||||||
const getCounts = () => {
|
const getCounts = () => {
|
||||||
getMessageCount().then((result) => {
|
getMessageCount().then((result) => {
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="g-user-avatar flex-center ml-1" @click="toggleDropDown">
|
<div class="g-user-avatar flex-center ml-1" @click="toggleDropDown">
|
||||||
<GAvatar :width="28" :height="28" :name="accountInfo.nickname" :src="accountInfo.avatar"></GAvatar>
|
<GAvatar :width="28" :height="28" :name="accountInfo.username" :src="accountInfo.avatar"></GAvatar>
|
||||||
</div>
|
</div>
|
||||||
<d-drawer v-model="visible" class="g-user-drawer-container">
|
<d-drawer v-model="visible" class="g-user-drawer-container">
|
||||||
<div class="g-user-drawer">
|
<div class="g-user-drawer">
|
||||||
<div class="g-user-drawer-info">
|
<div class="g-user-drawer-info">
|
||||||
<div class="g-user-avatar">
|
<div class="g-user-avatar">
|
||||||
<GAvatar style="width: 28px" :name="accountInfo.nickname" :src="accountInfo.avatar"></GAvatar>
|
<GAvatar style="width: 28px" :name="accountInfo.username" :src="accountInfo.avatar"></GAvatar>
|
||||||
</div>
|
</div>
|
||||||
<div class="g-user-drawer-info-list">
|
<div class="g-user-drawer-info-list">
|
||||||
<div class="g-user-drawer-info-list-name">
|
<div class="g-user-drawer-info-list-name">
|
||||||
<span class="break-all">{{ accountInfo.nickname }}</span>
|
<span class="break-all">{{ accountInfo.username?accountInfo.username[0]:'' }}</span>
|
||||||
<GIcon class="close-icon" name="gt-close" size="12" @click="handleClose" />
|
<GIcon class="close-icon" name="gt-close" size="12" @click="handleClose" />
|
||||||
</div>
|
</div>
|
||||||
<div class="g-user-drawer-info-list-id break-all">@{{ accountInfo.username }}</div>
|
<div class="g-user-drawer-info-list-id break-all">@{{ accountInfo.username }}</div>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export interface AccountInfo {
|
|||||||
export const useAccountStore = defineStore('accountInfo', () => {
|
export const useAccountStore = defineStore('accountInfo', () => {
|
||||||
const cacheInfo = localStorage.getItem('userInfo');
|
const cacheInfo = localStorage.getItem('userInfo');
|
||||||
const isLogin = ref(Boolean(localStorage.getItem('access_token')));
|
const isLogin = ref(Boolean(localStorage.getItem('access_token')));
|
||||||
const userInfo = cacheInfo ? JSON.parse(cacheInfo) : {};
|
const userInfo = cacheInfo ? JSON.parse(cacheInfo).data : {};
|
||||||
const accountInfo = reactive<AccountInfo>({
|
const accountInfo = reactive<AccountInfo>({
|
||||||
access_token: localStorage.getItem('access_token') || '',
|
access_token: localStorage.getItem('access_token') || '',
|
||||||
refresh_token: localStorage.getItem('refresh_token') || '',
|
refresh_token: localStorage.getItem('refresh_token') || '',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const setPassportPrefix = (url: string, method: string) => {
|
|||||||
if (prefix) {
|
if (prefix) {
|
||||||
if (url?.includes('/api/v1/user/')) {
|
if (url?.includes('/api/v1/user/')) {
|
||||||
// 用户信息相关
|
// 用户信息相关
|
||||||
return `${prefix}${url}`;
|
return `${url}`;
|
||||||
}
|
}
|
||||||
if (url?.includes('/api/v1/oauth/')) {
|
if (url?.includes('/api/v1/oauth/')) {
|
||||||
// 用户权限
|
// 用户权限
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
</d-breadcrumb>
|
</d-breadcrumb>
|
||||||
<div class="version-detail-header">
|
<div class="version-detail-header">
|
||||||
<div class="header-top">
|
<div class="header-top">
|
||||||
<GAvatar style="margin-right: 16px" :src="avatarUrl" name="Vue" :width="72" :height="72"></GAvatar>
|
<GAvatar style="margin-right: 16px" :name="accountInfo.username" :src="accountInfo.avatar" name="Vue" :width="72" :height="72"></GAvatar>
|
||||||
<div class="pt-24">
|
<div class="pt-24">
|
||||||
<div class="header-title1">UserName</div>
|
<div class="header-title1">{{ accountInfo.username || '--' }}</div>
|
||||||
<div class="header-div">
|
<div class="header-div">
|
||||||
<span class="span1">介绍:包含项目管理、代码托管、CI/CD 和制品库等功能,提供完整的研发流程建议的新的团队…</span>
|
<span class="span1">介绍:包含项目管理、代码托管、CI/CD 和制品库等功能,提供完整的研发流程建议的新的团队…</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,11 +44,13 @@ import EarlyWarning from './Detail/EarlyWarning.vue';
|
|||||||
import SubscribeList from './Detail/SubscribeList.vue';
|
import SubscribeList from './Detail/SubscribeList.vue';
|
||||||
import OrganizationManage from './OrganizationManage/OrganizationManage.vue';
|
import OrganizationManage from './OrganizationManage/OrganizationManage.vue';
|
||||||
import InvitationNoticeList from './Detail/InvitationNoticeList.vue';
|
import InvitationNoticeList from './Detail/InvitationNoticeList.vue';
|
||||||
|
import { useAccount } from '@/utils/hooks/useAccount';
|
||||||
|
|
||||||
const { namespace } = getOrgInfo();
|
const { namespace } = getOrgInfo();
|
||||||
const avatarUrl = '/src/assets/imgs/avatar/male.png';
|
const avatarUrl = '/src/assets/imgs/avatar/male.png';
|
||||||
|
|
||||||
const selectTab = ref('yjtzlb');
|
const selectTab = ref('yjtzlb');
|
||||||
|
const { accountInfo, RemoveInfo } = useAccount();
|
||||||
|
|
||||||
// 删除弹窗
|
// 删除弹窗
|
||||||
const item = ref('');
|
const item = ref('');
|
||||||
|
|||||||
Reference in New Issue
Block a user