From 08ae659a56346f826bdb8caae7b631715e018794 Mon Sep 17 00:00:00 2001
From: 2910410219 <2910410219@qq.com>
Date: Thu, 2 Apr 2026 14:14:26 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0API=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=89=8D=E7=BC=80=E4=B8=BA'/admin-go'?=
=?UTF-8?q?=EF=BC=8C=E7=BB=9F=E4=B8=80=E5=90=8E=E7=AB=AF=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BC=98=E5=8C=96=E8=AF=B7=E6=B1=82?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97=EF=BC=8C=E8=B0=83=E6=95=B4=E4=B8=AA=E4=BA=BA?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2=E4=B8=8A=E4=BC=A0=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=EF=BC=8C=E6=8F=90=E5=8D=87=E4=BB=A3=E7=A0=81=E4=B8=80?=
=?UTF-8?q?=E8=87=B4=E6=80=A7=E5=92=8C=E5=8F=AF=E8=AF=BB=E6=80=A7=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 10 +-
.env.production | 4 +-
public/web/subscribe.html | 1330 ++++++++++----------
src/api/login/index.ts | 16 +-
src/api/system/cache/index.ts | 8 +-
src/api/system/config/index.ts | 61 +-
src/api/system/dept/index.ts | 51 +-
src/api/system/dict/data.ts | 126 +-
src/api/system/dict/type.ts | 71 +-
src/api/system/menu/index.ts | 77 +-
src/api/system/monitor/loginLog/index.ts | 36 +-
src/api/system/monitor/operLog/index.ts | 55 +-
src/api/system/monitor/server/index.ts | 9 +-
src/api/system/monitor/userOnline/index.ts | 24 +-
src/api/system/personal/index.ts | 35 +-
src/api/system/post/index.ts | 50 +-
src/api/system/role/index.ts | 97 +-
src/api/system/tenant/index.ts | 10 +-
src/api/system/user/index.ts | 104 +-
src/views/system/personal/index.vue | 975 +++++++-------
vite.config.ts | 16 +-
21 files changed, 1567 insertions(+), 1598 deletions(-)
diff --git a/.env.development b/.env.development
index 3a62d8e..f929f8f 100644
--- a/.env.development
+++ b/.env.development
@@ -1,10 +1,6 @@
# 本地环境
ENV = 'development'
-# 统一后端服务地址配置(全部模块共用 8000 端口)
-# 切换环境时,仅需修改下面这一个地址的 IP
-# 当前环境: 192.168.3.38
-# 备用环境: 192.168.3.200
-# 备用环境: 116.204.74.41
-# 备用环境: 172.20.10.7
-VITE_API_URL = 'http://192.168.74.41:8000/'
+# 统一后端服务地址前缀(网关服务名:admin-go)
+# 开发环境走本地代理,避免 CORS
+VITE_API_URL = 'http://192.168.74.41:8000'
diff --git a/.env.production b/.env.production
index fa100b0..ccfb6ae 100644
--- a/.env.production
+++ b/.env.production
@@ -4,5 +4,5 @@ ENV = 'production'
# public path 配置线上环境路径(打包)、本地通过 http-server 访问时,请置空即可
VITE_PUBLIC_PATH = '/sys/'
-# 统一服务地址(端口8000)
-VITE_API_URL = '/'
+# 统一服务地址前缀(网关服务名:admin-go)
+VITE_API_URL = ''
diff --git a/public/web/subscribe.html b/public/web/subscribe.html
index d3cc214..176420a 100644
--- a/public/web/subscribe.html
+++ b/public/web/subscribe.html
@@ -1,563 +1,584 @@
-
+
-
-
-
- 服务开通 - 智能营销服务平台
-
-
-
-
-
-
+ .success-message p {
+ margin: 0;
+ color: #15803d;
+ }
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
-
+ // 更新提交按钮状态
+ function updateSubmitButton() {
+ const btn = document.getElementById('btn-submit');
+ // 如果有用户类型选项,则需要同时选择类型和套餐
+ if (tenantModuleTypes.length > 0) {
+ btn.disabled = !selectedSku || !selectedType;
+ } else {
+ btn.disabled = !selectedSku;
+ }
+ }
+
+ // 开通服务
+ async function handleSubscribe() {
+ if (!selectedSku) {
+ alert('请选择套餐');
+ return;
+ }
+
+ // 如果有用户类型选项但未选择
+ if (tenantModuleTypes.length > 0 && !selectedType) {
+ alert('请选择用户类型');
+ return;
+ }
+
+ const btn = document.getElementById('btn-submit');
+ btn.disabled = true;
+ btn.textContent = '开通中...';
+
+ try {
+ const token = getToken();
+
+ // 构建请求参数
+ const requestBody = {
+ assetSkuId: selectedSku.id,
+ };
+
+ // 如果选择了用户类型,添加到请求参数
+ if (selectedType) {
+ requestBody.tenantModuleType = selectedType.key;
+ }
+
+ const response = await fetch(`${API_BASE_MAIN}/admin-go/api/v1/system/moduleTenant/add`, {
+ method: 'POST',
+ headers: {
+ Authorization: token ? `Bearer ${token}` : '',
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(requestBody),
+ });
+
+ const result = await response.json();
+
+ if (result.code !== 0) {
+ throw new Error(result.message || '开通失败');
+ }
+
+ // 显示成功
+ document.getElementById('type-section').style.display = 'none';
+ document.getElementById('sku-section').style.display = 'none';
+ document.getElementById('actions').style.display = 'none';
+ document.getElementById('asset-info').style.display = 'none';
+ document.getElementById('success').style.display = 'block';
+
+ // 设置开通时间标记,防止跳转后立即又触发402
+ sessionStorage.setItem('lastSubscribeTime', Date.now().toString());
+
+ // 延迟跳转回原页面
+ const targetUrl = decodeURIComponent(returnUrl);
+ // console.log('[subscribe] 开通成功,即将跳转到:', targetUrl);
+ // console.log('[subscribe] 原始 returnUrl:', returnUrl);
+
+ setTimeout(() => {
+ let finalUrl;
+ // 如果 returnUrl 包含当前开通页面路径,则跳转到首页
+ if (targetUrl.includes('/web/subscribe') || targetUrl.includes('subscribe.html')) {
+ console.log('[subscribe] returnUrl 指向开通页面,改为跳转首页');
+ finalUrl = '/index.html#/home';
+ } else {
+ finalUrl = targetUrl;
+ }
+
+ // 使用 replace 跳转,然后强制刷新
+ window.location.replace(finalUrl);
+ // 延迟一点再刷新,确保 URL 已经改变
+ setTimeout(() => {
+ window.location.reload(true);
+ }, 100);
+ }, 2000);
+ } catch (error) {
+ console.error('开通失败:', error);
+ alert(error.message || '开通失败,请稍后重试');
+ btn.disabled = false;
+ btn.textContent = '立即开通';
+ }
+ }
+
+ // 取消 - 跳转到后台首页,避免循环触发402
+ function handleCancel() {
+ window.location.href = '/index.html#/home';
+ }
+
+ // 获取Token(从Cookie获取)
+ function getToken() {
+ try {
+ const cookies = document.cookie.split(';');
+ for (let cookie of cookies) {
+ const parts = cookie.trim().split('=');
+ const name = parts[0];
+ // token 值可能包含 = 号,所以用 slice 获取剩余部分
+ const value = parts.slice(1).join('=');
+ if (name === 'token' && value) {
+ // Cookie 中的值可能被 URL 编码,需要解码
+ try {
+ return decodeURIComponent(value);
+ } catch (e) {
+ return value;
+ }
+ }
+ }
+ } catch (e) {
+ console.error('获取token失败:', e);
+ }
+ return '';
+ }
+
+ // 显示/隐藏加载
+ function showLoading(show) {
+ document.getElementById('loading').style.display = show ? 'block' : 'none';
+ }
+
+ // 显示错误
+ function showError(message) {
+ const errorEl = document.getElementById('error');
+ errorEl.textContent = message;
+ errorEl.style.display = 'block';
+ document.getElementById('loading').style.display = 'none';
+ }
+
+