no message

This commit is contained in:
kuaifan 2022-05-12 17:07:18 +08:00
parent 37578cf4a0
commit 6dbbcff0b6
7 changed files with 90 additions and 2 deletions

View File

@ -23,7 +23,7 @@ export default {
}, },
created() { created() {
this.appAndroidEvents()
}, },
mounted() { mounted() {
@ -55,14 +55,17 @@ export default {
this.x = touch.clientX this.x = touch.clientX
this.y = touch.clientY this.y = touch.clientY
}, },
touchstart(event) { touchstart(event) {
this.getXY(event) this.getXY(event)
// //
this.show = this.canBack() && this.x < 30; this.show = this.canBack() && this.x < 30;
}, },
touchmove(event) { touchmove(event) {
this.getXY(event) this.getXY(event)
}, },
touchend() { touchend() {
// //
if (this.x > 90 && this.show) { if (this.x > 90 && this.show) {
@ -71,6 +74,7 @@ export default {
this.x = 0 this.x = 0
this.show = false this.show = false
}, },
canBack() { canBack() {
if (!this.showTabbar) { if (!this.showTabbar) {
return true; return true;
@ -80,6 +84,7 @@ export default {
} }
return this.cacheDrawerOverlay.length > 0; return this.cacheDrawerOverlay.length > 0;
}, },
onBack() { onBack() {
if (this.$Modal.removeLast()) { if (this.$Modal.removeLast()) {
return; return;
@ -89,6 +94,23 @@ export default {
return; return;
} }
this.goBack(); this.goBack();
},
appAndroidEvents() {
if (window && window.navigator
&& /eeui/i.test(window.navigator.userAgent)
&& /android/i.test(window.navigator.userAgent)) {
let eeui = requireModuleJs("eeui");
eeui.setPageBackPressed({
pageName: 'firstPage',
}, _ => {
if (this.canBack()) {
this.onBack();
} else {
eeui.goDesktop()
}
});
}
} }
}, },
}; };

View File

@ -4,6 +4,14 @@
<li v-for="item in navList" @click="toggleRoute(item.name)" :class="{active: activeName === item.name}"> <li v-for="item in navList" @click="toggleRoute(item.name)" :class="{active: activeName === item.name}">
<i class="taskfont" v-html="item.icon"></i> <i class="taskfont" v-html="item.icon"></i>
<div class="tabbar-title">{{$L(item.label)}}</div> <div class="tabbar-title">{{$L(item.label)}}</div>
<template v-if="item.name === 'dashboard'">
<Badge v-if="dashboardTask.overdue.length > 0" class="tabbar-badge" type="error" :count="dashboardTask.overdue.length"/>
<Badge v-else-if="dashboardTask.today.length > 0" class="tabbar-badge" type="info" :count="dashboardTask.today.length"/>
<Badge v-else-if="dashboardTask.all.length > 0" class="tabbar-badge" type="primary" :count="dashboardTask.all.length"/>
</template>
<template v-else-if="item.name === 'dialog'">
<Badge class="tabbar-badge" :text="msgUnreadMention"/>
</template>
</li> </li>
</ul> </ul>
<div class="mobile-back"></div> <div class="mobile-back"></div>
@ -11,6 +19,8 @@
</template> </template>
<script> <script>
import {mapGetters, mapState} from "vuex";
export default { export default {
name: "MobileTabbar", name: "MobileTabbar",
@ -39,6 +49,11 @@ export default {
}, },
computed: { computed: {
...mapState([
'cacheDialogs',
]),
...mapGetters(['dashboardTask']),
routeName() { routeName() {
return this.$route.name return this.$route.name
}, },
@ -63,6 +78,28 @@ export default {
} }
return '' return ''
}, },
msgUnreadMention() {
let num = 0;
let mention = 0;
this.cacheDialogs.some(dialog => {
num += $A.getDialogUnread(dialog);
mention += $A.getDialogMention(dialog);
})
if (num <= 0) {
return '';
}
if (num > 99) {
num = "99+"
}
if (mention > 0) {
if (mention > 99) {
return "@99+"
}
return `${num}·@${mention}`
}
return String(num);
},
}, },
methods: { methods: {

View File

@ -517,7 +517,13 @@ export default {
if (num <= 0) { if (num <= 0) {
return ''; return '';
} }
if (num > 99) {
num = "99+"
}
if (mention > 0) { if (mention > 0) {
if (mention > 99) {
return "@99+"
}
return `${num}·@${mention}` return `${num}·@${mention}`
} }
return String(num); return String(num);

View File

@ -315,7 +315,13 @@ export default {
if (id) { if (id) {
this.msgNew = 0; this.msgNew = 0;
this.topId = -1; this.topId = -1;
this.$store.dispatch("getDialogMsgs", id).then(this.onToBottom).catch(_ => {}); if (this.dialogMsgList.length > 0) {
setTimeout(this.onToBottom, 10);
}
const startTime = new Date().getTime();
this.$store.dispatch("getDialogMsgs", id).then(_ => {
setTimeout(this.onToBottom, Math.max(0, 100 - (new Date().getTime() - startTime)));
}).catch(_ => {});
} }
}, },
immediate: true immediate: true

View File

@ -25,6 +25,7 @@
padding: 0; padding: 0;
margin: 0; margin: 0;
color: $primary-text-color; color: $primary-text-color;
position: relative;
.taskfont { .taskfont {
font-size: 24px; font-size: 24px;
line-height: 34px; line-height: 34px;
@ -33,6 +34,15 @@
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
} }
.tabbar-badge {
position: absolute;
top: 0;
left: 50%;
transform: scale(0.8);
.ivu-badge-count {
font-size: 14px;
}
}
&.active { &.active {
color: $primary-color; color: $primary-color;
} }

View File

@ -425,6 +425,9 @@ body.dark-mode-reverse {
color: #333; color: #333;
} }
} }
.mention {
color: #333;
}
} }
} }
} }

View File

@ -7,6 +7,10 @@ body {
padding: 5px 0; padding: 5px 0;
} }
.ivu-badge-count {
font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
}
.input-number-box { .input-number-box {
display: flex; display: flex;
align-items: center; align-items: center;