diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d69f1b..ae73773 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -194,6 +194,7 @@
- | 暂时移除了jest浏览器配置 | [5088d01](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/5088d01)
- | 添加测试,测试utils/time.js的computeDurationText | [e758010](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/e758010)
- | 禁用任务开始操作 | [b5425db](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/b5425db)
+ - | 解决error | [c5bd659](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c5bd659)
### 🔨 代码重构
diff --git a/src/components/Evaluated/EvaluatedNLCP.vue b/src/components/Evaluated/EvaluatedNLCP.vue
index fb6ff14..efd87f8 100644
--- a/src/components/Evaluated/EvaluatedNLCP.vue
+++ b/src/components/Evaluated/EvaluatedNLCP.vue
@@ -50,7 +50,9 @@ export default {
query
.selectAll('.charts-box')
.boundingClientRect(data => {
- this.cWidth = data[0].width;
+ if (data && data.length) {
+ this.cWidth = data[0].width;
+ }
})
.exec();
diff --git a/src/components/Roles/Roles.vue b/src/components/Roles/Roles.vue
index 67653df..b7759a8 100644
--- a/src/components/Roles/Roles.vue
+++ b/src/components/Roles/Roles.vue
@@ -114,7 +114,7 @@ export default {
methods: {
...mapActions('task', ['handleRegularTask']),
...mapMutations('role', ['setRoleId']),
- ...mapMutations('task', ['setPermanents', 'clearEndFlag']),
+ ...mapMutations('task', ['setPermanents', 'clearEndFlag', 'setScrollToTaskId', 'setShowScrollTo']),
back() {
uni.navigateBack();
@@ -174,6 +174,10 @@ export default {
// 改变index 即手动点击切换 我在此时将当前元素赋值给左边距 实现自动滚动
this.setCurrentRole(index);
});
+
+ // 清除时间轴滚动位置id
+ this.setScrollToTaskId('');
+ this.setShowScrollTo(false);
} catch (error) {
console.error('role.vue changeRole error: ', error);
}
diff --git a/src/components/TimeLine/TimeLine.vue b/src/components/TimeLine/TimeLine.vue
index 328c0d1..8f729a5 100644
--- a/src/components/TimeLine/TimeLine.vue
+++ b/src/components/TimeLine/TimeLine.vue
@@ -15,7 +15,12 @@
>
-
+
+
+
+
+
+
@@ -24,11 +29,12 @@
// import Barrier from './component/Barrier.vue';
import { mapState, mapMutations, mapGetters } from 'vuex';
import { setPlaceholderTasks } from '@/utils/task';
-import TimeBox from './component/TimeBox.vue';
+import TimeBoxIn from './component/TimeBoxIn.vue';
+import TimeBoxOut from './component/TimeBoxOut.vue';
export default {
name: 'TimeLine',
- components: { TimeBox },
+ components: { TimeBoxIn, TimeBoxOut },
data() {
return { top: 0 };
@@ -45,7 +51,6 @@ export default {
// 滚动
scroll(e) {
- console.log('e: ', e);
this.top = e.detail.scrollTop;
this.setShrink(this.top > this.scrollTop);
this.setScrollTop(this.top);
@@ -141,20 +146,6 @@ export default {
this.$t.storage.setStorageSync('taskId', ''); // 记录后即刻清除本地存储
} else {
let item = null;
- // for (let i = 0; i < this.tasks.length; i++) {
- // const task = this.tasks[i];
- // if (task && task.length) {
- // index = i;
- // item = task.find(item => item.detailId);
- // if (item !== -1) {
- // break;
- // }
- // }
- // }
- // const item = this.tasks.find(task => task.detailId);
- // if (item) {
- // this.setScrollToTaskId(`a${item.id}`);
- // } else {
// 没有本地记录的taskId
// 找到当前时间基准线的任务id 记录 并滚动到当前时间基准线
for (let i = 0; i < this.tasks.length; i++) {
@@ -166,13 +157,15 @@ export default {
}
}
}
- console.log('跳转: ', `a${item.id}`);
item && this.setScrollToTaskId(`a${item.id}`); // 有这个task 就记录他的id
- // const task = this.tasks.find(item => this.$moment(+item.planStart).isSame(this.timeNode, this.timeGranularity));
- // task && this.setScrollToTaskId(`a${task.id}`); // 有这个task 就记录他的id
- // }
}
},
},
};
+
+
diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue
deleted file mode 100644
index 91f2416..0000000
--- a/src/components/TimeLine/component/TimeBox.vue
+++ /dev/null
@@ -1,191 +0,0 @@
-
-
-
-
-
- AAA
-
-
-
-
-
- {{ $moment(+task.array[0].planStart).format(startTimeFormat) }}
- {{ $moment(+task.array[0].planStart).format('D日') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ $moment(+task.planStart).format(startTimeFormat) }}
- {{ $moment(+task.planStart).format('D日') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/TimeLine/component/TimeBoxIn.vue b/src/components/TimeLine/component/TimeBoxIn.vue
new file mode 100644
index 0000000..768a034
--- /dev/null
+++ b/src/components/TimeLine/component/TimeBoxIn.vue
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+ {{ $moment(+task.array[0].planStart).format('YYYY年MM月DD日') }}
+ {{ $moment(+task.array[0].planStart).format('YYYY年MM月DD日') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/TimeLine/component/TimeBoxOut.vue b/src/components/TimeLine/component/TimeBoxOut.vue
new file mode 100644
index 0000000..b8c6251
--- /dev/null
+++ b/src/components/TimeLine/component/TimeBoxOut.vue
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+ {{ $moment(+task.planStart).format('YYYY年MM月DD日') }}
+ {{ $moment(+task.planStart).format('YYYY年MM月DD日') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pagesProject/project/project.vue b/src/pagesProject/project/project.vue
index 8d3fd8b..2e3df31 100644
--- a/src/pagesProject/project/project.vue
+++ b/src/pagesProject/project/project.vue
@@ -155,7 +155,6 @@ export default {
async initPlanTasks() {
this.setPrevPlaceholderTasks(); // 向上加载空数据
this.setNextPlaceholderTasks(); // 向下加载空数据
- // // this.$nextTick(() => this.$refs.timeLine.setScrollPosition()); // 滚动到对应位置
await this.getInitTasks(); // 获取初始数据
// 滚动到对应位置
let timer = null;