Ver código fonte

消息列表bug修复

laiguoran 5 anos atrás
pai
commit
a4fef3eecc

+ 11 - 5
app/public/js/dashboard.js

@@ -27,14 +27,19 @@ $(document).ready(() => {
         const id = $(this).attr('msg-id');
         const msgInfo = _.find(msgList, {id: parseInt(id)});
         $('#title').html(msgInfo.title);
-        $('#creator').html(msgInfo.creator);
         $('#release_time').html(moment(msgInfo.release_time * 1000).format('YYYY-MM-DD'));
         $('#content').html(msgInfo.content);
-        $('#view-msg .modal-title').text('项目通知');
         $('#user_permission').html('');
-        if (userMsgPermission && parseInt(uid) === msgInfo.create_uid) {
-            const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id + '" class="btn btn-sm btn-outline-primary">编辑</a>';
-            $('#user_permission').html(permissionHtml);
+        if (type && parseInt(type) === 1) {
+            $('#creator').html(msgInfo.creator);
+            $('#view-msg .modal-title').text('项目通知');
+            if (userMsgPermission && parseInt(uid) === msgInfo.create_uid) {
+                const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id + '" class="btn btn-sm btn-outline-primary">编辑</a>';
+                $('#user_permission').html(permissionHtml);
+            }
+        } else {
+            $('#creator').html('');
+            $('#view-msg .modal-title').text('系统通知');
         }
     });
 
@@ -46,5 +51,6 @@ $(document).ready(() => {
         $('#release_time').html(moment(msgInfo.release_time * 1000).format('YYYY-MM-DD'));
         $('#content').html(msgInfo.content);
         $('#view-msg .modal-title').text('系统通知');
+        $('#user_permission').html('');
     })
 });

+ 1 - 0
app/view/dashboard/index.ejs

@@ -272,5 +272,6 @@
     const msgList = JSON.parse('<%- JSON.stringify(msgList) %>');
     const sysMsgList = JSON.parse('<%- JSON.stringify(sysMsgList) %>');
     const uid = '<%- uid %>';
+    const type = 1;
     const userMsgPermission = <%- userMsgPermission %>;
 </script>

+ 2 - 1
app/view/dashboard/msg.ejs

@@ -30,7 +30,7 @@
                                 <% if (msgList && msgList[0]) { %>
                                 <h4 class="text-center" id="title"><%= msgList[0].title %></h4>
                                 <p class="text-center text-muted">
-                                    <span id="creator"><%= msgList[0].creator %></span> 发布于 <span id="release_time"><%= moment(msgList[0].release_time*1000).format('YYYY-MM-DD') %></span>
+                                    <span id="creator"><%- (type === 1 ? msgList[0].creator : '') %></span> 发布于 <span id="release_time"><%= moment(msgList[0].release_time*1000).format('YYYY-MM-DD') %></span>
                                     <span id="user_permission">
                                         <% if (uid === msgList[0].create_uid) { %>
                                             <!--有编辑权用户-->
@@ -55,6 +55,7 @@
     autoFlashHeight();
     const msgList = JSON.parse('<%- JSON.stringify(msgList) %>');
     const uid = '<%- uid %>';
+    const type = <%- type %>;
     const userMsgPermission = <%- userMsgPermission %>;
 </script>
 <script src="/public/js/moment/moment.min.js"></script>