mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 04:40:37 +00:00
perf: 优化通知
This commit is contained in:
parent
e4b38e4121
commit
ec73c3c785
@ -76,7 +76,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['ws', 'windowActive', 'themeMode']),
|
...mapState(['ws', 'themeMode']),
|
||||||
|
|
||||||
isSoftware() {
|
isSoftware() {
|
||||||
return this.$Electron || this.$isEEUiApp;
|
return this.$Electron || this.$isEEUiApp;
|
||||||
@ -258,6 +258,10 @@ export default {
|
|||||||
this.$store.dispatch("getBasicData", 600)
|
this.$store.dispatch("getBasicData", 600)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 通知权限
|
||||||
|
window.__onNotificationPermissionStatus = (ret) => {
|
||||||
|
this.$store.state.appNotificationPermission = $A.runNum(ret) == 1;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
otherEvents() {
|
otherEvents() {
|
||||||
|
|||||||
@ -689,6 +689,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
windowActive(active) {
|
||||||
|
if (!active) {
|
||||||
|
$A.eeuiAppSendMessage({
|
||||||
|
action: 'setBdageNotify',
|
||||||
|
bdage: this.unreadTotal,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
'cacheProjects.length': {
|
'cacheProjects.length': {
|
||||||
handler() {
|
handler() {
|
||||||
this.$nextTick(_ => {
|
this.$nextTick(_ => {
|
||||||
|
|||||||
@ -24,6 +24,9 @@
|
|||||||
{{$L(item.name)}}
|
{{$L(item.name)}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="$isEEUiApp && !appNotificationPermission" class="messenger-notify-permission" @click="onOpenAppSetting">
|
||||||
|
{{$L('未开启通知权限')}}<i class="taskfont"></i>
|
||||||
|
</div>
|
||||||
<ScrollerY
|
<ScrollerY
|
||||||
ref="list"
|
ref="list"
|
||||||
class="messenger-list"
|
class="messenger-list"
|
||||||
@ -198,6 +201,10 @@ export default {
|
|||||||
activated() {
|
activated() {
|
||||||
this.updateDialogs(1000);
|
this.updateDialogs(1000);
|
||||||
this.$nextTick(_ => this.activeNum++)
|
this.$nextTick(_ => this.activeNum++)
|
||||||
|
//
|
||||||
|
if ($A.isEEUiApp) {
|
||||||
|
$A.eeuiAppSendMessage({action: 'getNotificationPermission'});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivated() {
|
deactivated() {
|
||||||
@ -206,7 +213,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['cacheDialogs', 'loadDialogs', 'dialogId']),
|
...mapState(['cacheDialogs', 'loadDialogs', 'dialogId', 'appNotificationPermission']),
|
||||||
|
|
||||||
routeName() {
|
routeName() {
|
||||||
return this.$route.name
|
return this.$route.name
|
||||||
@ -708,6 +715,12 @@ export default {
|
|||||||
}, timeout)
|
}, timeout)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onOpenAppSetting() {
|
||||||
|
$A.eeuiAppSendMessage({
|
||||||
|
action: 'gotoSetting',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
3
resources/assets/js/store/state.js
vendored
3
resources/assets/js/store/state.js
vendored
@ -11,6 +11,9 @@ const stateData = {
|
|||||||
// 窗口是否激活
|
// 窗口是否激活
|
||||||
windowActive: true,
|
windowActive: true,
|
||||||
|
|
||||||
|
// App通知权限
|
||||||
|
appNotificationPermission: true,
|
||||||
|
|
||||||
// 播放中的音频地址
|
// 播放中的音频地址
|
||||||
audioPlaying: null,
|
audioPlaying: null,
|
||||||
|
|
||||||
|
|||||||
11
resources/assets/sass/pages/page-messenger.scss
vendored
11
resources/assets/sass/pages/page-messenger.scss
vendored
@ -84,6 +84,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.messenger-notify-permission {
|
||||||
|
position: sticky;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 6px 12px;
|
||||||
|
justify-content: space-between;
|
||||||
|
background-color: #FEF7EE;
|
||||||
|
border: 1px solid #FAE0B5;
|
||||||
|
margin: 8px 12px;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
.messenger-list {
|
.messenger-list {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 0;
|
height: 0;
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 0b93e8265db0a734765cd7d8f27a180d11b7223d
|
Subproject commit d94c85bf200250aad19754c9e6c777bdcb22ac90
|
||||||
Loading…
x
Reference in New Issue
Block a user