Merge branch 'feature/dingdingLogin' into pre
This commit is contained in:
commit
d8ca47f717
@ -273,7 +273,8 @@ public class DangerOperationController {
|
||||
|
||||
// 如果没有配置 AppSecret,则无法进行后续交互
|
||||
if (!StringUtils.hasText(appSecret)) {
|
||||
log.error("【dingtalk】DingTalk AppSecret not configured");
|
||||
log.info("【dingtalk】DingTalk AppSecret not configured");
|
||||
model.addAttribute("isAuthenticated", false);
|
||||
model.addAttribute("authError", "服务端未配置 AppSecret,无法登录");
|
||||
return "form";
|
||||
}
|
||||
@ -297,7 +298,8 @@ public class DangerOperationController {
|
||||
String accessToken = tokenJson.getString("accessToken");
|
||||
|
||||
if (!StringUtils.hasText(accessToken)) {
|
||||
log.error("【dingtalk】Failed to get access token: {}", tokenResponse);
|
||||
log.info("【dingtalk】Failed to get access token: {}", tokenResponse);
|
||||
model.addAttribute("isAuthenticated", false);
|
||||
model.addAttribute("authError", "钉钉登录验证失败: 无法获取 AccessToken");
|
||||
return "form";
|
||||
}
|
||||
@ -315,13 +317,16 @@ public class DangerOperationController {
|
||||
String mobile = userJson.getString("mobile");
|
||||
|
||||
if (!StringUtils.hasText(mobile)) {
|
||||
log.error("【dingtalk】Failed to get user info: {}", userInfoResponse);
|
||||
log.info("【dingtalk】Failed to get user info: {}", userInfoResponse);
|
||||
model.addAttribute("isAuthenticated", false);
|
||||
model.addAttribute("authError", "钉钉登录验证失败: 无法获取用户手机号");
|
||||
return "form";
|
||||
}
|
||||
|
||||
List<ThirdPartyUserDTO> users = RpcExternalUtil.rpcApiResultProcessor(() -> thirdPartySyncApi.getUserInfosByPhone(mobile), "查询用户是否存在", mobile);
|
||||
if (CollectionUtils.isEmpty(users)) {
|
||||
log.info("【dingtalk】Failed to get user info2: {}", JSON.toJSONString(users));
|
||||
model.addAttribute("isAuthenticated", false);
|
||||
model.addAttribute("authError", "用户未授权!");
|
||||
return "form";
|
||||
}
|
||||
@ -341,7 +346,8 @@ public class DangerOperationController {
|
||||
return "form";
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("【dingtalk】DingTalk Callback Error", e);
|
||||
log.info("【dingtalk】DingTalk Callback Error", e);
|
||||
model.addAttribute("isAuthenticated", false);
|
||||
model.addAttribute("authError", "登录过程中发生异常: " + e.getMessage());
|
||||
return "form";
|
||||
}
|
||||
|
||||
@ -34,35 +34,53 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="text/tailwindcss">
|
||||
@layer utilities {
|
||||
.form-input-focus {
|
||||
@apply focus:border-primary focus:ring-2 focus:ring-primary/20 focus:outline-none;
|
||||
}
|
||||
<style type="text/css">
|
||||
/* 自定义表单输入焦点样式 */
|
||||
.form-input-focus:focus {
|
||||
border-color: #165DFF;
|
||||
box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.2);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.form-transition {
|
||||
@apply transition-all duration-300 ease-in-out;
|
||||
}
|
||||
/* 过渡动画 */
|
||||
.form-transition {
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.card-shadow {
|
||||
@apply shadow-lg hover:shadow-xl transition-shadow duration-300;
|
||||
}
|
||||
/* 卡片阴影效果 */
|
||||
.card-shadow {
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||
transition: box-shadow 0.3s;
|
||||
}
|
||||
|
||||
.form-hidden {
|
||||
@apply hidden opacity-0 h-0;
|
||||
}
|
||||
.card-shadow:hover {
|
||||
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.form-visible {
|
||||
@apply opacity-100 h-auto;
|
||||
}
|
||||
/* 表单隐藏状态 */
|
||||
.form-hidden {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mask-fade {
|
||||
@apply transition-opacity duration-300 ease-in-out;
|
||||
}
|
||||
/* 表单显示状态 */
|
||||
.form-visible {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.tab-active {
|
||||
@apply text-primary border-primary;
|
||||
}
|
||||
/* 遮罩层渐变效果 */
|
||||
.mask-fade {
|
||||
transition: opacity 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
/* 标签页激活状态 */
|
||||
.tab-active {
|
||||
color: #165DFF;
|
||||
border-color: #165DFF;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -148,7 +166,7 @@
|
||||
<!-- 授权验证区域 - 未认证时显示 -->
|
||||
<div th:unless="${isAuthenticated}">
|
||||
<!-- 错误提示 Banner -->
|
||||
<div class="mb-4 bg-red-50 border border-red-200 rounded-lg p-4 flex items-center"
|
||||
<div id="authError" class="mb-4 bg-red-50 border border-red-200 rounded-lg p-4 flex items-center"
|
||||
th:if="${authError != null}">
|
||||
<i class="fa fa-exclamation-circle text-danger text-lg mr-3"></i>
|
||||
<div>
|
||||
@ -587,20 +605,20 @@
|
||||
// 页面加载时检查后端消息
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// 检查流程操作的后端消息(使用 Thymeleaf JS 内联语法)
|
||||
/*[[#{
|
||||
if (${message != null}) {
|
||||
const serverMessage = /*[[${message}]]*/ null;
|
||||
if (serverMessage && serverMessage !== 'null') {
|
||||
operationMessage.classList.remove('hidden');
|
||||
if (${message.startsWith('操作成功')}) {
|
||||
if (serverMessage.includes('成功')) {
|
||||
operationMessage.className = 'mt-4 p-4 rounded-lg bg-green-50 border border-green-200 text-green-700';
|
||||
} else {
|
||||
operationMessage.className = 'mt-4 p-4 rounded-lg bg-red-50 border border-red-200 text-red-700';
|
||||
}
|
||||
operationMessage.innerHTML = '<i class="fa ' + (${message.startsWith('操作成功')} ? 'fa-check-circle' : 'fa-exclamation-circle') + ' mr-2"></i>' + '${message}';
|
||||
const iconClass = serverMessage.includes('成功') ? 'fa-check-circle' : 'fa-exclamation-circle';
|
||||
operationMessage.innerHTML = `<i class="fa ${iconClass} mr-2"></i>${serverMessage}`;
|
||||
}
|
||||
}]]*/
|
||||
|
||||
// 显示授权错误(如果有)
|
||||
if (authError && authError.textContent.trim() !== '') {
|
||||
if (authError && authError.textContent.trim() !== '' && !authError.textContent.includes('${authError}')) {
|
||||
authError.classList.remove('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user