Browse Source

fix: 时间轴数据错乱

test2
xuesinan 4 years ago
parent
commit
c1e12bca90
  1. 1
      CHANGELOG.md
  2. 2
      components/Roles/Roles.vue
  3. 10
      hooks/project/useGetTasks.js
  4. 4
      pages/project/project.vue
  5. 4
      store/task/mutations.js
  6. 3
      store/task/state.js

1
CHANGELOG.md

@ -106,6 +106,7 @@
- | 查询插件 | [542d714](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/542d714)
- | 查询查件详情 | [5935a3d](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/5935a3d)
- | 登录页验证码获取 | [108e322](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/108e322)
- | 顶部状态栏不显示问题 | [a63dfa4](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a63dfa4)
- | 工作台图片app端不显示 | [f267c72](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f267c72)
- | 广告页、引导页 | [b63ade5](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/b63ade5)
- | 广告页不显示 | [d749dfb](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d749dfb)

2
components/Roles/Roles.vue

@ -103,11 +103,9 @@ function scroll(e) {
//
function setCurrentRole(index) {
const query = uni.createSelectorQuery().in(this);
console.log('ppppppp', query);
query
.selectAll('.tab-children')
.boundingClientRect(res => {
console.log('oooooooooo', res);
res.forEach(item => {
data.tabList.push({ width: item.width });
});

10
hooks/project/useGetTasks.js

@ -25,6 +25,7 @@ export default function useGetTasks() {
const remindData = computed(() => store.state.socket.remindData); // 小红点
const currRoleRealTasks = computed(() => store.state.task.currRoleRealTasks); // 当前角色的真实任务数据
const currRoleShowTasks = computed(() => store.state.task.currRoleShowTasks); // 当前角色的展示任务数据
const currLocationTaskId = computed(() => store.state.socket.currLocationTaskId);
// 初始化 定期任务
@ -78,6 +79,7 @@ export default function useGetTasks() {
const arr = [...allTasks.value];
arr[index].realTasks = [...realTasks.value];
store.commit('task/setAllTasks', arr);
store.commit('task/setCurrRoleShowTasks', arr[index].tasks); // 设置当前角色的展示任务数据
store.commit('task/setCurrRoleRealTasks', arr[index].realTasks); // 设置当前角色的真实任务数据
// 如果第一次渲染但没有空数据则加载空数据
@ -113,6 +115,7 @@ export default function useGetTasks() {
// 初始值
// 显示任务中没有真实任务数据
// let centerData = params.queryType === 1 ? realTasks.slice(0, params.pageSize) : realTasks.slice(realTasks.length - 1 - params.pageSize);
let centerData = realTasks.slice(0, params.pageSize);
const firstDetailIndex = showTasks.findIndex(task => task.detailId);
if (firstDetailIndex > -1) {
@ -223,9 +226,9 @@ export default function useGetTasks() {
}
}
if (showTasks.length > 80) {
showTasks = params.queryType === 0 ? showTasks.slice(0, 80) : showTasks.slice(showTasks.length - 80);
}
// if (showTasks.length > 80) {
// showTasks = params.queryType === 0 ? showTasks.slice(0, 80) : showTasks.slice(showTasks.length - 80);
// }
store.commit('task/clearTasks');
params.queryType === 0 ? store.commit('task/setUpTasks', showTasks) : store.commit('task/setDownTasks', showTasks);
@ -306,6 +309,7 @@ export default function useGetTasks() {
const arr = [...allTasks.value];
arr[index].task = [...newValue];
store.commit('task/setAllTasks', arr);
store.commit('task/setCurrRoleShowTasks', arr[index].tasks); // 设置当前角色的展示任务数据
});
return {

4
pages/project/project.vue

@ -151,12 +151,14 @@ watch(roleId, () => {
store.commit('task/setTimeNode', Date.now());
let currRoleRealTasks = [];
let currRoleRealTasks = [], currRoleShowTasks = [];
if (allTasks.value.length) {
const index = visibleRoles.value.findIndex(role => role.id === roleId.value);
currRoleRealTasks = allTasks.value[index].realTasks || [];
currRoleShowTasks = allTasks.value[index].tasks || [];
}
store.commit('task/setCurrRoleRealTasks', currRoleRealTasks); //
store.commit('task/setCurrRoleShowTasks', currRoleShowTasks); //
}
});

4
store/task/mutations.js

@ -344,6 +344,10 @@ const mutations = {
setCurrRoleRealTasks(state, data) {
state.currRoleRealTasks = data || [];
},
setCurrRoleShowTasks(state, data) {
state.currRoleShowTasks = data || [];
}
};
export default mutations;

3
store/task/state.js

@ -32,6 +32,9 @@ const state = {
allTasks: [], // 所有任务
hasPermanent: false, // 永久的日常任务是否加载过
currRoleRealTasks: [], // 当前角色真实任务
currRoleShowTasks: [], // 当前角色展示任务
};
export default state;

Loading…
Cancel
Save