Browse Source

feat: 解决时间轴日常任务不显示问题

test2
xuesinan 4 years ago
parent
commit
c532a934ed
  1. 1
      CHANGELOG.md
  2. 2
      hooks/project/useGetTasks.js
  3. 7
      hooks/project/useInit.js
  4. 42
      pages/project/project.vue
  5. 2
      store/task/actions.js

1
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)

2
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];

7
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 });
}
}

42
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);
}
}
//

2
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) {

Loading…
Cancel
Save