Browse Source

fix: 插件bug解决

tall
lucky 4 years ago
parent
commit
41257ebd71
  1. 1
      CHANGELOG.md
  2. 3
      src/components/Plugin/Plugin.vue
  3. 86
      src/components/TimeLine/TimeLine.vue
  4. 3
      src/plugins/p-deliverable/p-deliverable.vue
  5. 3
      src/plugins/p-subproject/p-subproject.vue
  6. 2
      src/plugins/p-subtasks/p-subtasks.vue
  7. 3
      src/plugins/p-task-countdown/p-task-countdown.vue
  8. 3
      src/plugins/p-task-description/p-task-description.vue
  9. 12
      src/plugins/p-task-duration-delay/p-task-duration-delay.vue
  10. 8
      src/plugins/p-task-start-time-delay/p-task-start-time-delay.vue
  11. 3
      src/plugins/p-task-title/p-task-title.vue
  12. 7
      src/store/home/mutations.js
  13. 4
      src/store/home/state.js
  14. 12
      src/utils/time.js
  15. 2
      vue.config.js

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

3
src/components/Plugin/Plugin.vue

@ -9,7 +9,8 @@
<p-task-title :item="item" v-if="pluginId === '1'" />
<p-task-description :item="item" v-if="pluginId === '2'" />
<p-task-duration-delay :item="item" v-if="pluginId === '3'" />
<p-task-start-time-delay :item="item" v-if="pluginId === '4'" />
<p-task-start-time-delay :item="item" />
<!-- <p-task-start-time-delay :item="item" v-if="pluginId === '4'" /> -->
<p-deliverable :item="item" v-if="pluginId === '5'" />
<p-subtasks :item="item" v-if="pluginId === '6'" />
<p-subproject :item="item" v-if="pluginId === '7'" />

86
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;

3
src/plugins/p-deliverable/p-deliverable.vue

@ -1,5 +1,6 @@
<template>
<div>交付物</div>
<!-- 交付物 -->
<view>交付物</view>
</template>
<script>

3
src/plugins/p-subproject/p-subproject.vue

@ -1,5 +1,6 @@
<template>
<div>子项目插件显示子项目</div>
<!-- 子项目插件 -->
<view>子项目插件显示子项目</view>
</template>
<script>

2
src/plugins/p-subtasks/p-subtasks.vue

@ -1,5 +1,5 @@
<template>
<div>子任务插件显示子任务</div>
<view>子任务插件显示子任务</view>
</template>
<script>

3
src/plugins/p-task-countdown/p-task-countdown.vue

@ -1,5 +1,6 @@
<template>
<div>任务倒计时插件</div>
<!-- 任务倒计时插件 -->
<view>任务倒计时插件</view>
</template>
<script>

3
src/plugins/p-task-description/p-task-description.vue

@ -1,5 +1,6 @@
<template>
<div>{{ item.description }}</div>
<!-- 任务描述 -->
<view>{{ item.description }}</view>
</template>
<script>

12
src/plugins/p-task-duration-delay/p-task-duration-delay.vue

@ -1,5 +1,15 @@
<template>
<div>任务时长延迟插件+-1min时间格式可设置</div>
<view v-if="item.realDuration && item.planDuration">
<!-- 任务时长延迟插件 -->
<!-- 超时 -->
<span class="text-green-500 font-bold" v-if="+item.realDuration > +item.planDuration"
>+{{ $t.time.formatDuration(+item.realDuration - +item.planDuration) }}</span
>
<!-- 延时 -->
<span class="text-red-500 font-bold" v-if="+item.realDuration < +item.planDuration"
>-{{ $t.time.formatDuration(+item.planDuration - +item.realDuration) }}</span
>
</view>
</template>
<script>

8
src/plugins/p-task-start-time-delay/p-task-start-time-delay.vue

@ -1,5 +1,11 @@
<template>
<div>任务开始时间延迟插件+-1hour</div>
<!-- <view v-if="item.realStart && item.planStart"> -->
<view>
<!-- 任务开始时间延迟插件 -->
<!-- 超时 -->
<!-- <span>{{ $t.time.formatBeginTime((+item.realStart) - (+item.planStart)) }}</span> -->
<span>{{ $t.time.formatDuration(1626843599995 - 1626757200000) }}</span>
</view>
</template>
<script>

3
src/plugins/p-task-title/p-task-title.vue

@ -1,5 +1,6 @@
<template>
<div>{{ item.name }}</div>
<!-- 任务名插件 -->
<view>{{ item.name }}</view>
</template>
<script>

7
src/store/home/mutations.js

@ -153,21 +153,22 @@ const mutations = {
* @param {Object} state
*/
setTasks(state) {
const time = +new Date().getTime();
const data = [
{
panel: {},
plugins: [],
planStart: new Date().getTime(),
planStart: uni.$t.time.add(time, -1, 'day').valueOf(),
},
{
panel: {},
plugins: [],
planStart: new Date().getTime(),
planStart: time,
},
{
panel: {},
plugins: [],
planStart: new Date().getTime(),
planStart: uni.$t.time.add(time, 1, 'day').valueOf(),
},
];
state.tasks = data;

4
src/store/home/state.js

@ -18,7 +18,7 @@ const state = {
{
panel: {},
plugins: [],
planStart: new Date().getTime(),
planStart: uni.$t.time.add(+new Date().getTime(), -1, 'day').valueOf(),
},
{
panel: {},
@ -28,7 +28,7 @@ const state = {
{
panel: {},
plugins: [],
planStart: new Date().getTime(),
planStart: uni.$t.time.add(+new Date().getTime(), 1, 'day').valueOf(),
},
], // 定期任务
topEnd: false, // 时间轴向上查任务到顶了

12
src/utils/time.js

@ -241,6 +241,17 @@ const formatObjectTimeToMs = (days = 0, hours = 0, minutes = 0, seconds = 0) =>
return days * 24 * 60 * 60 * 1000 + hours * 60 * 60 * 1000 + minutes * 60 * 1000 + seconds * 1000;
};
const setDuringTime = time => {
// 小时
const hour = time / (60 * 60);
// 分钟
const min = time / 60 - hour * 60;
// 秒
const sec = time - hour * 60 * 60 - min * 60;
const result = hour + '时' + min + '分' + sec + '秒';
return result;
};
/**
* 计算过滤 周期
* @param {string} time 周期字符串
@ -307,4 +318,5 @@ export default {
formatObjectTimeToMs,
computeCycle,
formatStartTimeToCycleTime,
setDuringTime,
};

2
vue.config.js

@ -6,7 +6,7 @@ module.exports = {
productionSourceMap: false,
devServer: {
// open: true,
host: '127.0.0.1',
// host: '127.0.0.1',
overlay: { warnings: false, errors: true },
// proxy: {}
},

Loading…
Cancel
Save