mirror of
https://github.com/kuaifan/dootask.git
synced 2026-09-21 11:26:35 +00:00
新移动端从 EEUI(weex) 切到 Expo(react-native),UA 标识从 'eeui' 改为 'DooTaskApp', 桥接底层从全局 requireModuleJs 切到 window.__nativeBridge.call(method,args) Promise RPC。 约 52 个文件批量改名(256 处引用): - 平台识别:$A.isEEUIApp/Vue.prototype.$isEEUIApp → isMobileApp / $isMobileApp app.js 顶部 UA 正则 /eeui/i → /DooTaskApp/i app.js requireModuleJs 等待逻辑替换为 window.__nativeBridge 就绪判定 - 桥接 API:$A.eeuiAppXXX → $A.nativeAppXXX - functions/eeui.js 删除,重写为 functions/native-app.js 底层走 window.__nativeBridge.call;nativeAppSendMessage 把旧 sendMessage 的 各 action 拆解为独立 method 调用(updateTheme/windowSize/setBadge/vibrate/ callTel/picturePreview/videoPreview/startMeeting/updateMeetingInfo 等) - types/dootask-globals.d.ts:方法签名同步改名 - store/actions.js:清理 saveUserInfoBase 内旧的 userChatList/userUploadUrl sendMessage(二期由 /share 接收页直接调接口替代) 二期 /share 接收页(跨 App 分享): - pages/share.vue(新增):原生 Share Extension / Android Intent 通过 dootask://share?token=... 拉起 App 后跳本页; 调 nativeAppGetSharedPayload 取分享元数据; 复用 api/users/share/list 渲染会话列表; 用户选会话 → POST api/dialog/msg/sendfiles 上传 + sendtext 发文本/URL; 完成后 nativeAppClearSharedPayload 清理 + 跳目标会话 - routes.js 注册 /share 路由 - language/original-web.txt 加 share.vue 用到的文案 构建链路(electron/build.js): - appbuild app 子命令:前端产物从复制到 resources/mobile/src/public + EEUI docker 构建 改为同步到 resources/mobile/assets/web(由 plugins/withWebAssets 注入原生 bundle) - android-upload apk 路径:从 platforms/android/eeuiApp/... 改为 android/app/build/outputs/apk/release(Expo prebuild 标准布局) 子模块 resources/mobile 指针更新到新 Expo 工程提交(feat/mobile-expo-rewrite 分支)。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
209 lines
6.6 KiB
Vue
209 lines
6.6 KiB
Vue
<template>
|
|
<div class="mobile-tabbar">
|
|
<NetworkException v-if="windowPortrait" type="alert"/>
|
|
<ul class="tabbar-box">
|
|
<li
|
|
v-for="(item, index) in navList"
|
|
:key="index"
|
|
:class="{active: activeName === item.name}"
|
|
@click="toggleRoute(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_count > 0" class="tabbar-badge" type="error" :overflow-count="999" :count="dashboardTask.overdue_count"/>
|
|
<Badge v-else-if="dashboardTask.today_count > 0" class="tabbar-badge" type="info" :overflow-count="999" :count="dashboardTask.today_count"/>
|
|
<Badge v-else-if="dashboardTask.todo_count > 0" class="tabbar-badge" type="primary" :overflow-count="999" :count="dashboardTask.todo_count"/>
|
|
</template>
|
|
<template v-else-if="item.name === 'dialog'">
|
|
<Badge class="tabbar-badge" :overflow-count="999" :text="msgUnreadMention"/>
|
|
</template>
|
|
<template v-else-if="item.name === 'application'">
|
|
<Badge class="tabbar-badge" :overflow-count="999" :count="reportUnreadNumber"/>
|
|
</template>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {mapGetters, mapState} from "vuex";
|
|
import NetworkException from "../NetworkException";
|
|
import emitter from "../../store/events";
|
|
|
|
export default {
|
|
name: "MobileTabbar",
|
|
components: {NetworkException},
|
|
data() {
|
|
return {
|
|
navList: [
|
|
{icon: '', name: 'dashboard', label: '仪表盘'},
|
|
{icon: '', name: 'project', label: '项目'},
|
|
{icon: '', name: 'dialog', label: '消息'},
|
|
{icon: '', name: 'contacts', label: '通讯录'},
|
|
{icon: '', name: 'application', label: '应用'},
|
|
],
|
|
};
|
|
},
|
|
|
|
mounted() {
|
|
emitter.on('dialogMsgPush', this.updateBadge);
|
|
},
|
|
|
|
beforeDestroy() {
|
|
emitter.off('dialogMsgPush', this.updateBadge);
|
|
},
|
|
|
|
computed: {
|
|
...mapState(['cacheDialogs', 'reportUnreadNumber']),
|
|
...mapGetters(['dashboardTask']),
|
|
|
|
/**
|
|
* 综合数(未读、提及、待办)
|
|
* @returns {string|string}
|
|
*/
|
|
msgUnreadMention() {
|
|
let num = 0; // 未读
|
|
let mention = 0; // 提及
|
|
this.cacheDialogs.some(dialog => {
|
|
num += $A.getDialogUnread(dialog, false);
|
|
mention += $A.getDialogMention(dialog);
|
|
})
|
|
if (num > 999) {
|
|
num = "999+"
|
|
}
|
|
if (mention > 999) {
|
|
mention = "999+"
|
|
}
|
|
const todoNum = this.msgTodoTotal // 待办
|
|
if (todoNum) {
|
|
if (mention) {
|
|
return `@${mention}·${todoNum}`
|
|
}
|
|
if (num) {
|
|
return `${num}·${todoNum}`
|
|
}
|
|
return todoNum;
|
|
}
|
|
if (num) {
|
|
if (mention) {
|
|
return `${num}·@${mention}`
|
|
}
|
|
return String(num)
|
|
}
|
|
if (mention) {
|
|
return `@${mention}`
|
|
}
|
|
return "";
|
|
},
|
|
|
|
/**
|
|
* 未读消息数
|
|
* @returns {number}
|
|
*/
|
|
msgAllUnread() {
|
|
let num = 0;
|
|
this.cacheDialogs.some(dialog => {
|
|
num += $A.getDialogNum(dialog);
|
|
})
|
|
return num;
|
|
},
|
|
|
|
/**
|
|
* 待办消息数
|
|
* @returns {string|null}
|
|
*/
|
|
msgTodoTotal() {
|
|
let todoNum = this.cacheDialogs.reduce((total, current) => total + (current.todo_num || 0), 0)
|
|
if (todoNum > 0) {
|
|
if (todoNum > 999) {
|
|
todoNum = "999+"
|
|
} else if (todoNum === 1) {
|
|
todoNum = ""
|
|
}
|
|
return `${this.$L("待办")}${todoNum}`
|
|
}
|
|
return null;
|
|
},
|
|
|
|
/**
|
|
* 未读消息 + 逾期任务
|
|
* @returns {number|*}
|
|
*/
|
|
unreadAndOverdue() {
|
|
if (this.userId > 0) {
|
|
return this.msgAllUnread + this.dashboardTask.overdue_count
|
|
} else {
|
|
return 0
|
|
}
|
|
},
|
|
|
|
activeName() {
|
|
if (['manage-calendar', 'manage-file', 'manage-setting', 'manage-application'].includes(this.routeName)) {
|
|
return 'application';
|
|
}
|
|
|
|
if (this.routeName === 'manage-dashboard') {
|
|
return 'dashboard';
|
|
}
|
|
|
|
if (this.routeName === 'manage-project' && !/^\d+$/.test(this.$route.params.projectId)) {
|
|
return 'project';
|
|
}
|
|
if (this.routeName === 'manage-messenger') {
|
|
if (this.$route.params.dialogAction === 'contacts') {
|
|
return 'contacts'
|
|
} else {
|
|
return 'dialog'
|
|
}
|
|
}
|
|
return ''
|
|
},
|
|
},
|
|
|
|
watch: {
|
|
windowActive() {
|
|
this.updateBadge();
|
|
},
|
|
},
|
|
|
|
methods: {
|
|
toggleRoute(path) {
|
|
this.$emit("on-click", path)
|
|
//
|
|
let location;
|
|
switch (path) {
|
|
case 'project':
|
|
location = {name: 'manage-project', params: {projectId: 'all'}};
|
|
break;
|
|
|
|
case 'dialog':
|
|
location = {name: 'manage-messenger', params: {dialogAction: 'dialog'}};
|
|
if (this.routeName === 'manage-messenger') {
|
|
emitter.emit('clickAgainDialog', true);
|
|
}
|
|
break;
|
|
|
|
case 'contacts':
|
|
location = {name: 'manage-messenger', params: {dialogAction: 'contacts'}};
|
|
break;
|
|
|
|
default:
|
|
location = {name: 'manage-' + path};
|
|
break;
|
|
}
|
|
this.goForward(location);
|
|
},
|
|
|
|
updateBadge() {
|
|
if (this.windowActive) {
|
|
return
|
|
}
|
|
$A.nativeAppSendMessage({
|
|
action: 'setBdageNotify',
|
|
bdage: this.unreadAndOverdue,
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|