mirror of
https://github.com/kuaifan/dootask.git
synced 2026-09-20 19:06:22 +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>
279 lines
8.7 KiB
Vue
279 lines
8.7 KiB
Vue
<template>
|
|
<Row v-if="rowMode" class="task-add-row">
|
|
<Col span="12" :class="['row-add', active ? 'active' : '']">
|
|
<div class="add-input" @mouseenter="mouseEnter=true" @mouseleave="mouseEnter=false">
|
|
<Input
|
|
v-model="addData.name"
|
|
ref="input"
|
|
type="textarea"
|
|
:rows="1"
|
|
:autosize="{ minRows: 1, maxRows: 3 }"
|
|
:maxlength="255"
|
|
:placeholder="$L(typeName + '描述,回车创建')"
|
|
enterkeyhint="done"
|
|
@on-focus="onFocus=true"
|
|
@on-blur="onFocus=false"
|
|
@on-keydown="onKeydown"/>
|
|
<div v-if="parentId == 0" class="priority">
|
|
<ul>
|
|
<li v-for="(item, key) in taskPriority" :key="key">
|
|
<ETooltip v-if="active" :disabled="$isMobileApp || windowTouch" :content="taskPriorityContent(item)">
|
|
<i
|
|
class="taskfont"
|
|
:style="{color:item.color}"
|
|
v-html="addData.p_name == item.name ? '' : ''"
|
|
@click="choosePriority(item)"></i>
|
|
</ETooltip>
|
|
</li>
|
|
</ul>
|
|
<Icon type="md-settings" @click="onPriority"/>
|
|
</div>
|
|
</div>
|
|
<div class="add-btn" @click="openAdd">
|
|
<Icon class="add-icon" type="md-add" />{{$L('添加' + typeName)}}
|
|
</div>
|
|
</Col>
|
|
<Col span="3"></Col>
|
|
<Col span="3"></Col>
|
|
<Col span="3"></Col>
|
|
<Col span="3"></Col>
|
|
</Row>
|
|
<div v-else :class="['task-add-simple', active ? 'active' : '']" @mouseenter="mouseEnter=true" @mouseleave="mouseEnter=false">
|
|
<Input
|
|
v-model="addData.name"
|
|
ref="input"
|
|
type="textarea"
|
|
:rows="2"
|
|
:autosize="{ minRows: 2, maxRows: 3 }"
|
|
:maxlength="255"
|
|
:placeholder="$L(typeName + '描述,回车创建')"
|
|
enterkeyhint="done"
|
|
@on-focus="onFocus=true"
|
|
@on-blur="onFocus=false"
|
|
@on-keydown="onKeydown"/>
|
|
<div class="add-placeholder" @click="openAdd">
|
|
<Icon type="md-add" />{{$L('添加' + typeName)}}
|
|
</div>
|
|
<div class="priority">
|
|
<ul>
|
|
<li v-for="(item, key) in taskPriority" :key="key">
|
|
<ETooltip v-if="active" :disabled="$isMobileApp || windowTouch" :content="taskPriorityContent(item)">
|
|
<i
|
|
class="taskfont"
|
|
:style="{color:item.color}"
|
|
v-html="addData.p_name == item.name ? '' : ''"
|
|
@click="choosePriority(item)"></i>
|
|
</ETooltip>
|
|
</li>
|
|
</ul>
|
|
<Icon type="md-settings" @click="onPriority"/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {mapState} from "vuex";
|
|
|
|
export default {
|
|
name: "TaskAddSimple",
|
|
props: {
|
|
parentId: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
projectId: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
columnId: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
addTop: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
autoActive: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
rowMode: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
loadIng: 0,
|
|
|
|
addData: {
|
|
name: "",
|
|
owner: 0,
|
|
column_id: 0,
|
|
times: [],
|
|
subtasks: [],
|
|
p_level: 0,
|
|
p_name: '',
|
|
p_color: '',
|
|
// 可见性
|
|
visibility_appoint: 1,
|
|
visibility_appointor: [],
|
|
},
|
|
active: false,
|
|
|
|
onFocus: false,
|
|
mouseEnter: false,
|
|
}
|
|
},
|
|
|
|
mounted() {
|
|
if (this.autoActive) {
|
|
this.$nextTick(this.openAdd)
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
...mapState(['taskPriority']),
|
|
|
|
typeName() {
|
|
return (this.parentId > 0 ? '子任务' : '任务');
|
|
}
|
|
},
|
|
|
|
watch: {
|
|
active(val) {
|
|
if (!val) {
|
|
this.$emit("on-close")
|
|
}
|
|
},
|
|
mouseEnter() {
|
|
this.chackClose()
|
|
},
|
|
onFocus() {
|
|
this.chackClose()
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
getData() {
|
|
if (this.parentId > 0) {
|
|
return {
|
|
task_id: this.parentId,
|
|
name: this.addData.name,
|
|
}
|
|
} else {
|
|
this.addData.project_id = this.projectId || this.$store.state.projectId;
|
|
this.addData.column_id = this.columnId || this.$store.state.cacheColumns.find(item => item.project_id === this.addData.project_id)?.id || '';
|
|
this.addData.owner = [this.userId];
|
|
this.addData.top = this.addTop ? 1 : 0;
|
|
return $A.cloneJSON(this.addData);
|
|
}
|
|
},
|
|
|
|
openAdd() {
|
|
if (this.windowPortrait) {
|
|
this.defaultPriority();
|
|
this.$emit("on-priority", this.getData())
|
|
this.$emit("on-close")
|
|
return
|
|
}
|
|
this.active = true;
|
|
this.defaultPriority();
|
|
this.$nextTick(() => {
|
|
this.$refs.input.resizeTextarea();
|
|
this.$refs.input.focus();
|
|
});
|
|
},
|
|
|
|
chackClose() {
|
|
if (this.mouseEnter || this.onFocus) {
|
|
return;
|
|
}
|
|
if (!this.addData.name) {
|
|
this.active = false;
|
|
}
|
|
},
|
|
|
|
onPriority() {
|
|
this.$emit("on-priority", this.getData())
|
|
this.active = false;
|
|
},
|
|
|
|
onKeydown(e) {
|
|
if (e.keyCode === 13) {
|
|
if (e.shiftKey) {
|
|
return;
|
|
}
|
|
e.preventDefault();
|
|
this.onAdd();
|
|
}
|
|
},
|
|
|
|
onAdd() {
|
|
if (!this.addData.name) {
|
|
$A.messageWarning("请输入任务描述");
|
|
return;
|
|
}
|
|
if (this.loadIng > 0) {
|
|
return;
|
|
}
|
|
this.loadIng++;
|
|
let type = this.parentId > 0 ? 'taskAddSub' : 'taskAdd';
|
|
this.$store.dispatch(type, this.getData()).then(({msg}) => {
|
|
$A.messageSuccess(msg);
|
|
this.active = false;
|
|
this.addData = {
|
|
name: "",
|
|
owner: 0,
|
|
column_id: 0,
|
|
times: [],
|
|
subtasks: [],
|
|
p_level: 0,
|
|
p_name: '',
|
|
p_color: '',
|
|
// 可见性
|
|
visibility_appoint: 1,
|
|
visibility_appointor: [],
|
|
}
|
|
}).catch(({msg}) => {
|
|
$A.modalError(msg);
|
|
}).finally(() => {
|
|
this.loadIng--;
|
|
});
|
|
},
|
|
|
|
taskPriorityContent(item) {
|
|
let days = $A.runNum(item.days);
|
|
if (days <= 0) {
|
|
return item.name + ' (' + this.$L('无时间限制') + ')';
|
|
}
|
|
return item.name + ' (' + days + this.$L('天') + ')';
|
|
},
|
|
|
|
choosePriority(item, focus = true) {
|
|
if ($A.runNum(item.days) > 0) {
|
|
let start = $A.daytz();
|
|
let end = start.clone().add($A.runNum(item.days), 'day');
|
|
this.$set(this.addData, 'times', $A.newDateString([start, end]))
|
|
} else {
|
|
this.$set(this.addData, 'times', [])
|
|
}
|
|
this.$set(this.addData, 'p_level', item.priority)
|
|
this.$set(this.addData, 'p_name', item.name)
|
|
this.$set(this.addData, 'p_color', item.color)
|
|
focus && this.$nextTick(() => {
|
|
this.$refs.input.focus();
|
|
});
|
|
},
|
|
|
|
defaultPriority() {
|
|
if (this.taskPriority.length === 0 || this.addData.p_name) {
|
|
return;
|
|
}
|
|
const defaultItem = this.taskPriority.find(item => item.is_default === 1) || this.taskPriority[0];
|
|
this.choosePriority(defaultItem, false);
|
|
}
|
|
}
|
|
}
|
|
</script>
|