diff --git a/CHANGELOG.md b/CHANGELOG.md index 0303d86..379092f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -154,6 +154,7 @@ --|--|-- - | 修改定期任务骨架屏高度 | [909a734](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/909a734) - | 插件查询及展示 | [4dba770](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/4dba770) + - | 整理代码 | [7a55315](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7a55315) - | 日历的更改 | [7353ac8](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7353ac8) - | 测试接口 | [215e074](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/215e074) - | 组件文件夹新建 | [22bfe7b](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/22bfe7b) diff --git a/src/components/Roles/Roles.vue b/src/components/Roles/Roles.vue index ab6eaa5..1de30b1 100644 --- a/src/components/Roles/Roles.vue +++ b/src/components/Roles/Roles.vue @@ -56,9 +56,9 @@ export default { }, methods: { - ...mapActions('task', ['handleRegularTask']), + ...mapActions('task', ['handleRegularTask', 'getPermanent']), ...mapMutations('role', ['setRoleId']), - ...mapMutations('task', ['setPermanents', 'setDailyTasks', 'clearEndFlag']), + ...mapMutations('task', ['setPermanents', 'setDailyTasks', 'clearEndFlag', 'setTimeNode']), // 设置滚动位置 setCurrentRole(index) { @@ -85,6 +85,7 @@ export default { // 时间基准点不用管 project监听了roleId 里处理了 changeRole(id, index) { try { + console.log('切换角色'); // 清除多余的script this.clearPluginScript(); this.$nextTick(() => { diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue index fb72904..c7a3a92 100644 --- a/src/components/TimeLine/component/TimeBox.vue +++ b/src/components/TimeLine/component/TimeBox.vue @@ -19,7 +19,6 @@ :show-foot="false" :show-head="false" :style="{ height: setHeight(task.panel) }" - @click="onClickTask(+task.planStart)" class="h-16" margin="0" v-if="showSkeleton" @@ -35,12 +34,11 @@ :show-foot="false" :show-head="false" :style="{ height: setHeight(task.panel) }" - @click="onClickTask(+task.planStart)" class="h-16" margin="0" v-if="tasks && tasks.length && task.process !== 4 && !showSkeleton" + @click="onClickTask(+task.planStart)" > - @@ -92,7 +90,7 @@ export default { methods: { ...mapActions('task', ['getGlobal']), - ...mapMutations('task', ['setTipsContent', 'setTipsContent', 'setTimeNode']), + ...mapMutations('task', ['setTipsContent', 'setTipsContent']), // 设置任务面板高度 setHeight(panel) { @@ -110,6 +108,8 @@ export default { onClickTask(planStart) { const param = { roleId: this.roleId, timeNode: planStart, timeUnit: this.timeUnit }; this.getGlobal(param); + this.$t.storage.setStorageSync('timeNode', planStart); + this.$t.storage.setStorageSync('roleId', this.roleId); }, // 设置网格布局 diff --git a/src/components/TimeLine/component/TimeStatus.vue b/src/components/TimeLine/component/TimeStatus.vue index 3143810..30fbedb 100644 --- a/src/components/TimeLine/component/TimeStatus.vue +++ b/src/components/TimeLine/component/TimeStatus.vue @@ -163,7 +163,7 @@ export default { const { realStart, planDuration } = this.task; const leftTime = +realStart + +planDuration - Date.now(); // 剩余时间 const { num, time } = this.$t.time.computeDurationText(leftTime); - console.log('time', time); // DEBUG: + // console.log('time', time); // DEBUG: this.$nextTick(() => { if (!time) return; this.timer = setTimeout(() => { diff --git a/src/pages/project/project.vue b/src/pages/project/project.vue index 99098f1..b40233a 100644 --- a/src/pages/project/project.vue +++ b/src/pages/project/project.vue @@ -44,8 +44,8 @@ export default { timeNode(val) { if (val && this.roleId) { // 根据时间和角色查找日常任务 - this.getGlobalData(); - this.getInitTasks(); + // this.getGlobalData(); + // this.getInitTasks(); } }, @@ -57,7 +57,11 @@ export default { */ roleId(val) { if (val) { - this.setTimeNode(Date.now()); + // 如果storage里有timeNode,修改store里的timeNode + this.setTimeNode(+this.$t.storage.getStorageSync('timeNode') || Date.now()); + // 清空storage + this.$t.storage.setStorageSync('timeNode', ''); + console.log('当角色发生变化时: ', this.timeNode); // 根据角色查找永久的日常任务 this.getPermanent(val); } @@ -106,13 +110,19 @@ export default { // 没有项目id参数 this.$t.ui.showToast('缺少项目信息参数'); } else { + // 如果storage里有timeNode,修改store里的timeNode + this.setTimeNode(this.$t.storage.getStorageSync('timeNode') - 0); + // 清空storage + this.$t.storage.setStorageSync('timeNode', ''); + console.log('timeNode: ', this.$t.storage.getStorageSync('timeNode'), this.timeNode); // 根据项目id获取项目信息 await this.getProjectById({ projectId: options.p }); // 根据项目id获取角色列表 await this.getRoles({ projectId: options.p }); this.setInitialRoleId(this.visibleRoles); - // 获取初始定期任务 - // await this.getInitTasks(); + // 根据时间和角色查找日常任务 + await this.getGlobalData(); + await this.getInitTasks(); } } catch (error) { console.error('project init function:', error); @@ -126,7 +136,7 @@ export default { await this.getTasks({ queryType: 1 }); // 预加载 上下的定期任务 - if (this.tasks && this.tasks.length && this.tasks.plugins && this.tasks.plugins.length) { + if (this.tasks && this.tasks.length && this.tasks.id) { this.$nextTick(() => { const { tasks, timeGranularity } = this; this.getTasks({ timeNode: +tasks[0].planStart, queryType: 0, queryNum: 6 }); @@ -146,8 +156,11 @@ export default { setInitialRoleId(visibleList) { const index = visibleList.findIndex(item => item.mine === '1'); const currentRole = index > 0 ? visibleList[index] : visibleList[0]; - const currentRoleId = currentRole ? currentRole.id : ''; + const storageRoleId = this.$t.storage.getStorageSync('roleId'); + const currentRoleId = storageRoleId ? storageRoleId : currentRole ? currentRole.id : ''; this.setRoleId(currentRoleId); + // 清空storage + this.$t.storage.setStorageSync('roleId', ''); }, /** @@ -170,7 +183,7 @@ export default { queryNum: query.queryNum || 3, queryType: query.queryType, }; - + console.log('params: ', params); await this.getRegulars(params); this.setShowSkeleton(false); } catch (error) { diff --git a/src/store/task/mutations.js b/src/store/task/mutations.js index 18c10a9..d5cad9b 100644 --- a/src/store/task/mutations.js +++ b/src/store/task/mutations.js @@ -52,6 +52,7 @@ const mutations = { */ setTimeNode(state, data) { state.timeNode = data; + console.log('state.timeNode : ', state.timeNode); }, /**