mirror of
https://github.com/kuaifan/dootask.git
synced 2026-08-01 10:55:59 +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>
193 lines
6.0 KiB
Vue
193 lines
6.0 KiB
Vue
<template>
|
|
<div class="mobile-back">
|
|
<div v-if="isVisible && x > 20" class="back-semicircle" :style="style"></div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {mapState} from "vuex";
|
|
|
|
export default {
|
|
name: "MobileBack",
|
|
|
|
data() {
|
|
return {
|
|
x: 0,
|
|
y: 0,
|
|
|
|
isVisible: false,
|
|
isTouched: false,
|
|
isScrolling: undefined,
|
|
touchesStart: {},
|
|
};
|
|
},
|
|
|
|
created() {
|
|
this.appAndroidEvents()
|
|
},
|
|
|
|
mounted() {
|
|
document.addEventListener('touchstart', this.touchstart)
|
|
document.addEventListener('touchmove', this.touchmove, { passive: false })
|
|
document.addEventListener('touchend', this.touchend)
|
|
},
|
|
|
|
beforeDestroy() {
|
|
document.removeEventListener('touchstart', this.touchstart)
|
|
document.removeEventListener('touchmove', this.touchmove)
|
|
document.removeEventListener('touchend', this.touchend)
|
|
},
|
|
|
|
computed: {
|
|
...mapState(['fileLists', 'messengerSearchKey', 'mobileTabbar']),
|
|
|
|
style() {
|
|
const offset = 135;
|
|
const top = Math.max(offset, this.y) + this.windowScrollY,
|
|
maxTop = this.windowHeight - offset;
|
|
return {
|
|
top: Math.min(top, maxTop) + 'px',
|
|
}
|
|
},
|
|
|
|
fileFolderId() {
|
|
const {folderId} = this.$route.params;
|
|
return parseInt(/^\d+$/.test(folderId) ? folderId : 0);
|
|
},
|
|
},
|
|
|
|
watch: {
|
|
isVisible(state) {
|
|
this.$store.state.touchBackInProgress = state;
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
getXY(event) {
|
|
const touch = event.touches[0]
|
|
this.x = touch.clientX
|
|
this.y = touch.clientY
|
|
},
|
|
|
|
touchstart(event) {
|
|
this.getXY(event)
|
|
this.isTouched = this.canBack() && this.x < 20;
|
|
this.isScrolling = undefined
|
|
this.touchesStart.x = event.type === 'touchstart' ? event.targetTouches[0].pageX : event.pageX;
|
|
this.touchesStart.y = event.type === 'touchstart' ? event.targetTouches[0].pageY : event.pageY;
|
|
},
|
|
|
|
touchmove(event) {
|
|
if (!this.isTouched) {
|
|
return;
|
|
}
|
|
const pageX = event.type === 'touchmove' ? event.targetTouches[0].pageX : event.pageX;
|
|
const pageY = event.type === 'touchmove' ? event.targetTouches[0].pageY : event.pageY;
|
|
if (typeof this.isScrolling === 'undefined') {
|
|
const verticalMove = Math.abs(pageY - this.touchesStart.y);
|
|
const horizontalMove = Math.abs(pageX - this.touchesStart.x) * 1.5; // 可调整的阈值
|
|
this.isScrolling = verticalMove > horizontalMove;
|
|
}
|
|
if (this.isScrolling) {
|
|
this.isTouched = false;
|
|
return;
|
|
}
|
|
this.isVisible = true
|
|
this.getXY(event)
|
|
event.preventDefault()
|
|
},
|
|
|
|
touchend() {
|
|
// 判断停止时的位置偏移
|
|
if (this.x > 90 && this.isVisible) {
|
|
this.onBack();
|
|
}
|
|
this.x = 0
|
|
this.isVisible = false
|
|
},
|
|
|
|
canBack() {
|
|
if (!this.mobileTabbar) {
|
|
return true;
|
|
}
|
|
if (this.$Modal.visibleList().length > 0) {
|
|
return true;
|
|
}
|
|
if (this.fileFolderId > 0) {
|
|
return true;
|
|
}
|
|
if (this.routeName === 'manage-messenger') {
|
|
if (this.$route.params.dialogAction === 'contacts') {
|
|
if (this.messengerSearchKey.contacts) {
|
|
return true;
|
|
}
|
|
} else {
|
|
if (this.messengerSearchKey.dialog) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
},
|
|
|
|
onBack() {
|
|
// 通用菜单
|
|
this.$store.commit('menu/operation', {})
|
|
|
|
// 移除模态框
|
|
if (this.$Modal.removeLast()) {
|
|
return;
|
|
}
|
|
|
|
// 文件浏览器
|
|
if (this.routeName === 'manage-file') {
|
|
if (this.fileFolderId > 0) {
|
|
const file = this.fileLists.find(({id, permission}) => id == this.fileFolderId && permission > -1)
|
|
if (file) {
|
|
const prevFile = this.fileLists.find(({id, permission}) => id == file.pid && permission > -1)
|
|
if (prevFile) {
|
|
this.goForward({name: 'manage-file', params: {folderId: prevFile.id, fileId: null}});
|
|
return;
|
|
}
|
|
}
|
|
this.goForward({name: 'manage-file'});
|
|
return;
|
|
}
|
|
this.goForward({name: 'manage-application'}, true);
|
|
return;
|
|
}
|
|
|
|
// 消息页搜索
|
|
if (this.routeName === 'manage-messenger') {
|
|
if (this.$route.params.dialogAction === 'contacts') {
|
|
if (this.messengerSearchKey.contacts) {
|
|
this.$store.state.messengerSearchKey.contacts = ""
|
|
return;
|
|
}
|
|
} else {
|
|
if (this.messengerSearchKey.dialog) {
|
|
this.$store.state.messengerSearchKey.dialog = ""
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
this.goBack();
|
|
},
|
|
|
|
appAndroidEvents() {
|
|
if (this.$isMobileApp && $A.isAndroid()) {
|
|
$A.nativeAppSetPageBackPressed({
|
|
pageName: 'firstPage',
|
|
}, _ => {
|
|
if (this.canBack()) {
|
|
this.onBack();
|
|
} else {
|
|
$A.nativeAppGoDesktop()
|
|
}
|
|
});
|
|
}
|
|
}
|
|
},
|
|
};
|
|
</script>
|