From 225d3cc5d1bbd3b8363d725242350ddcb5ab5f5d Mon Sep 17 00:00:00 2001 From: lucky Date: Fri, 23 Jul 2021 13:28:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=97=B6=E9=97=B4=E8=BD=B4=E6=8F=92?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + src/components/Plugin/Plugin.vue | 4 +-- src/components/TimeLine/TimeLine.vue | 13 +++---- src/components/TimeLine/component/TimeBox.vue | 36 +++++++++---------- src/pages/project/project.vue | 9 +++-- src/store/home/state.js | 21 ++++++++++- 6 files changed, 53 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a50dde..9ace166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/94cd671) - | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/69e7931) - | 配置默认插件接口 | [f0c177d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f0c177d) + - | 全局插件及默认插件位置修改 | [6c80d08](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/6c80d08) - | 时间基准线,默认插件 | [a33ba1e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a33ba1e) - | 时间轴界面 | [33927e9](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/33927e9) - | 时间轴修改状态时提示框增加 | [e841392](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e841392) diff --git a/src/components/Plugin/Plugin.vue b/src/components/Plugin/Plugin.vue index 53b2180..f58ab23 100644 --- a/src/components/Plugin/Plugin.vue +++ b/src/components/Plugin/Plugin.vue @@ -1,5 +1,5 @@ diff --git a/src/components/TimeLine/TimeLine.vue b/src/components/TimeLine/TimeLine.vue index c4c137f..67659fe 100644 --- a/src/components/TimeLine/TimeLine.vue +++ b/src/components/TimeLine/TimeLine.vue @@ -84,12 +84,13 @@ export default { if (tasks && tasks.length) { let tasksHeight = 0; const scrollHeight = document.getElementById('scroll').clientHeight; - for (let i = 0; i < 3; i++) { - // TODO: 高度不对 - // if (tasks[i].panel && tasks[i].panel.height) { - // tasksHeight += +tasks[i].panel.height + 42; - // } - } + // for (let i = 0; i < 3; i++) { + // if (tasks[i].panel && tasks[i].panel.height) { + // tasksHeight += +tasks[i].panel.height + 42; + // } else { + // tasksHeight += (width / 20) * 4 + 42; + // } + // } this.top = tasksHeight - scrollHeight / 2; console.log('this.top: ', this.top); } diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue index 555e9e3..4c05c8f 100644 --- a/src/components/TimeLine/component/TimeBox.vue +++ b/src/components/TimeLine/component/TimeBox.vue @@ -28,28 +28,19 @@ - - + + + + - @@ -91,6 +82,11 @@ export default { changeTimeNode(time) { this.setTimeNode(time); }, + + // 设置网格布局 + getClass(col, row) { + return [`row-span-${row}`, `col-span-${col}`]; + }, }, }; diff --git a/src/pages/project/project.vue b/src/pages/project/project.vue index 4ba08a9..118faf8 100644 --- a/src/pages/project/project.vue +++ b/src/pages/project/project.vue @@ -173,15 +173,20 @@ export default { try { await this.getTasks({ queryType: 0 }); await this.getTasks({ queryType: 1 }); - // 查上下的任务 + // 查上页的任务 const upQuery = { timeNode: +this.tasks[0].planStart, queryType: 0, queryNum: 6, }; await this.getTasks(upQuery); + + // 查下页的任务 + // 时间基准点=最后一个任务的开始时间+当前时间颗粒度 + 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: +this.tasks[this.tasks.length - 1].planStart, + timeNode, queryType: 1, queryNum: 6, }; diff --git a/src/store/home/state.js b/src/store/home/state.js index 9b2d85d..4de6820 100644 --- a/src/store/home/state.js +++ b/src/store/home/state.js @@ -14,7 +14,26 @@ const state = { roleId: '', // 当前展示查看的角色id timeNode: new Date().getTime(), // 时间基准点 timeUnit: 4, // // 时间颗粒度 - tasks: [], // 定期任务 + tasks: [ + { + panel: {}, + plugins: [], + planStart: new Date().getTime(), + planDuration: 0, + }, + { + panel: {}, + plugins: [], + planStart: new Date().getTime(), + planDuration: 0, + }, + { + panel: {}, + plugins: [], + planStart: new Date().getTime(), + planDuration: 0, + }, + ], // 定期任务 topEnd: false, // 时间轴向上查任务到顶了 bottomEnd: false, // 时间轴向下查任务到底了 dailyTasks: [], // 日常任务 From da1eece364abde5a605f7075f53f4d1b5820d485 Mon Sep 17 00:00:00 2001 From: lucky Date: Fri, 23 Jul 2021 16:26:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=BD=B4=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 ++++ src/components/Globals/Globals.vue | 2 +- src/components/Plugin/Plugin.vue | 30 +++++++++------- src/components/Roles/Roles.vue | 2 +- src/components/TimeLine/component/TimeBox.vue | 18 ++++++---- src/store/home/mutations.js | 35 ++++++++++++++++--- src/store/home/state.js | 3 -- 7 files changed, 69 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aece1b7..f06893e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,12 @@ ### 🌟 新功能 范围|描述|commitId --|--|-- + - | 标题栏变化 | [3898cfe](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/3898cfe) - | 标题栏变化 | [c0fcd9d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/c0fcd9d) - | 标题栏角色栏全局任务组件新建 | [0500cb4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/0500cb4) - | 插件数据获取 | [5b91bdc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/5b91bdc) - | 存token | [b8a178d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/b8a178d) + - | 定期任务面板骨架屏添加 | [b2698c0](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/b2698c0) - | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/94cd671) - | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/69e7931) - | 配置默认插件接口 | [f0c177d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f0c177d) @@ -16,6 +18,7 @@ - | 时间轴修改状态时提示框增加 | [e841392](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e841392) - | 提交到本地 | [9cbe411](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/9cbe411) - | 添加时间轴上下滚动 | [2b81bbc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/2b81bbc) + - | 引入dayjs | [29b8b93](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/29b8b93) - | db store | [6414c4f](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/6414c4f) - | indexedDB | [687394e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/687394e) - | post 封装 | [da52e94](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/da52e94) @@ -48,9 +51,12 @@ - | 骨架屏替换 | [e9fdd71](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e9fdd71) - | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/19228d6) - | 上下滚动时间轴 | [d533a01](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/d533a01) + - | 上下滑动加载定期任务 | [4090d89](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/4090d89) + - | 时间轴插件 | [225d3cc](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/225d3cc) - | 时间轴上下滚动数据加载bug修改 | [e82ede4](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e82ede4) - | 时间轴上下滑动 | [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) - | 修改角色栏组件 | [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) @@ -64,6 +70,7 @@ ### 🔨 代码重构 范围|描述|commitId --|--|-- + - | 下滑时间轴添加备注 | [4fd20e3](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/4fd20e3) template | eslint prettier sass uview tailwindcss | [9c966a1](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/9c966a1) diff --git a/src/components/Globals/Globals.vue b/src/components/Globals/Globals.vue index b545046..a71929d 100644 --- a/src/components/Globals/Globals.vue +++ b/src/components/Globals/Globals.vue @@ -7,7 +7,7 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + - @@ -36,7 +42,6 @@ export default { }, async created() { await this.getPlugin(); - console.log(this.pluginContent.js); if (this.pluginContent.js) { var scriptDom = document.createElement('script'); scriptDom.id = `p${this.pluginContent.pluginId}`; @@ -51,6 +56,7 @@ export default { pluginId, styleType, }); + this.$emit('changeLoading', false); this.pluginContent = res; console.log(this.pluginContent); }, diff --git a/src/components/Roles/Roles.vue b/src/components/Roles/Roles.vue index ba8a2b8..42d646a 100644 --- a/src/components/Roles/Roles.vue +++ b/src/components/Roles/Roles.vue @@ -93,7 +93,7 @@ export default { //改变index 即手动点击切换 我在此时将当前元素赋值给左边距 实现自动滚动 this.setCurrentRole(index); // 清空定期任务数据 - this.setTasks([]); + this.setTasks(); // 根据时间基准点和角色查找定期任务 await this.$emit('getTasksByRole'); } catch (error) { diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue index 4c05c8f..a3ca9a7 100644 --- a/src/components/TimeLine/component/TimeBox.vue +++ b/src/components/TimeLine/component/TimeBox.vue @@ -4,7 +4,9 @@ - {{ $moment(+item.planStart).format('MM-DD HH:mm') }} {{ $t.time.formatDuration(item.planDuration) }} + + {{ $moment(+item.planStart).format('MM-DD HH:mm') }} + @@ -23,19 +25,23 @@ @click="changeTimeNode(item.planStart)" class="h-16" margin="0" + v-if="item.plugins && item.plugins.length" > - - + + + + - + @@ -59,7 +65,7 @@ export default { name: 'TimeBox', components: { TimeStatus, Skeleton }, data() { - return { currentComponent: '', styleType: 0 }; + return { currentComponent: '', styleType: 0, taskLoading: true }; }, computed: mapState('home', ['roleId', 'timeNode', 'timeUnit', 'tasks']), diff --git a/src/store/home/mutations.js b/src/store/home/mutations.js index ec844a5..c44dd92 100644 --- a/src/store/home/mutations.js +++ b/src/store/home/mutations.js @@ -125,7 +125,12 @@ const mutations = { if (!data || !data.length) { state.topEnd = true; } - state.tasks = [...data.concat(state.tasks)] || []; + console.log('!state.tasks.plugins.length: ', !state.tasks[0].name); + if (!state.tasks[0].name) { + state.tasks = [...data]; + } else { + state.tasks = [...data.concat(state.tasks)]; + } }, /** @@ -137,16 +142,36 @@ const mutations = { if (!data || !data.length) { state.bottomEnd = true; } - state.tasks = [...state.tasks.concat(data)] || []; + if (!state.tasks[0].name) { + state.tasks = [...data]; + } else { + state.tasks = [...state.tasks.concat(data)]; + } }, /** * 清空定期任务数据 * @param {Object} state - * @param {Array} data 服务端返回的模板数组 */ - setTasks(state, data) { - state.tasks = data || []; + setTasks(state) { + const data = [ + { + panel: {}, + plugins: [], + planStart: new Date().getTime(), + }, + { + panel: {}, + plugins: [], + planStart: new Date().getTime(), + }, + { + panel: {}, + plugins: [], + planStart: new Date().getTime(), + }, + ]; + state.tasks = data; }, /** diff --git a/src/store/home/state.js b/src/store/home/state.js index 4de6820..553a3c1 100644 --- a/src/store/home/state.js +++ b/src/store/home/state.js @@ -19,19 +19,16 @@ const state = { panel: {}, plugins: [], planStart: new Date().getTime(), - planDuration: 0, }, { panel: {}, plugins: [], planStart: new Date().getTime(), - planDuration: 0, }, { panel: {}, plugins: [], planStart: new Date().getTime(), - planDuration: 0, }, ], // 定期任务 topEnd: false, // 时间轴向上查任务到顶了