diff --git a/CHANGELOG.md b/CHANGELOG.md index b8af813..21851b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - | 项目列表 | [a52e6d5](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a52e6d5) - | 项目列表新 | [88cf48d](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/88cf48d) - | 引导页、广告页 | [4aa76ff](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/4aa76ff) + - | 域名配置 | [b68272d](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/b68272d) - | 账户名密码登录 | [ebf456e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ebf456e) - | 主体颜色 | [bb5c0e3](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/bb5c0e3) - | 注册、用户协议 | [68e9189](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/68e9189) diff --git a/hooks/project/useGetTasks.js b/hooks/project/useGetTasks.js index 848d838..23171ce 100644 --- a/hooks/project/useGetTasks.js +++ b/hooks/project/useGetTasks.js @@ -196,7 +196,7 @@ export default function useGetTasks() { * 将新获取到的日常任务放在allTasks里 */ watch(tasks, newValue => { - console.log('newValue----->tasks: '); + // console.log('newValue----->tasks: '); // 添加到allTasks里 const index = visibleRoles.value.findIndex(role => role.id === roleId.value); const arr = [...allTasks.value]; diff --git a/hooks/project/useInit.js b/hooks/project/useInit.js index 5cf5710..c85c6b2 100644 --- a/hooks/project/useInit.js +++ b/hooks/project/useInit.js @@ -24,8 +24,7 @@ export default function useInit() { try { const data = await uni.$u.api.findProjectById(params); store.commit('project/setProject', data); - // 根据项目id获取角色列表 - getRoles(params); + } catch (error) { console.log('error: ', error || '获取项目信息失败'); } @@ -91,8 +90,10 @@ export default function useInit() { // 根据项目id获取项目信息 const params = { projectId: options.p, num: 0 }; getProjectById(params); + // 根据项目id获取角色列表 + getRoles(params); // 根据项目id获取成员列表 - store.dispatch('role/getAllMembers', { projectId: options.p }); + // store.dispatch('role/getAllMembers', { projectId: options.p }); } } diff --git a/pages/project/project.vue b/pages/project/project.vue index fd78724..2fdc3a0 100644 --- a/pages/project/project.vue +++ b/pages/project/project.vue @@ -72,12 +72,6 @@ watch(roleId, newValue => { console.log('当角色发生变化时', newValue); store.commit('task/setTimeNode', Date.now()); - // 根据角色查找永久的日常任务 - const params = { - roleId: newValue, - projectId: projectId.value, - }; - store.dispatch('task/getPermanent', params); } }); @@ -92,6 +86,13 @@ watch(timeNode, newValue => { clearTasksData(); // 查任务 getGlobalData(); // 查可变日常任务 + // 根据角色查找永久的日常任务 + getPermanent(); + // const params = { + // roleId: roleId.value, + // projectId: projectId.value, + // }; + // store.dispatch('task/getPermanent', params); getTasksHook.initPlanTasks(); // 处理定期任务 // 滚动到对应位置 @@ -111,7 +112,7 @@ watch(timeNode, newValue => { * 永久日常任务不发生改变 */ watch(newProjectInfo, newValue => { - console.log('当收到打开新项目消息状态时'); + // console.log('当收到打开新项目消息状态时'); if (newValue && newValue.value.projectId && newValue.value.url) { uni.$u.route('/', { u: userId.value, @@ -126,6 +127,14 @@ watch(newProjectInfo, newValue => { } }); +watch(globals, () => { + // 添加到allTasks里 + const index = visibleRoles.value.findIndex(role => role.id === roleId.value); + const arr = [...allTasks.value]; + arr[index].global = [...globals.value]; + store.commit('task/setAllTasks', arr); +}) + // 获取可变全局任务 function getGlobalData() { if (!allTasks.value[roleIndex]) { @@ -138,10 +147,21 @@ function getGlobalData() { store.dispatch('task/getGlobal', param); } // 添加到allTasks里 - const index = visibleRoles.value.findIndex(role => role.id === roleId.value); - const arr = [...allTasks.value]; - arr[index].global = [...globals.value]; - store.commit('task/setAllTasks', arr); + // const index = visibleRoles.value.findIndex(role => role.id === roleId.value); + // const arr = [...allTasks.value]; + // arr[index].global = [...globals.value]; + // store.commit('task/setAllTasks', arr); +} + +// 获取日常任务 +function getPermanent() { + if (!allTasks.value[roleIndex]) { + const params = { + roleId: roleId.value, + projectId: projectId.value, + }; + store.dispatch('task/getPermanent', params); + } } // 清除已有的任务数据 diff --git a/store/task/actions.js b/store/task/actions.js index 119538f..1ce0652 100644 --- a/store/task/actions.js +++ b/store/task/actions.js @@ -5,7 +5,7 @@ const actions = { * @param {string} roleId 角色id */ getPermanent({ commit, state }, param) { - if (state.hasPermanent) return; + // if (state.hasPermanent) return; uni.$catchReq.getPermanent(param, (err, data) => { commit('setHasPermanent', true); if (err) {