Browse Source

优化用户邮箱输入

Signed-off-by: AE86 <836391306@qq.com>
AE86 2 năm trước cách đây
mục cha
commit
9268c09265

+ 1 - 1
dbsyncer-parser/src/main/java/org/dbsyncer/parser/message/MessageServiceImpl.java

@@ -44,7 +44,7 @@ public class MessageServiceImpl implements MessageService {
         List<String> mails = new ArrayList<>();
         userConfig.getUserInfoList().forEach(userInfo -> {
             if (StringUtil.isNotBlank(userInfo.getMail())) {
-                Arrays.asList(StringUtil.split(userInfo.getMail(), ";")).forEach(mail -> mails.add(mail));
+                Arrays.asList(StringUtil.split(userInfo.getMail(), ",")).forEach(mail -> mails.add(mail));
             }
         });
         if (CollectionUtils.isEmpty(mails)) {

+ 4 - 2
dbsyncer-web/src/main/resources/public/user/add.html

@@ -60,9 +60,9 @@ xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
 
               <!-- 邮箱 -->
               <div class="form-group">
-                <label class="col-sm-2 control-label">邮箱 <i class="fa fa-question-circle fa_gray" aria-hidden="true" title="多个邮箱使用分号拼接,例子:abc@qq.com;xxx@qq.com"></i></label>
+                <label class="col-sm-2 control-label">邮箱 <i class="fa fa-question-circle fa_gray" aria-hidden="true" title="支持多个邮箱"></i></label>
                 <div class="col-sm-10">
-                  <input type="string" class="form-control" max="100" min="1" dbsyncer-valid="false" name="mail"/>
+                  <input type="string" class="form-control" max="100" min="1" dbsyncer-valid="false" name="mail" data-role="tagsinput"/>
                 </div>
               </div>
 
@@ -76,6 +76,8 @@ xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
 </div>
 
 <script type="text/javascript">
+  // 绑定多值输入框事件
+  initMultipleInputTags();
   // 跳转用户管理
   function backUserIndexPage() {
     doLoader("/user?refresh=" + new Date().getTime());

+ 4 - 2
dbsyncer-web/src/main/resources/public/user/edit.html

@@ -75,9 +75,9 @@ xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
 
               <!-- 邮箱 -->
               <div class="form-group">
-                <label class="col-sm-2 control-label">邮箱 <i class="fa fa-question-circle fa_gray" aria-hidden="true" title="多个邮箱使用分号拼接,例子:abc@qq.com;xxx@qq.com"></i></label>
+                <label class="col-sm-2 control-label">邮箱 <i class="fa fa-question-circle fa_gray" aria-hidden="true" title="支持多个邮箱"></i></label>
                 <div class="col-sm-10">
-                  <input type="string" class="form-control" max="100" min="1" name="mail" th:value="${currentUser?.mail}"/>
+                  <input type="string" class="form-control" max="100" min="1" name="mail" data-role="tagsinput" th:value="${currentUser?.mail}"/>
                 </div>
               </div>
 
@@ -93,6 +93,8 @@ xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
 <script type="text/javascript" th:inline="javascript">
   const currentUserName = [[${currentUserName}]];
 
+  // 绑定多值输入框事件
+  initMultipleInputTags();
   // 跳转用户管理
   function backUserIndexPage() {
     doLoader("/user?refresh=" + new Date().getTime());

+ 5 - 1
dbsyncer-web/src/main/resources/public/user/user.html

@@ -38,7 +38,11 @@
                     <tr th:each="u,state : ${users}">
                         <td th:text="${u?.username + '(' + u?.nickname + ')'}"/>
                         <td th:text="${u?.roleName}"/>
-                        <td th:text="${u?.mail}"/>
+                        <td>
+                            <a href="javascript:;" th:each="m : ${#strings.listSplit(u?.mail,',')}">
+                                <span class="label label-success">[[${m}]]</span>
+                            </a>
+                        </td>
                         <td>
                             <!-- 管理员或本人权限 -->
                             <button th:if="${currentUser?.roleCode eq 'admin' or currentUser?.username eq u?.username}" type="button" th:id="${u?.username}" class="btn btn-primary editUserBtn">

+ 1 - 1
dbsyncer-web/src/main/resources/static/js/common.js

@@ -83,7 +83,7 @@ function initSelect($select){
 // 绑定多值输入框事件
 function initMultipleInputTags() {
     $("input[data-role=tagsinput]").tagsinput({
-        maxChars: 24,
+        maxChars: 32,
         maxTags: 5,
         tagClass: 'label label-success',
         trimValue: true