From 85ceb0fded70c58e808783802fcf499f1580c312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E5=B0=91=E4=BC=9F?= Date: Sat, 15 Mar 2025 15:40:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9F=B1=E7=8A=B6=E5=9B=BE=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ChartLine/index.vue | 94 +++++++++++++++++++ src/router/interceptor.ts | 32 ++++--- .../Jyh/Version/Detail/CommunityInfo.vue | 91 +----------------- 3 files changed, 118 insertions(+), 99 deletions(-) create mode 100644 src/components/ChartLine/index.vue diff --git a/src/components/ChartLine/index.vue b/src/components/ChartLine/index.vue new file mode 100644 index 0000000..ccccbde --- /dev/null +++ b/src/components/ChartLine/index.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/src/router/interceptor.ts b/src/router/interceptor.ts index c7c8fc8..c5b0cf9 100644 --- a/src/router/interceptor.ts +++ b/src/router/interceptor.ts @@ -41,7 +41,7 @@ const isRepoVisited = (id: string): boolean => { // }; const fromHomeWeb = ['home', 'search', 'gStar', 'gStarApply', 'explore']; -export const injectRouter = router => { +export const injectRouter = (router) => { const account = useAccountStore(); router.beforeEach(async (to, from) => { @@ -56,7 +56,7 @@ export const injectRouter = router => { path_name: Array.isArray(namespace) ? namespace.join('/') : namespace }; let res = await reqCatch(getPathType, params); - if (!res.error) { + if (!res.error && res.data) { res = res?.data?.data; if (res?.type === null) { @@ -77,15 +77,18 @@ export const injectRouter = router => { const BASE_URL = (import.meta as any).env.VITE_HOST; const beforeRef = sessionStorage.getItem('ref'); const ref = beforeRef || document.referrer || ''; - if (!fromHomeWeb.includes(to.name)) { // 设置全局ref + if (!fromHomeWeb.includes(to.name)) { + // 设置全局ref window.page_ref = ref; sessionStorage.setItem('ref', BASE_URL + to.fullPath); } // 获取组织详情 - if (to.meta.type === 'org' || globalStore.namespaceType === 1) { // 组织相关页面 || 组织主页 + if (to.meta.type === 'org' || globalStore.namespaceType === 1) { + // 组织相关页面 || 组织主页 const { orgId } = useOrgId('%2F', to.params.namespace); - if (orgId.value !== currentOrgId) { // 第一次进入或切换组织时调用接口 + if (orgId.value !== currentOrgId) { + // 第一次进入或切换组织时调用接口 const { setOrgInfo, setAccessLevel, setVisibility } = orgInfoStore(); const res = await reqCatch(getOrg, { orgId: orgId.value, with_full_path: true }); if (!res.error) { @@ -94,7 +97,8 @@ export const injectRouter = router => { if (res?.error?.error_code === 404) { return { name: '404' }; } - if (res?.error?.error_code === 403) { // 403代表无私有组织权限 + if (res?.error?.error_code === 403) { + // 403代表无私有组织权限 setAccessLevel(0); setVisibility('private'); return { name: '403' }; @@ -137,8 +141,8 @@ export const injectRouter = router => { ['DISCUSSION', 'repoDiscussion'], ['COMMUNITY', 'reqCommunity'] ]); - modules.forEach(item => { - if ((to.name === moduleRouteConfig.get(item.key)) && item.value === '0') { + modules.forEach((item) => { + if (to.name === moduleRouteConfig.get(item.key) && item.value === '0') { globalStore.setIsNotFound(true); } }); @@ -204,15 +208,18 @@ export const injectRouter = router => { } // 验证登录权限 - if (to.meta.needLogin) { // 是否需要登录 - if (account.isLogin) { // 已登录 + if (to.meta.needLogin) { + // 是否需要登录 + if (account.isLogin) { + // 已登录 return true; } else { emitEvent('login', { triggerType: to.meta?.loginType, Authorization: Boolean(to?.meta?.Authorization) }); return false; } } else { - if (account.isLogin && to.meta.loginHidden) { // 已登录,不能访问某些页面,进行跳转处理(如:登录注册) + if (account.isLogin && to.meta.loginHidden) { + // 已登录,不能访问某些页面,进行跳转处理(如:登录注册) const toOauth = to.name === 'oauth' && /(.*)_(.*)/.exec(to.query?.state); // 三方授权不跳转 const fromAtomGit = to.query.installation_id && /atomgit.com/.test(document.referrer); // 来自AtomGit应用的跳转 if (toOauth || fromAtomGit) return true; @@ -223,7 +230,8 @@ export const injectRouter = router => { }); router.afterEach((to, from) => { // 上报PV - if (to.fullPath === '/' || to.fullPath !== from.fullPath) { // 同地址切换不上报 + if (to.fullPath === '/' || to.fullPath !== from.fullPath) { + // 同地址切换不上报 if (!(to.name === 'repo' || to.name === 'repoDir') || (from.fullPath === '/' && to.name === 'repoDir')) { // 子应用单独处理 if (fromHomeWeb.includes(to.name)) return; diff --git a/src/views/Jyh/Version/Detail/CommunityInfo.vue b/src/views/Jyh/Version/Detail/CommunityInfo.vue index 8675ef5..275ce9e 100644 --- a/src/views/Jyh/Version/Detail/CommunityInfo.vue +++ b/src/views/Jyh/Version/Detail/CommunityInfo.vue @@ -31,95 +31,15 @@
贡献者分布

有关Pull Request创建者的公司信息和地区分布(使用公共GitHub信息进行分析)

- - - -

国家/地球分布

-
- - -

组织/公司分布

-
-
+
+ +