From 06e7ae369f321ec1170117f9b268a9de345056ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E5=B0=91=E4=BC=9F?= Date: Fri, 14 Mar 2025 15:36:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header/UserAvatar.vue | 41 ++- src/components/LoginModal/index.vue | 308 +++++++++--------- src/stores/user.ts | 42 +-- .../Jyh/Version/Detail/CommunityInfo.vue | 51 +++ src/views/Jyh/Version/Detail/index.vue | 3 + 5 files changed, 245 insertions(+), 200 deletions(-) create mode 100644 src/views/Jyh/Version/Detail/CommunityInfo.vue diff --git a/src/components/Header/UserAvatar.vue b/src/components/Header/UserAvatar.vue index 2bc355f..a7e7f1b 100644 --- a/src/components/Header/UserAvatar.vue +++ b/src/components/Header/UserAvatar.vue @@ -52,13 +52,18 @@ const toggleDropDown = (isShow) => { } }; -const logout = async() => { +const logout = async () => { + RemoveInfo(); // 目前先强制清除用户信息,后面接口通了再调 const res = await toLogout(); await reqCatch(devLogout, {}); // 清除社区登录 if (!res.error) { RemoveInfo(); // 有权限刷新当前页,无权限需要登录返回首页 - if (route.meta?.needLogin || (route.meta?.type === 'repo' && repoInfo.value?.visibility === 'private') || orgInfo.value?.visibility === 'private') { + if ( + route.meta?.needLogin || + (route.meta?.type === 'repo' && repoInfo.value?.visibility === 'private') || + orgInfo.value?.visibility === 'private' + ) { router.push('/'); } else { router.go(0); @@ -84,11 +89,10 @@ const DEFAULT_ROUTER_PARAMS = Object.freeze({ params: { namespace: accountInfo.value.username }, - query: { - } + query: {} }); // 获取router跳转参数 -const getRouterLink = params => { +const getRouterLink = (params) => { if (typeof params === 'string') { return { ...DEFAULT_ROUTER_PARAMS, @@ -103,15 +107,18 @@ const getRouterLink = params => { }; const blockList = ref([ - [ - { id: 'myPage', label: '我的主页', to: getRouterLink('homepage') } - ], + [{ id: 'myPage', label: '我的主页', to: getRouterLink('homepage') }], [ { id: 'dashboard', label: '工作台', icon: 'gt-member-c', to: getRouterLink('dashboard') }, { id: 'myIssues', label: '我的 Issue', icon: 'gt-issue-c', to: getRouterLink('issues') }, { id: 'myDiscuss', label: '我的讨论', icon: 'gt-comment-c', to: getRouterLink('discussionCreated') }, { id: 'myMR', label: '我的合并请求', icon: 'gt-me-merge-c', to: getRouterLink('merge') }, - { id: 'notice', label: '消息通知', icon: 'gt-remind-c', to: getRouterLink({ name: 'notice', query: { status: 'all' }}) } + { + id: 'notice', + label: '消息通知', + icon: 'gt-remind-c', + to: getRouterLink({ name: 'notice', query: { status: 'all' } }) + } ], [ { id: 'myOrg', label: '我的组织', icon: 'gt-organizations-c', to: getRouterLink({ name: 'settingOrganization' }) }, @@ -120,11 +127,14 @@ const blockList = ref([ ], [ { id: 'personalSetting', label: '个人设置', icon: 'gt-setting-c', to: getRouterLink('setting') }, - { id: 'help', label: '帮助文档', icon: 'gt-file-c', href: 'https://gitcode.com/Gitcode-offical-team/GitCode-Docs/wiki' } + { + id: 'help', + label: '帮助文档', + icon: 'gt-file-c', + href: 'https://gitcode.com/Gitcode-offical-team/GitCode-Docs/wiki' + } ], - [ - { id: 'logout', label: '退出登录', icon: 'gt-exit', action: logout } - ] + [{ id: 'logout', label: '退出登录', icon: 'gt-exit', action: logout }] ]); @@ -156,7 +166,7 @@ const blockList = ref([ justify-content: space-between; font-size: 14px; font-weight: 500; - color: #2D2D2E; + color: #2d2d2e; line-height: 20px; .close-icon { cursor: pointer; @@ -164,7 +174,7 @@ const blockList = ref([ } &-id { font-size: 12px; - color: #707A87; + color: #707a87; line-height: 16px; } } @@ -183,7 +193,6 @@ const blockList = ref([ } } } - diff --git a/src/views/Jyh/Version/Detail/index.vue b/src/views/Jyh/Version/Detail/index.vue index 3fe6db8..1804037 100644 --- a/src/views/Jyh/Version/Detail/index.vue +++ b/src/views/Jyh/Version/Detail/index.vue @@ -27,11 +27,13 @@ +
+
@@ -41,6 +43,7 @@ import { ref, reactive } from 'vue'; import { useRouter, useRoute } from 'vue-router'; import { getOrgInfo } from '@/views/Org/hooks/orgInfo'; import VulnerabilitiesList from './VulnerabilitiesList.vue'; +import CommunityInfo from './CommunityInfo.vue'; import VersionInfo from './VersionInfo.vue'; const { namespace } = getOrgInfo(); const avatarUrl = '/src/assets/imgs/jyh/工程首字母图标.png';