From 6a0d8a3ac102323f7a1a7296cba2d822edc2b382 Mon Sep 17 00:00:00 2001
From: lbw_9527443 <780139497@qq.com>
Date: Wed, 4 Feb 2026 19:04:00 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0API=E5=B1=82=E5=92=8C?=
=?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E5=A4=9A=E9=A1=B5=E9=9D=A2=E5=AF=BC=E8=88=AA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增axios依赖并创建HTTP工具模块
- 实现API接口函数用于获取用户状态
- 重构路由配置,支持仪表盘、监控、策略、线索管理和系统设置页面
- 更新主视图组件,根据路由动态显示对应页面内容
---
247_Contry/package.json | 1 +
247_Contry/pnpm-lock.yaml | 176 +++++++++++++++++++++++++++
247_Contry/src/api/index.ts | 25 ++++
247_Contry/src/router/index.ts | 29 ++++-
247_Contry/src/utils/https.ts | 34 ++++++
247_Contry/src/views/index/index.vue | 24 +++-
6 files changed, 282 insertions(+), 7 deletions(-)
create mode 100644 247_Contry/src/api/index.ts
create mode 100644 247_Contry/src/utils/https.ts
diff --git a/247_Contry/package.json b/247_Contry/package.json
index d954149..d19a079 100644
--- a/247_Contry/package.json
+++ b/247_Contry/package.json
@@ -17,6 +17,7 @@
"dependencies": {
"@antv/g6": "^5.0.51",
"@tailwindcss/vite": "^4.1.18",
+ "axios": "^1.12.2",
"echarts": "^6.0.0",
"pinia": "^3.0.4",
"tailwindcss": "^4.1.18",
diff --git a/247_Contry/pnpm-lock.yaml b/247_Contry/pnpm-lock.yaml
index 69f88a5..5d64e54 100644
--- a/247_Contry/pnpm-lock.yaml
+++ b/247_Contry/pnpm-lock.yaml
@@ -14,6 +14,9 @@ importers:
'@tailwindcss/vite':
specifier: ^4.1.18
version: 4.1.18(vite@7.3.0(@types/node@24.10.4)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.46.0))
+ axios:
+ specifier: ^1.12.2
+ version: 1.13.4
echarts:
specifier: ^6.0.0
version: 6.0.0
@@ -909,6 +912,12 @@ packages:
resolution: {integrity: sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig==}
engines: {node: '>=14'}
+ asynckit@0.4.0:
+ resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
+
+ axios@1.13.4:
+ resolution: {integrity: sha512-1wVkUaAO6WyaYtCkcYCOx12ZgpGf9Zif+qXa4n+oYzK558YryKqiL6UWwd5DqiH3VRW0GYhTZQ/vlgJrCoNQlg==}
+
base64-arraybuffer@1.0.2:
resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
engines: {node: '>= 0.6.0'}
@@ -938,6 +947,10 @@ packages:
resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==}
engines: {node: '>=18'}
+ call-bind-apply-helpers@1.0.2:
+ resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
+ engines: {node: '>= 0.4'}
+
caniuse-lite@1.0.30001762:
resolution: {integrity: sha512-PxZwGNvH7Ak8WX5iXzoK1KPZttBXNPuaOvI2ZYU7NrlM+d9Ov+TUvlLOBNGzVXAntMSMMlJPd+jY6ovrVjSmUw==}
@@ -951,6 +964,10 @@ packages:
color-string@1.9.1:
resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==}
+ combined-stream@1.0.8:
+ resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
+ engines: {node: '>= 0.8'}
+
comlink@4.4.2:
resolution: {integrity: sha512-OxGdvBmJuNKSCMO4NTl1L47VRp6xn2wG4F/2hYzB6tiCb709otOxtEYCSvK80PtjODfXXZu8ds+Nw5kVCjqd2g==}
@@ -1104,10 +1121,18 @@ packages:
resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==}
engines: {node: '>=12'}
+ delayed-stream@1.0.0:
+ resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
+ engines: {node: '>=0.4.0'}
+
detect-libc@2.1.2:
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
engines: {node: '>=8'}
+ dunder-proto@1.0.1:
+ resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
+ engines: {node: '>= 0.4'}
+
echarts@6.0.0:
resolution: {integrity: sha512-Tte/grDQRiETQP4xz3iZWSvoHrkCQtwqd6hs+mifXcjrCuo2iKWbajFObuLJVBlDIJlOzgQPd1hsaKt/3+OMkQ==}
@@ -1129,9 +1154,25 @@ packages:
error-stack-parser-es@1.0.5:
resolution: {integrity: sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==}
+ es-define-property@1.0.1:
+ resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
+ engines: {node: '>= 0.4'}
+
+ es-errors@1.3.0:
+ resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
+ engines: {node: '>= 0.4'}
+
es-module-lexer@2.0.0:
resolution: {integrity: sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==}
+ es-object-atoms@1.1.1:
+ resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}
+ engines: {node: '>= 0.4'}
+
+ es-set-tostringtag@2.1.0:
+ resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==}
+ engines: {node: '>= 0.4'}
+
esbuild@0.27.2:
resolution: {integrity: sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==}
engines: {node: '>=18'}
@@ -1185,21 +1226,49 @@ packages:
fecha@4.2.3:
resolution: {integrity: sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==}
+ follow-redirects@1.15.11:
+ resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==}
+ engines: {node: '>=4.0'}
+ peerDependencies:
+ debug: '*'
+ peerDependenciesMeta:
+ debug:
+ optional: true
+
+ form-data@4.0.5:
+ resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==}
+ engines: {node: '>= 6'}
+
fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
+ function-bind@1.1.2:
+ resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
+
gensync@1.0.0-beta.2:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
+ get-intrinsic@1.3.0:
+ resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
+ engines: {node: '>= 0.4'}
+
+ get-proto@1.0.1:
+ resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
+ engines: {node: '>= 0.4'}
+
gl-matrix@3.4.4:
resolution: {integrity: sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==}
glob-to-regexp@0.4.1:
resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==}
+ gopd@1.2.0:
+ resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
+ engines: {node: '>= 0.4'}
+
graceful-fs@4.2.11:
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
@@ -1210,6 +1279,18 @@ packages:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
+ has-symbols@1.1.0:
+ resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
+ engines: {node: '>= 0.4'}
+
+ has-tostringtag@1.0.2:
+ resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==}
+ engines: {node: '>= 0.4'}
+
+ hasown@2.0.2:
+ resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
+ engines: {node: '>= 0.4'}
+
hookable@5.5.3:
resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==}
@@ -1377,6 +1458,10 @@ packages:
magic-string@0.30.21:
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
+ math-intrinsics@1.1.0:
+ resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
+ engines: {node: '>= 0.4'}
+
memorystream@0.3.1:
resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==}
engines: {node: '>= 0.10.0'}
@@ -1495,6 +1580,9 @@ packages:
engines: {node: '>=14'}
hasBin: true
+ proxy-from-env@1.1.0:
+ resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
+
randombytes@2.1.0:
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
@@ -2719,6 +2807,16 @@ snapshots:
ansis@4.2.0: {}
+ asynckit@0.4.0: {}
+
+ axios@1.13.4:
+ dependencies:
+ follow-redirects: 1.15.11
+ form-data: 4.0.5
+ proxy-from-env: 1.1.0
+ transitivePeerDependencies:
+ - debug
+
base64-arraybuffer@1.0.2: {}
baseline-browser-mapping@2.9.11: {}
@@ -2743,6 +2841,11 @@ snapshots:
dependencies:
run-applescript: 7.1.0
+ call-bind-apply-helpers@1.0.2:
+ dependencies:
+ es-errors: 1.3.0
+ function-bind: 1.1.2
+
caniuse-lite@1.0.30001762: {}
chrome-trace-event@1.0.4: {}
@@ -2754,6 +2857,10 @@ snapshots:
color-name: 1.1.4
simple-swizzle: 0.2.4
+ combined-stream@1.0.8:
+ dependencies:
+ delayed-stream: 1.0.0
+
comlink@4.4.2: {}
commander@2.20.3: {}
@@ -2889,8 +2996,16 @@ snapshots:
define-lazy-prop@3.0.0: {}
+ delayed-stream@1.0.0: {}
+
detect-libc@2.1.2: {}
+ dunder-proto@1.0.1:
+ dependencies:
+ call-bind-apply-helpers: 1.0.2
+ es-errors: 1.3.0
+ gopd: 1.2.0
+
echarts@6.0.0:
dependencies:
tslib: 2.3.0
@@ -2909,8 +3024,23 @@ snapshots:
error-stack-parser-es@1.0.5: {}
+ es-define-property@1.0.1: {}
+
+ es-errors@1.3.0: {}
+
es-module-lexer@2.0.0: {}
+ es-object-atoms@1.1.1:
+ dependencies:
+ es-errors: 1.3.0
+
+ es-set-tostringtag@2.1.0:
+ dependencies:
+ es-errors: 1.3.0
+ get-intrinsic: 1.3.0
+ has-tostringtag: 1.0.2
+ hasown: 2.0.2
+
esbuild@0.27.2:
optionalDependencies:
'@esbuild/aix-ppc64': 0.27.2
@@ -2971,15 +3101,47 @@ snapshots:
fecha@4.2.3: {}
+ follow-redirects@1.15.11: {}
+
+ form-data@4.0.5:
+ dependencies:
+ asynckit: 0.4.0
+ combined-stream: 1.0.8
+ es-set-tostringtag: 2.1.0
+ hasown: 2.0.2
+ mime-types: 2.1.35
+
fsevents@2.3.3:
optional: true
+ function-bind@1.1.2: {}
+
gensync@1.0.0-beta.2: {}
+ get-intrinsic@1.3.0:
+ dependencies:
+ call-bind-apply-helpers: 1.0.2
+ es-define-property: 1.0.1
+ es-errors: 1.3.0
+ es-object-atoms: 1.1.1
+ function-bind: 1.1.2
+ get-proto: 1.0.1
+ gopd: 1.2.0
+ has-symbols: 1.1.0
+ hasown: 2.0.2
+ math-intrinsics: 1.1.0
+
+ get-proto@1.0.1:
+ dependencies:
+ dunder-proto: 1.0.1
+ es-object-atoms: 1.1.1
+
gl-matrix@3.4.4: {}
glob-to-regexp@0.4.1: {}
+ gopd@1.2.0: {}
+
graceful-fs@4.2.11: {}
graphlib@2.1.8:
@@ -2988,6 +3150,16 @@ snapshots:
has-flag@4.0.0: {}
+ has-symbols@1.1.0: {}
+
+ has-tostringtag@1.0.2:
+ dependencies:
+ has-symbols: 1.1.0
+
+ hasown@2.0.2:
+ dependencies:
+ function-bind: 1.1.2
+
hookable@5.5.3: {}
html2canvas@1.4.1:
@@ -3110,6 +3282,8 @@ snapshots:
dependencies:
'@jridgewell/sourcemap-codec': 1.5.5
+ math-intrinsics@1.1.0: {}
+
memorystream@0.3.1: {}
merge-stream@2.0.0: {}
@@ -3208,6 +3382,8 @@ snapshots:
prettier@3.7.4: {}
+ proxy-from-env@1.1.0: {}
+
randombytes@2.1.0:
dependencies:
safe-buffer: 5.2.1
diff --git a/247_Contry/src/api/index.ts b/247_Contry/src/api/index.ts
new file mode 100644
index 0000000..d09fc90
--- /dev/null
+++ b/247_Contry/src/api/index.ts
@@ -0,0 +1,25 @@
+import http from '@/utils/https'
+
+type AdminUserStatusParams = {
+ interval?: number
+ max_limit?: number
+ page?: number
+ size?: number
+ mode?: 'SSE' | 'BLOCK'
+}
+
+export const getAdminUserStatus = (params: AdminUserStatusParams = {}) => {
+ return http.get('/api/v1/admin/user/status', {
+ params: {
+ interval: 2,
+ max_limit: 100,
+ page: 1,
+ size: 30,
+ mode: 'SSE',
+ ...params,
+ },
+ headers: {
+ accept: 'application/json',
+ },
+ })
+}
diff --git a/247_Contry/src/router/index.ts b/247_Contry/src/router/index.ts
index 1d67a47..9f767d1 100644
--- a/247_Contry/src/router/index.ts
+++ b/247_Contry/src/router/index.ts
@@ -5,14 +5,33 @@ const router = createRouter({
routes: [
{
path: '/',
- name: 'index',
+ redirect: '/dashboard',
+ },
+ {
+ path: '/dashboard',
+ name: 'dashboard',
component: () => import('@/views/index/index.vue'),
},
{
- path: '/test',
- name: 'test',
- component: () => import('@/views/contory/test.vue'),
- }
+ path: '/monitor',
+ name: 'monitor',
+ component: () => import('@/views/index/index.vue'),
+ },
+ {
+ path: '/strategy',
+ name: 'strategy',
+ component: () => import('@/views/index/index.vue'),
+ },
+ {
+ path: '/leads',
+ name: 'leads',
+ component: () => import('@/views/index/index.vue'),
+ },
+ {
+ path: '/system',
+ name: 'system',
+ component: () => import('@/views/index/index.vue'),
+ },
],
})
diff --git a/247_Contry/src/utils/https.ts b/247_Contry/src/utils/https.ts
new file mode 100644
index 0000000..bb68eb0
--- /dev/null
+++ b/247_Contry/src/utils/https.ts
@@ -0,0 +1,34 @@
+import axios from 'axios'
+import type {
+ AxiosError,
+ AxiosInstance,
+ AxiosRequestHeaders,
+ AxiosResponse,
+ InternalAxiosRequestConfig,
+} from 'axios'
+
+const http: AxiosInstance = axios.create({
+ baseURL: import.meta.env.VITE_API_BASE_URL || '',
+ timeout: 10000,
+})
+
+http.interceptors.request.use(
+ (config: InternalAxiosRequestConfig) => {
+ const token = localStorage.getItem('token')
+ if (token) {
+ config.headers = {
+ ...(config.headers || {}),
+ Authorization: `Bearer ${token}`,
+ } as AxiosRequestHeaders
+ }
+ return config
+ },
+ (error: AxiosError) => Promise.reject(error)
+)
+
+http.interceptors.response.use(
+ (response: AxiosResponse) => response.data,
+ (error: AxiosError) => Promise.reject(error)
+)
+
+export default http
diff --git a/247_Contry/src/views/index/index.vue b/247_Contry/src/views/index/index.vue
index 0e1d1c9..e64c548 100644
--- a/247_Contry/src/views/index/index.vue
+++ b/247_Contry/src/views/index/index.vue
@@ -3,13 +3,21 @@