Browse Source

合并非现场

dev-v1.0.2
庄锐波 5 months ago
parent
commit
91f4199850
  1. 12
      ng/3/nginx.conf
  2. 2
      zdxt-web-client/zdxt-admin-plus-ui/.env.development-zrb-cust
  3. 2
      zdxt-web-client/zdxt-admin-plus-ui/.env.production
  4. 1
      zdxt-web-client/zdxt-admin-plus-ui/src/api/types.ts
  5. 23
      zdxt-web-client/zdxt-admin-plus-ui/src/store/modules/permission.ts
  6. 3
      zdxt-web-client/zdxt-admin-plus-ui/src/store/modules/user.ts
  7. 37
      zdxt-web-client/zdxt-admin-plus-ui/src/views/login.vue
  8. 10
      zdxt-web-server/zdxt-admin-web-server/src/main/java/org/dromara/web/controller/AuthController.java
  9. 6
      zdxt-web-server/zdxt-admin-web-server/src/main/java/org/dromara/web/domain/vo/LoginVo.java

12
ng/3/nginx.conf

@ -107,12 +107,12 @@ http {
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} }
location /efcode20-sup-web/ { # location /efcode20-sup-web/ {
proxy_pass http://10.76.108.15:12004/; # proxy_pass http://10.76.108.15:12004/;
proxy_set_header Host $http_host; # proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; # proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} # }
#location ~* /(uploads|images)/.*\.(php|php2|php3|php4|php5|phpm|phpml|phtml|phtm|phps|pht|asp|aspx|asa|cer|cdx|ashx|exe|sh|bash|jsp|jspx|jspa|html|web.config|cfm|cgi|war|ashx|htaccess|py|pl)$ { #location ~* /(uploads|images)/.*\.(php|php2|php3|php4|php5|phpm|phpml|phtml|phtm|phps|pht|asp|aspx|asa|cer|cdx|ashx|exe|sh|bash|jsp|jspx|jspa|html|web.config|cfm|cgi|war|ashx|htaccess|py|pl)$ {
#deny all; # 拦截.html和.htm文件,并返回403禁止访问 #deny all; # 拦截.html和.htm文件,并返回403禁止访问
#return 403; #return 403;

2
zdxt-web-client/zdxt-admin-plus-ui/.env.development-zrb-cust

@ -1,6 +1,6 @@
VITE_APP_PROXY_TARGET = 'http://localhost:17000/sup-ep' VITE_APP_PROXY_TARGET = 'http://localhost:17000/sup-ep'
# 页面标题 # 页面标题
VITE_APP_TITLE = zdxt-Vue-Plus多租户管理系统 VITE_APP_TITLE = 执法监督码•执法监督
VITE_APP_LOGO_TITLE = 执法监督码•执法监督 VITE_APP_LOGO_TITLE = 执法监督码•执法监督
# 开发环境配置 # 开发环境配置

2
zdxt-web-client/zdxt-admin-plus-ui/.env.production

@ -1,5 +1,5 @@
# 页面标题 # 页面标题
VITE_APP_TITLE = zdxt-Vue-Plus多租户管理系统 VITE_APP_TITLE = 执法监督码•执法监督
VITE_APP_LOGO_TITLE = 执法监督码•执法监督 VITE_APP_LOGO_TITLE = 执法监督码•执法监督
# 生产环境配置 # 生产环境配置

1
zdxt-web-client/zdxt-admin-plus-ui/src/api/types.ts

@ -33,6 +33,7 @@ export interface LoginData {
*/ */
export interface LoginResult { export interface LoginResult {
access_token: string; access_token: string;
v1_system_credential?: string;
} }
/** /**

23
zdxt-web-client/zdxt-admin-plus-ui/src/store/modules/permission.ts

@ -10,6 +10,7 @@ import InnerLink from '@/layout/components/InnerLink/index.vue';
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { createCustomNameComponent } from '@/utils/createCustomNameComponent'; import { createCustomNameComponent } from '@/utils/createCustomNameComponent';
import { isHttp } from '@/utils/validate'; import { isHttp } from '@/utils/validate';
import { useUserStore } from '@/store/modules/user';
// 匹配views里面所有的.vue文件 // 匹配views里面所有的.vue文件
const modules = import.meta.glob('./../../views/**/*.vue'); const modules = import.meta.glob('./../../views/**/*.vue');
@ -27,12 +28,26 @@ export interface SystemCodeOption {
export const CATCH_ALL_ROUTE_NAME = 'CatchAll404'; export const CATCH_ALL_ROUTE_NAME = 'CatchAll404';
export const systemCodeOptions: SystemCodeOption[] = [ export const systemCodeOptions: SystemCodeOption[] = [
{ label: '首页', value: 'planindex', icon: 'HomeFilled', iframeUrl: 'http://localhost:85/loginByUserId?userId=1&secretKey=zdxt2024emergencyPlatForm' }, { label: '首页', value: 'planindex', icon: 'HomeFilled', iframeUrl: 'http://localhost:85/loginByUserId' },
{ label: '执法监督码', value: 'supervisionCode', icon: 'Document' }, { label: '执法监督码', value: 'supervisionCode', icon: 'Document' },
{ label: '后台管理', value: 'authService', icon: 'Setting' } { label: '后台管理', value: 'authService', icon: 'Setting' }
]; ];
export const usePermissionStore = defineStore('permission', () => { export const usePermissionStore = defineStore('permission', () => {
/**
* 根据基础 iframeUrl 动态拼接登录凭据参数
*/
const buildIframeUrl = (baseUrl: string): string => {
if (!baseUrl) return '';
const userStore = useUserStore();
const params = new URLSearchParams();
if (userStore.v1SystemCredential) {
params.set('v1_system_credential', userStore.v1SystemCredential);
}
const separator = baseUrl.includes('?') ? '&' : '?';
return baseUrl + separator + params.toString();
};
const routes = ref<RouteRecordRaw[]>([]); const routes = ref<RouteRecordRaw[]>([]);
const addRoutes = ref<RouteRecordRaw[]>([]); const addRoutes = ref<RouteRecordRaw[]>([]);
const defaultRoutes = ref<RouteRecordRaw[]>([]); const defaultRoutes = ref<RouteRecordRaw[]>([]);
@ -49,7 +64,7 @@ export const usePermissionStore = defineStore('permission', () => {
/** 当前是否处于 iframe 全屏模式 */ /** 当前是否处于 iframe 全屏模式 */
const iframeMode = ref<boolean>(!!(savedOption?.iframeUrl || savedOption?.fullscreenRoute)); const iframeMode = ref<boolean>(!!(savedOption?.iframeUrl || savedOption?.fullscreenRoute));
/** 当前 iframe 地址 */ /** 当前 iframe 地址 */
const iframeUrl = ref<string>(savedOption?.iframeUrl || ''); const iframeUrl = ref<string>(savedOption?.iframeUrl ? buildIframeUrl(savedOption.iframeUrl) : '');
/** 当前全屏 Vue 路由地址 */ /** 当前全屏 Vue 路由地址 */
const fullscreenRoute = ref<string>(savedOption?.fullscreenRoute || ''); const fullscreenRoute = ref<string>(savedOption?.fullscreenRoute || '');
@ -161,7 +176,7 @@ export const usePermissionStore = defineStore('permission', () => {
// 判断是否为全屏模式(iframe 或 Vue 路由) // 判断是否为全屏模式(iframe 或 Vue 路由)
if (option?.iframeUrl || option?.fullscreenRoute) { if (option?.iframeUrl || option?.fullscreenRoute) {
iframeMode.value = true; iframeMode.value = true;
iframeUrl.value = option.iframeUrl || ''; iframeUrl.value = option.iframeUrl ? buildIframeUrl(option.iframeUrl) : '';
fullscreenRoute.value = option.fullscreenRoute || ''; fullscreenRoute.value = option.fullscreenRoute || '';
setSidebarRouters([]); setSidebarRouters([]);
if (option.fullscreenRoute) { if (option.fullscreenRoute) {
@ -217,7 +232,7 @@ export const usePermissionStore = defineStore('permission', () => {
sessionStorage.setItem(SYSTEM_CODE_KEY, 'planindex'); sessionStorage.setItem(SYSTEM_CODE_KEY, 'planindex');
const defaultOption = systemCodeOptions.find((o) => o.value === 'planindex'); const defaultOption = systemCodeOptions.find((o) => o.value === 'planindex');
iframeMode.value = defaultOption?.iframeUrl ? true : false; iframeMode.value = defaultOption?.iframeUrl ? true : false;
iframeUrl.value = defaultOption?.iframeUrl || ''; iframeUrl.value = defaultOption?.iframeUrl ? buildIframeUrl(defaultOption.iframeUrl) : '';
}; };
/** 根据后端返回的路由数据,动态过滤可见的系统分类选项(首页始终显示) */ /** 根据后端返回的路由数据,动态过滤可见的系统分类选项(首页始终显示) */

3
zdxt-web-client/zdxt-admin-plus-ui/src/store/modules/user.ts

@ -16,6 +16,7 @@ export const useUserStore = defineStore('user', () => {
const avatar = ref(''); const avatar = ref('');
const roles = ref<Array<string>>([]); // 用户角色编码集合 → 判断路由权限 const roles = ref<Array<string>>([]); // 用户角色编码集合 → 判断路由权限
const permissions = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限 const permissions = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限
const v1SystemCredential = ref<string>('');
/** /**
* 登录 * 登录
@ -28,6 +29,7 @@ export const useUserStore = defineStore('user', () => {
const data = res.data; const data = res.data;
setToken(data.access_token); setToken(data.access_token);
token.value = data.access_token; token.value = data.access_token;
v1SystemCredential.value = data.v1_system_credential || '';
// 重置用户状态和路由缓存,确保切换账号后重新加载菜单 // 重置用户状态和路由缓存,确保切换账号后重新加载菜单
roles.value = []; roles.value = [];
permissions.value = []; permissions.value = [];
@ -89,6 +91,7 @@ export const useUserStore = defineStore('user', () => {
avatar, avatar,
roles, roles,
permissions, permissions,
v1SystemCredential,
login, login,
getInfo, getInfo,
logout, logout,

37
zdxt-web-client/zdxt-admin-plus-ui/src/views/login.vue

@ -3,7 +3,6 @@
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form"> <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
<div class="title-box"> <div class="title-box">
<h3 class="title">{{ title }}</h3> <h3 class="title">{{ title }}</h3>
<lang-select />
</div> </div>
<el-form-item v-if="tenantEnabled" prop="tenantId"> <el-form-item v-if="tenantEnabled" prop="tenantId">
<el-select v-model="loginForm.tenantId" filterable :placeholder="proxy.$t('login.selectPlaceholder')" style="width: 100%"> <el-select v-model="loginForm.tenantId" filterable :placeholder="proxy.$t('login.selectPlaceholder')" style="width: 100%">
@ -43,24 +42,24 @@
<img :src="codeUrl" class="login-code-img" @click="getCode" /> <img :src="codeUrl" class="login-code-img" @click="getCode" />
</div> </div>
</el-form-item> </el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin: 0 0 25px 0">{{ proxy.$t('login.rememberPassword') }}</el-checkbox> <!-- <el-checkbox v-model="loginForm.rememberMe" style="margin: 0 0 25px 0">{{ proxy.$t('login.rememberPassword') }}</el-checkbox>-->
<el-form-item style="float: right"> <!-- <el-form-item style="float: right">-->
<el-button circle :title="proxy.$t('login.social.wechat')" @click="doSocialLogin('wechat')"> <!-- <el-button circle :title="proxy.$t('login.social.wechat')" @click="doSocialLogin('wechat')">-->
<svg-icon icon-class="wechat" /> <!-- <svg-icon icon-class="wechat" />-->
</el-button> <!-- </el-button>-->
<el-button circle :title="proxy.$t('login.social.maxkey')" @click="doSocialLogin('maxkey')"> <!-- <el-button circle :title="proxy.$t('login.social.maxkey')" @click="doSocialLogin('maxkey')">-->
<svg-icon icon-class="maxkey" /> <!-- <svg-icon icon-class="maxkey" />-->
</el-button> <!-- </el-button>-->
<el-button circle :title="proxy.$t('login.social.topiam')" @click="doSocialLogin('topiam')"> <!-- <el-button circle :title="proxy.$t('login.social.topiam')" @click="doSocialLogin('topiam')">-->
<svg-icon icon-class="topiam" /> <!-- <svg-icon icon-class="topiam" />-->
</el-button> <!-- </el-button>-->
<el-button circle :title="proxy.$t('login.social.gitee')" @click="doSocialLogin('gitee')"> <!-- <el-button circle :title="proxy.$t('login.social.gitee')" @click="doSocialLogin('gitee')">-->
<svg-icon icon-class="gitee" /> <!-- <svg-icon icon-class="gitee" />-->
</el-button> <!-- </el-button>-->
<el-button circle :title="proxy.$t('login.social.github')" @click="doSocialLogin('github')"> <!-- <el-button circle :title="proxy.$t('login.social.github')" @click="doSocialLogin('github')">-->
<svg-icon icon-class="github" /> <!-- <svg-icon icon-class="github" />-->
</el-button> <!-- </el-button>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item style="width: 100%"> <el-form-item style="width: 100%">
<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin"> <el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
<span v-if="!loading">{{ proxy.$t('login.login') }}</span> <span v-if="!loading">{{ proxy.$t('login.login') }}</span>

10
zdxt-web-server/zdxt-admin-web-server/src/main/java/org/dromara/web/controller/AuthController.java

@ -21,6 +21,7 @@ import org.dromara.common.core.domain.model.RegisterBody;
import org.dromara.common.core.domain.model.SocialLoginBody; import org.dromara.common.core.domain.model.SocialLoginBody;
import org.dromara.common.core.utils.*; import org.dromara.common.core.utils.*;
import org.dromara.common.encrypt.annotation.ApiEncrypt; import org.dromara.common.encrypt.annotation.ApiEncrypt;
import org.dromara.common.encrypt.utils.EncryptUtils;
import org.dromara.common.json.utils.JsonUtils; import org.dromara.common.json.utils.JsonUtils;
import org.dromara.common.ratelimiter.annotation.RateLimiter; import org.dromara.common.ratelimiter.annotation.RateLimiter;
import org.dromara.common.ratelimiter.enums.LimitType; import org.dromara.common.ratelimiter.enums.LimitType;
@ -114,6 +115,15 @@ public class AuthController {
// }, 5, TimeUnit.SECONDS); // }, 5, TimeUnit.SECONDS);
LoginUser loginUser = LoginHelper.getLoginUser(); LoginUser loginUser = LoginHelper.getLoginUser();
// 填充加密凭据字段:先构造明文JSON再整体AES加密
String aesKey = "zdxt2026PlatForm";
Map<String, String> credentialMap = new HashMap<>();
credentialMap.put("userid", String.valueOf(loginUser.getUserId()));
credentialMap.put("ts", String.valueOf(System.currentTimeMillis()));
String plainJson = JsonUtils.toJsonString(credentialMap);
loginVo.setV1SystemCredential(EncryptUtils.encryptByAes(plainJson, aesKey));
System.out.println(JsonUtils.toJsonString(loginUser)); System.out.println(JsonUtils.toJsonString(loginUser));
return R.ok(loginVo); return R.ok(loginVo);
} }

6
zdxt-web-server/zdxt-admin-web-server/src/main/java/org/dromara/web/domain/vo/LoginVo.java

@ -51,4 +51,10 @@ public class LoginVo {
*/ */
private String openid; private String openid;
/**
* 加密凭据JSON字符串,格式: {"userid":"AES加密Base64","ts":"AES加密Base64"}
*/
@JsonProperty("v1_system_credential")
private String v1SystemCredential;
} }

Loading…
Cancel
Save