|
|
|
@ -61,6 +61,7 @@ const height = ref(null); // 页面高度 |
|
|
|
const timeLineType = computed(() => store.state.task.timeLineType); // 时间轴模式 |
|
|
|
const remindData = computed(() => store.state.socket.remindData); // 时间轴模式 |
|
|
|
const currLocationTaskId = computed(() => store.state.socket.currLocationTaskId); // 前需要定位到的任务id |
|
|
|
const taskId = computed(() => store.state.task.taskId); // 前需要定位到的任务id |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
const system = uni.getSystemInfoSync(); |
|
|
|
@ -99,17 +100,6 @@ watch(roleId, () => { |
|
|
|
) return; |
|
|
|
|
|
|
|
store.commit('task/setTimeNode', Date.now()); |
|
|
|
|
|
|
|
let currRoleRealTasks = []; |
|
|
|
let currRoleShowTasks = []; |
|
|
|
if (allTasks.value.length) { |
|
|
|
const index = visibleRoles.value.findIndex(role => role.id === roleId.value); |
|
|
|
currRoleRealTasks = allTasks.value[index].realTasks || []; |
|
|
|
currRoleShowTasks = allTasks.value[index].task || []; |
|
|
|
} |
|
|
|
store.commit('socket/setCurrLocationTaskId', ''); |
|
|
|
store.commit('task/setCurrRoleRealTasks', currRoleRealTasks); // 设置当前角色的真实任务数据 |
|
|
|
store.commit('task/setCurrRoleShowTasks', currRoleShowTasks); // 设置当前角色的真实任务数据 |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
@ -121,6 +111,28 @@ watch(roleId, () => { |
|
|
|
watch(timeNode, newValue => { |
|
|
|
if (newValue && roleId.value) { |
|
|
|
clearTasksData(); |
|
|
|
|
|
|
|
let currRoleRealTasks = []; |
|
|
|
let currRoleShowTasks = []; |
|
|
|
const index = visibleRoles.value.findIndex(role => role.id === roleId.value); |
|
|
|
const arr = [...allTasks.value]; |
|
|
|
let upNextPage = 1; |
|
|
|
let downNextPage = 1; |
|
|
|
if (arr.length && index > -1) { |
|
|
|
currRoleRealTasks = arr[index].realTasks || []; |
|
|
|
currRoleShowTasks = arr[index].task || []; |
|
|
|
upNextPage = arr[index].upNextPage || 1; |
|
|
|
downNextPage = arr[index].downNextPage || 1; |
|
|
|
} |
|
|
|
|
|
|
|
store.commit('task/updateTasks', currRoleShowTasks); // 更新当前store中存储的显示任务数据为当前角色的 |
|
|
|
store.commit('task/updateRealTasks', currRoleRealTasks); // 更新当前store中存储的真实任务数据为当前角色的 |
|
|
|
store.commit('task/setCurrRoleRealTasks', currRoleRealTasks); // 设置当前角色的真实任务数据 |
|
|
|
store.commit('task/setCurrRoleShowTasks', currRoleShowTasks); // 设置当前角色的展示任务数据 |
|
|
|
store.commit('task/setUpNextPage', upNextPage); // 设置当前角色的真实任务数据的向上查询页数 |
|
|
|
store.commit('task/setDownNextPage', downNextPage); // 设置当前角色的真实任务数据向下查询页数 |
|
|
|
store.commit('socket/setCurrLocationTaskId', taskId.value || ''); |
|
|
|
|
|
|
|
// 查任务 |
|
|
|
getGlobalData(); // 查可变日常任务 |
|
|
|
getPermanent(); // 根据角色查找永久的日常任务 |
|
|
|
@ -142,26 +154,28 @@ watch(timeNode, newValue => { |
|
|
|
* 重新根据时间和角色查询普通日常任务 |
|
|
|
* 永久日常任务不发生改变 |
|
|
|
*/ |
|
|
|
watch(newProjectInfo, newValue => { |
|
|
|
if (newValue && newValue.value.projectId && newValue.value.url) { |
|
|
|
uni.$u.route('/', { |
|
|
|
u: userId.value, |
|
|
|
p: newValue.value.projectId, |
|
|
|
url: newValue.value.url, |
|
|
|
}); |
|
|
|
clearTasksData(); |
|
|
|
store.commit('role/setRoleId', ''); |
|
|
|
const options = uni.$route.query; |
|
|
|
// watch(newProjectInfo, newValue => { |
|
|
|
// if (newValue && newValue.value.projectId && newValue.value.url) { |
|
|
|
// uni.$u.route('/', { |
|
|
|
// u: userId.value, |
|
|
|
// p: newValue.value.projectId, |
|
|
|
// url: newValue.value.url, |
|
|
|
// }); |
|
|
|
// clearTasksData(); |
|
|
|
// store.commit('role/setRoleId', ''); |
|
|
|
// const options = uni.$route.query; |
|
|
|
|
|
|
|
initHook.init(options); |
|
|
|
} |
|
|
|
}); |
|
|
|
// initHook.init(options); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
watch(globals, () => { |
|
|
|
// 添加到allTasks里 |
|
|
|
const index = visibleRoles.value.findIndex(role => role.id === roleId.value); |
|
|
|
const arr = [...allTasks.value]; |
|
|
|
arr[index].global = [...globals.value]; |
|
|
|
if (arr.length && index > -1) { |
|
|
|
arr[index].global = [...globals.value]; |
|
|
|
} |
|
|
|
store.commit('task/setAllTasks', arr); |
|
|
|
}); |
|
|
|
|
|
|
|
@ -210,19 +224,7 @@ function clearTasksData() { |
|
|
|
|
|
|
|
// tabs通知swiper切换 |
|
|
|
function tabsChange(e) { |
|
|
|
const { id } = visibleRoles.value[e.detail.current]; |
|
|
|
store.commit('role/setRoleIndex', e.detail.current); |
|
|
|
store.commit('role/setRoleId', id); |
|
|
|
|
|
|
|
const index = visibleRoles.value.findIndex(role => role.id === id); |
|
|
|
const arr = [...allTasks.value]; |
|
|
|
store.commit('task/updateTasks', arr[index].task || []); // 更新当前store中存储的显示任务数据为当前角色的 |
|
|
|
store.commit('task/updateRealTasks', arr[index].realTasks || []); // 更新当前store中存储的真实任务数据为当前角色的 |
|
|
|
store.commit('task/setCurrRoleRealTasks', arr[index].realTasks || []); // 设置当前角色的真实任务数据 |
|
|
|
store.commit('task/setCurrRoleShowTasks', arr[index].task || []); // 设置当前角色的展示任务数据 |
|
|
|
store.commit('task/setUpNextPage', arr[index].upNextPage || 1); // 设置当前角色的真实任务数据的向上查询页数 |
|
|
|
store.commit('task/setDownNextPage', arr[index].downNextPage || 1); // 设置当前角色的真实任务数据向下查询页数 |
|
|
|
store.commit('socket/setCurrLocationTaskId', ''); |
|
|
|
console.log('切换角色', e); |
|
|
|
} |
|
|
|
|
|
|
|
// 设置自动滚动位置 |
|
|
|
|