diff --git a/CHANGELOG.md b/CHANGELOG.md index 6385415..5c38b37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ - | 时间轴上下滑动 | [4d0ae46](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/4d0ae46) - | 提示信息显示bug及日常任务收缩问题 | [f2f06c5](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f2f06c5) - | 下拉加载定期任务传参,时间格式化修改 | [0b95a0e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/0b95a0e) + - | 修改报错 | [531c14d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/531c14d) - | 修改角色栏组件 | [a54c601](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a54c601) - | 修改main | [749ae9a](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/749ae9a) diff --git a/src/components/Plugin/Plugin.vue b/src/components/Plugin/Plugin.vue index ebb6dd5..aa59473 100644 --- a/src/components/Plugin/Plugin.vue +++ b/src/components/Plugin/Plugin.vue @@ -9,7 +9,8 @@ - + + diff --git a/src/components/TimeLine/TimeLine.vue b/src/components/TimeLine/TimeLine.vue index 10bcc89..5450a2e 100644 --- a/src/components/TimeLine/TimeLine.vue +++ b/src/components/TimeLine/TimeLine.vue @@ -38,7 +38,7 @@ export default { }, methods: { - ...mapMutations('home', ['setScrollTop', 'setShrink', 'setRoleId']), + ...mapMutations('home', ['setScrollTop', 'setShrink', 'setRoleId', 'setUpTasks', 'setDownTasks']), // 滚动 scroll(e) { @@ -50,26 +50,79 @@ export default { // 滚动到顶部 async handleScrollTop() { if (this.topEnd) return; - const upQuery = { - timeNode: +this.tasks[0].planStart, - queryType: 0, - queryNum: 6, - }; - await this.$emit('getTasks', upQuery); + const startTime = this.tasks[0].planStart - 0; + console.log('this.topEnd: ', this.topEnd); + console.log('this.tasks: ', this.tasks); + console.log('this.tasks[0].plugins: ', this.tasks[0].plugins); + if (this.tasks[0].plugins && this.tasks[0].plugins.length === 0 && !this.topEnd) { + // 没有数据时 自动加载数据 + console.log('没有数据时: '); + const addTasks = [ + { + panel: {}, + plugins: [], + planStart: this.$t.time.add(startTime, -3, 'day').valueOf(), + }, + { + panel: {}, + plugins: [], + planStart: this.$t.time.add(startTime, -2, 'day').valueOf(), + }, + { + panel: {}, + plugins: [], + planStart: this.$t.time.add(startTime, -1, 'day').valueOf(), + }, + ]; + this.setUpTasks([...addTasks.concat(this.tasks)]); + } else { + // 有数据时 + console.log('有数据时: '); + const upQuery = { + timeNode: startTime, + queryType: 0, + queryNum: 6, + }; + await this.$emit('getTasks', upQuery); + } }, // 滚动到底部 async handleScrollBottom() { if (this.bottomEnd) return; - // 时间基准点=最后一个任务的开始时间+当前时间颗粒度 - const cycle = this.$t.time.computeCycle('天'); - const timeNode = this.$t.time.add(+this.tasks[this.tasks.length - 1].planStart, 1, cycle).valueOf(); - const downQuery = { - timeNode, - queryType: 1, - queryNum: 6, - }; - await this.$emit('getTasks', downQuery); + const startTime = this.tasks[this.tasks.length - 1].planStart - 0; + if (this.tasks[0].plugins && this.tasks[0].plugins.length === 0 && !this.topEnd) { + // 没有数据时 自动加载数据 + console.log('没有数据时: '); + const addTasks = [ + { + panel: {}, + plugins: [], + planStart: this.$t.time.add(startTime, 1, 'day').valueOf(), + }, + { + panel: {}, + plugins: [], + planStart: this.$t.time.add(startTime, 2, 'day').valueOf(), + }, + { + panel: {}, + plugins: [], + planStart: this.$t.time.add(startTime, 3, 'day').valueOf(), + }, + ]; + this.setDownTasks([...this.tasks.concat(addTasks)]); + } else { + // 时间基准点=最后一个任务的开始时间+当前时间颗粒度 + const cycle = this.$t.time.computeCycle('天'); + const timeNode = this.$t.time.add(startTime, 1, cycle).valueOf(); + const downQuery = { + timeNode, + queryType: 1, + queryNum: 6, + }; + await this.$emit('getTasks', downQuery); + } }, // 设置基准点 @@ -80,7 +133,6 @@ export default { const scrollHeight = document.getElementById('scroll').clientHeight; let width = document.documentElement.clientWidth; for (let i = 0; i < 3; i++) { - // TODO: 高度不对 if (tasks[i].panel && tasks[i].panel.height) { // 如果后台返回了高度,就用返回得任务面板高度 + 固定边距42 tasksHeight += +tasks[i].panel.height + 42; diff --git a/src/plugins/p-deliverable/p-deliverable.vue b/src/plugins/p-deliverable/p-deliverable.vue index 04bcc69..9e186ea 100644 --- a/src/plugins/p-deliverable/p-deliverable.vue +++ b/src/plugins/p-deliverable/p-deliverable.vue @@ -1,5 +1,6 @@