no message

This commit is contained in:
kuaifan 2021-07-01 21:47:08 +08:00
parent 98c5078027
commit c26d588bff
5 changed files with 29 additions and 39 deletions

View File

@ -1,6 +1,6 @@
{
"name": "DooTask",
"version": "0.2.47",
"version": "0.2.49",
"description": "DooTask is task management system.",
"scripts": {
"dev": "npm run development",

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,8 @@
</template>
<script>
import {mapState} from "vuex";
export default {
name: 'PageTitle',
props: {
@ -22,6 +24,23 @@ export default {
this.updateTitle()
},
computed: {
...mapState([
'userId',
'dialogs',
]),
msgAllUnread() {
let num = 0;
this.dialogs.map(({unread}) => {
num += unread;
})
return num;
},
},
watch: {
title: {
handler() {
@ -49,20 +68,10 @@ export default {
},
setPageTile(title) {
document.title = title;
let mobile = navigator.userAgent.toLowerCase();
if (/iphone|ipad|ipod/.test(mobile)) {
let iframe = document.createElement('iframe');
iframe.style.display = 'none';
let iframeCallback = function () {
setTimeout(function () {
iframe.removeEventListener('load', iframeCallback);
document.body.removeChild(iframe)
}, 0)
};
iframe.addEventListener('load', iframeCallback);
document.body.appendChild(iframe)
if (this.userId && this.msgAllUnread > 0) {
title+= " (" + this.msgAllUnread + ")"
}
document.title = title;
}
}
}

View File

@ -440,32 +440,13 @@ export default {
this.titleInterval = setInterval(() => {
let {title} = document;
let newTitle = title.replace(/^(.*?)\((\d+)\)$/g, "$1")
if (this.userId) {
if (this.msgAllUnread > 0) {
newTitle+= " (" + this.msgAllUnread + ")"
}
if (this.userId && this.msgAllUnread > 0) {
newTitle+= " (" + this.msgAllUnread + ")"
}
if (title != newTitle) {
this.setPageTile(newTitle);
document.title = newTitle;
}
}, 500)
},
setPageTile(title) {
document.title = title;
let mobile = navigator.userAgent.toLowerCase();
if (/iphone|ipad|ipod/.test(mobile)) {
let iframe = document.createElement('iframe');
iframe.style.display = 'none';
let iframeCallback = function () {
setTimeout(function () {
iframe.removeEventListener('load', iframeCallback);
document.body.removeChild(iframe)
}, 0)
};
iframe.addEventListener('load', iframeCallback);
document.body.appendChild(iframe)
}
}, 1000)
},
notificationInit() {