mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-12 08:58:11 +00:00
no message
This commit is contained in:
parent
37578cf4a0
commit
6dbbcff0b6
@ -23,7 +23,7 @@ export default {
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
this.appAndroidEvents()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@ -55,14 +55,17 @@ export default {
|
||||
this.x = touch.clientX
|
||||
this.y = touch.clientY
|
||||
},
|
||||
|
||||
touchstart(event) {
|
||||
this.getXY(event)
|
||||
// 判断是否是边缘滑动
|
||||
this.show = this.canBack() && this.x < 30;
|
||||
},
|
||||
|
||||
touchmove(event) {
|
||||
this.getXY(event)
|
||||
},
|
||||
|
||||
touchend() {
|
||||
// 判断停止时的位置偏移
|
||||
if (this.x > 90 && this.show) {
|
||||
@ -71,6 +74,7 @@ export default {
|
||||
this.x = 0
|
||||
this.show = false
|
||||
},
|
||||
|
||||
canBack() {
|
||||
if (!this.showTabbar) {
|
||||
return true;
|
||||
@ -80,6 +84,7 @@ export default {
|
||||
}
|
||||
return this.cacheDrawerOverlay.length > 0;
|
||||
},
|
||||
|
||||
onBack() {
|
||||
if (this.$Modal.removeLast()) {
|
||||
return;
|
||||
@ -89,6 +94,23 @@ export default {
|
||||
return;
|
||||
}
|
||||
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()
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@ -4,6 +4,14 @@
|
||||
<li v-for="item in navList" @click="toggleRoute(item.name)" :class="{active: activeName === item.name}">
|
||||
<i class="taskfont" v-html="item.icon"></i>
|
||||
<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>
|
||||
</ul>
|
||||
<div class="mobile-back"></div>
|
||||
@ -11,6 +19,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters, mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "MobileTabbar",
|
||||
|
||||
@ -39,6 +49,11 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState([
|
||||
'cacheDialogs',
|
||||
]),
|
||||
...mapGetters(['dashboardTask']),
|
||||
|
||||
routeName() {
|
||||
return this.$route.name
|
||||
},
|
||||
@ -63,6 +78,28 @@ export default {
|
||||
}
|
||||
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: {
|
||||
|
||||
@ -517,7 +517,13 @@ export default {
|
||||
if (num <= 0) {
|
||||
return '';
|
||||
}
|
||||
if (num > 99) {
|
||||
num = "99+"
|
||||
}
|
||||
if (mention > 0) {
|
||||
if (mention > 99) {
|
||||
return "@99+"
|
||||
}
|
||||
return `${num}·@${mention}`
|
||||
}
|
||||
return String(num);
|
||||
|
||||
@ -315,7 +315,13 @@ export default {
|
||||
if (id) {
|
||||
this.msgNew = 0;
|
||||
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
|
||||
|
||||
10
resources/assets/sass/components/mobile.scss
vendored
10
resources/assets/sass/components/mobile.scss
vendored
@ -25,6 +25,7 @@
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: $primary-text-color;
|
||||
position: relative;
|
||||
.taskfont {
|
||||
font-size: 24px;
|
||||
line-height: 34px;
|
||||
@ -33,6 +34,15 @@
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.tabbar-badge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: scale(0.8);
|
||||
.ivu-badge-count {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
&.active {
|
||||
color: $primary-color;
|
||||
}
|
||||
|
||||
3
resources/assets/sass/dark.scss
vendored
3
resources/assets/sass/dark.scss
vendored
@ -425,6 +425,9 @@ body.dark-mode-reverse {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.mention {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
resources/assets/sass/pages/common.scss
vendored
4
resources/assets/sass/pages/common.scss
vendored
@ -7,6 +7,10 @@ body {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.ivu-badge-count {
|
||||
font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
|
||||
.input-number-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user