Browse Source

fix: 定期任务key值修改

pull/1/head
song 4 years ago
parent
commit
c6688dbcbe
  1. 1
      CHANGELOG.md
  2. 54
      src/components/TimeLine/TimeLine.vue
  3. 2
      src/components/TimeLine/component/TimeBox.vue
  4. 7
      src/pages/project/project.vue
  5. 48
      src/store/task/mutations.js
  6. 1
      src/store/task/state.js

1
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)

54
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 {

2
src/components/TimeLine/component/TimeBox.vue

@ -2,7 +2,7 @@
<view class="column">
<!-- v-if="tasks && tasks.length" -->
<view>
<view :key="index" v-for="(task, index) in tasks">
<view :key="task.id" v-for="task in tasks">
<view class="flex">
<TimeStatus :task="task" />
<view class="flex items-center justify-between flex-1 ml-2 task-column">

7
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) {
// storagetimeNode,storetimeNode
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 }); //

48
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 {

1
src/store/task/state.js

@ -25,6 +25,7 @@ const state = {
// 定期任务
tasks: [],
showSkeleton: false, // 定期任务骨架屏
randomId: Math.floor(Math.random() * 100000000000000000000), // 随机id
};
export default state;

Loading…
Cancel
Save