diff --git a/web/public/js/components/messages/message-row.js b/web/public/js/components/messages/message-row.js index b0919b07..20ad437b 100644 --- a/web/public/js/components/messages/message-row.js +++ b/web/public/js/components/messages/message-row.js @@ -1,41 +1,51 @@ Vue.component("message-row", { - props: ["v-message"], - data: function () { - let paramsJSON = this.vMessage.params - let params = null - if (paramsJSON != null && paramsJSON.length > 0) { - params = JSON.parse(paramsJSON) - } + props: ["v-message", "v-can-close"], + data: function () { + let paramsJSON = this.vMessage.params + let params = null + if (paramsJSON != null && paramsJSON.length > 0) { + params = JSON.parse(paramsJSON) + } - return { - message: this.vMessage, - params: params - } - }, - methods: { - viewCert: function (certId) { - teaweb.popup("/servers/certs/certPopup?certId=" + certId, { - height: "28em", - width: "48em" - }) - }, - readMessage: function (messageId) { - Tea.action("/messages/readPage") - .params({"messageIds": [messageId]}) - .post() - .success(function () { - // 刷新父级页面Badge - if (window.parent.Tea != null && window.parent.Tea.Vue != null) { - window.parent.Tea.Vue.checkMessagesOnce() - } + return { + message: this.vMessage, + params: params, + isClosing: false + } + }, + methods: { + viewCert: function (certId) { + teaweb.popup("/servers/certs/certPopup?certId=" + certId, { + height: "28em", + width: "48em" + }) + }, + readMessage: function (messageId) { + let that = this - // 刷新当前页面 - teaweb.reload() - }) - } - }, - template: `
- + Tea.action("/messages/readPage") + .params({"messageIds": [messageId]}) + .post() + .success(function () { + // 刷新父级页面Badge + if (window.parent.Tea != null && window.parent.Tea.Vue != null) { + window.parent.Tea.Vue.checkMessagesOnce() + } + + // 刷新当前页面 + if (that.vCanClose && typeof (NotifyPopup) != "undefined") { + that.isClosing = true + setTimeout(function () { + NotifyPopup({}) + }, 1000) + } else { + teaweb.reload() + } + }) + } + }, + template: `
+
{{message.datetime}} diff --git a/web/views/@default/messages/index.html b/web/views/@default/messages/index.html index d89a1800..352e06b4 100644 --- a/web/views/@default/messages/index.html +++ b/web/views/@default/messages/index.html @@ -8,6 +8,6 @@

暂时还没有消息。

- +
\ No newline at end of file