diff --git a/CHANGELOG.md b/CHANGELOG.md index 211eeba..7fdb4ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,6 +114,7 @@ - | 时间轴插件 | [225d3cc](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/225d3cc) - | 时间轴无任务时时间刻度加载修改 | [4921672](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/4921672) - | 时间轴骨架屏修改 | [ca78d02](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/ca78d02) + - | 监听时间基本点 | [033fca0](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/033fca0) - | 角色显示状态修改 | [7d3b906](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7d3b906) - | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/19228d6) - | 解决时间轴报错 | [da1eece](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/da1eece) diff --git a/src/components/TimeLine/TimeLine.vue b/src/components/TimeLine/TimeLine.vue index 756d18b..3b65aee 100644 --- a/src/components/TimeLine/TimeLine.vue +++ b/src/components/TimeLine/TimeLine.vue @@ -34,7 +34,7 @@ export default { computed: { ...mapState('role', ['visibleRoles']), - ...mapState('task', ['scrollTop', 'showTips', 'tasks', 'topEnd', 'bottomEnd']), + ...mapState('task', ['scrollTop', 'showTips', 'tasks', 'topEnd', 'bottomEnd', 'showSkeleton', 'randomId']), ...mapGetters('task', ['timeGranularity']), }, @@ -54,25 +54,49 @@ export default { // 滚动到顶部 async handleScrollTop() { - if (!this.tasks || !this.tasks.length) return; + if (!this.tasks || !this.tasks.length || this.showSkeleton) return; const startTime = this.tasks[0].planStart - 0; if ((this.tasks[0].plugins && this.tasks[0].plugins.length === 0) || this.topEnd) { // 没有数据时 自动加载数据 // console.warn('滚动到顶部没有数据时: '); const addTasks = [ { + id: this.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: this.$t.time.add(startTime, -6, 'day').valueOf(), + }, + { + id: this.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: this.$t.time.add(startTime, -5, 'day').valueOf(), + }, + { + id: this.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: this.$t.time.add(startTime, -4, 'day').valueOf(), + }, + { + id: this.randomId, panel: {}, plugins: [], process: 4, planStart: this.$t.time.add(startTime, -3, 'day').valueOf(), }, { + id: this.randomId, panel: {}, plugins: [], process: 4, planStart: this.$t.time.add(startTime, -2, 'day').valueOf(), }, { + id: this.randomId, panel: {}, plugins: [], process: 4, @@ -95,7 +119,7 @@ export default { // 滚动到底部 async handleScrollBottom() { - if (!this.tasks || !this.tasks.length) return; + if (!this.tasks || !this.tasks.length || this.showSkeleton) return; const { tasks, timeGranularity } = this; const startTime = tasks[tasks.length - 1].planStart - 0; if ((tasks[0].plugins && tasks[0].plugins.length === 0) || this.bottomEnd) { @@ -103,23 +127,47 @@ export default { // console.warn('滚动到底部没有数据时: '); const addTasks = [ { + id: this.randomId, panel: {}, plugins: [], process: 4, planStart: this.$t.time.add(startTime, 1, timeGranularity).valueOf(), }, { + id: this.randomId, panel: {}, plugins: [], process: 4, planStart: this.$t.time.add(startTime, 2, timeGranularity).valueOf(), }, { + id: this.randomId, panel: {}, plugins: [], process: 4, planStart: this.$t.time.add(startTime, 3, timeGranularity).valueOf(), }, + { + id: this.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: this.$t.time.add(startTime, 4, timeGranularity).valueOf(), + }, + { + id: this.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: this.$t.time.add(startTime, 5, timeGranularity).valueOf(), + }, + { + id: this.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: this.$t.time.add(startTime, 6, timeGranularity).valueOf(), + }, ]; this.setDownTasks(addTasks); } else { diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue index c7a3a92..a759856 100644 --- a/src/components/TimeLine/component/TimeBox.vue +++ b/src/components/TimeLine/component/TimeBox.vue @@ -2,7 +2,7 @@ - + diff --git a/src/pages/project/project.vue b/src/pages/project/project.vue index e6b9226..ad85156 100644 --- a/src/pages/project/project.vue +++ b/src/pages/project/project.vue @@ -42,6 +42,7 @@ export default { * 永久日常任务不发生改变 */ timeNode(val) { + console.log('val: ', val); if (val && this.roleId) { // 根据时间和角色查找日常任务 this.getGlobalData(); @@ -58,7 +59,9 @@ export default { roleId(val) { if (val) { // 如果storage里有timeNode,修改store里的timeNode - this.setTimeNode(+this.$t.storage.getStorageSync('timeNode') || Date.now()); + this.setTimeNode( + +this.$t.storage.getStorageSync('timeNode') !== 0 ? +this.$t.storage.getStorageSync('timeNode') !== 0 : Date.now(), + ); // 清空storage this.$t.storage.setStorageSync('timeNode', ''); console.log('当角色发生变化时: ', this.timeNode); @@ -133,7 +136,7 @@ export default { await this.getTasks({ queryType: 1 }); // 预加载 上下的定期任务 - if (this.tasks && this.tasks.length && this.tasks[0].id) { + if (this.tasks && this.tasks.length && this.tasks[0].detailId) { this.$nextTick(() => { const { tasks, timeGranularity } = this; this.getTasks({ timeNode: +tasks[0].planStart, queryType: 0, queryNum: 6 }); // 向上拿数据 diff --git a/src/store/task/mutations.js b/src/store/task/mutations.js index d5cad9b..1994329 100644 --- a/src/store/task/mutations.js +++ b/src/store/task/mutations.js @@ -80,18 +80,42 @@ const mutations = { } const initData = [ { + id: state.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: uni.$t.time.add(sTime, -6, 'day').valueOf(), + }, + { + id: state.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: uni.$t.time.add(sTime, -5, 'day').valueOf(), + }, + { + id: state.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: uni.$t.time.add(sTime, -4, 'day').valueOf(), + }, + { + id: state.randomId, panel: {}, plugins: [], process: 4, planStart: uni.$t.time.add(sTime, -3, 'day').valueOf(), }, { + id: state.randomId, panel: {}, plugins: [], process: 4, planStart: uni.$t.time.add(sTime, -2, 'day').valueOf(), }, { + id: state.randomId, panel: {}, plugins: [], process: 4, @@ -124,23 +148,47 @@ const mutations = { } const initData = [ { + id: state.randomId, panel: {}, plugins: [], process: 4, planStart: uni.$t.time.add(sTime, 1, 'day').valueOf(), }, { + id: state.randomId, panel: {}, plugins: [], process: 4, planStart: uni.$t.time.add(sTime, 2, 'day').valueOf(), }, { + id: state.randomId, panel: {}, plugins: [], process: 4, planStart: uni.$t.time.add(sTime, 3, 'day').valueOf(), }, + { + id: state.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: uni.$t.time.add(sTime, 4, 'day').valueOf(), + }, + { + id: state.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: uni.$t.time.add(sTime, 5, 'day').valueOf(), + }, + { + id: state.randomId, + panel: {}, + plugins: [], + process: 4, + planStart: uni.$t.time.add(sTime, 6, 'day').valueOf(), + }, ]; state.tasks = [...state.tasks.concat(initData)]; } else { diff --git a/src/store/task/state.js b/src/store/task/state.js index d453785..7aca908 100644 --- a/src/store/task/state.js +++ b/src/store/task/state.js @@ -25,6 +25,7 @@ const state = { // 定期任务 tasks: [], showSkeleton: false, // 定期任务骨架屏 + randomId: Math.floor(Math.random() * 100000000000000000000), // 随机id }; export default state;