Browse Source

refactor: 任务状态重构

develop
wally 4 years ago
parent
commit
469365582a
  1. 7
      .eslintrc.js
  2. 1
      CHANGELOG.md
  3. 2
      src/components/Plugin/Plugin.vue
  4. 4
      src/components/TimeLine/component/TimeBox.vue
  5. 52
      src/components/TimeLine/component/TimeStatus.vue

7
.eslintrc.js

@ -19,6 +19,13 @@ module.exports = {
'vue/max-attributes-per-line': 'off', 'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off', 'vue/multiline-html-element-content-newline': 'off',
'vue/html-indent': 'off', 'vue/html-indent': 'off',
'vue/html-closing-bracket-newline': [
'error',
{
singleline: 'never',
multiline: 'always',
},
],
}, },
parserOptions: { parser: 'babel-eslint' }, parserOptions: { parser: 'babel-eslint' },

1
CHANGELOG.md

@ -6,6 +6,7 @@
- | db store | 6414c4f - | db store | 6414c4f
- | indexedDB | 687394e - | indexedDB | 687394e
pinch | alloy finger实现图片的pinch放大缩小 | de01343 pinch | alloy finger实现图片的pinch放大缩小 | de01343
plugin | 插件添加了token及param参数 | aeb0292
- | post 封装 | da52e94 - | post 封装 | da52e94
- | tall插件封装 | 1bcb920 - | tall插件封装 | 1bcb920
- | ws storage | 21b3a06 - | ws storage | 21b3a06

2
src/components/Plugin/Plugin.vue

@ -73,7 +73,7 @@ export default {
const reg = /data-root=["|']?(\w+)["|']?/gi; const reg = /data-root=["|']?(\w+)["|']?/gi;
// console.log(data.html); // console.log(data.html);
let uuid = ''; let uuid = '';
// FIXME: js html // FIXME: js, html
if (data.html) { if (data.html) {
// data-root=xxx xxx pluginTaskId // data-root=xxx xxx pluginTaskId

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

@ -5,9 +5,7 @@
<TimeStatus :content="JSON.stringify(task.process)" :status="task.process" /> <TimeStatus :content="JSON.stringify(task.process)" :status="task.process" />
<view class="flex items-center justify-between flex-1 ml-2 task-column"> <view class="flex items-center justify-between flex-1 ml-2 task-column">
<view> <view>{{ $moment(+task.planStart).format(startTimeFormat) }}</view>
<span>{{ $moment(+task.planStart).format(startTimeFormat) }}</span>
</view>
<!-- 任务功能菜单 --> <!-- 任务功能菜单 -->
<TaskTools /> <TaskTools />

52
src/components/TimeLine/component/TimeStatus.vue

@ -1,11 +1,13 @@
<template> <template>
<view class="u-font-14"> <view class="u-font-14">
<!-- 0 未开始 -->
<view <view
class="flex items-center justify-center text-blue-400 rounded-full icon-column" class="flex items-center justify-center rounded-full icon-column"
:class="[orderStyle.color]"
v-if="status === 0" v-if="status === 0"
@tap="changeStatus($event, 0)" @tap="changeStatus($event, 0)"
> >
<u-circle-progress :percent="100" active-color="#2979ff" bgColor="rgba(255,255,255,0)" borderWidth="4" width="66"> <u-circle-progress :percent="100" active-color="#2979ff" bg-color="rgba(255,255,255,0)" border-width="4" width="66">
<view class="u-progress-content"> <view class="u-progress-content">
<view class="u-progress-dot"></view> <view class="u-progress-dot"></view>
<view class="u-progress-info"> <view class="u-progress-info">
@ -15,20 +17,23 @@
</u-circle-progress> </u-circle-progress>
</view> </view>
<!-- 1 进行中 -->
<view class="flex items-center justify-center text-black rounded-full icon-column" v-if="status === 1" @tap="changeStatus($event, 1)"> <view class="flex items-center justify-center text-black rounded-full icon-column" v-if="status === 1" @tap="changeStatus($event, 1)">
<u-circle-progress :percent="80" active-color="#2979ff" bgColor="rgba(255,255,255,0)" borderWidth="6" width="66"> <u-circle-progress :percent="80" active-color="#2979ff" bg-color="rgba(255,255,255,0)" border-width="6" width="66">
<view class="u-progress-content"> <view class="u-progress-content">
<view class="u-progress-dot"></view> <view class="u-progress-dot"></view>
<view class="u-progress-info">{{ time }}</view> <view class="u-progress-info">{{ time }}</view>
</view> </view>
</u-circle-progress> </u-circle-progress>
</view> </view>
<!-- 2 暂停中 -->
<view <view
class="flex items-center justify-center text-gray-400 rounded-full icon-column" class="flex items-center justify-center text-gray-400 rounded-full icon-column"
v-if="status === 2" v-if="status === 2"
@tap="changeStatus($event, 2)" @tap="changeStatus($event, 2)"
> >
<u-circle-progress :percent="40" active-color="#2979ff" bgColor="rgba(255,255,255,0)" borderWidth="6" width="66"> <u-circle-progress :percent="40" active-color="#2979ff" bg-color="rgba(255,255,255,0)" border-width="6" width="66">
<view class="u-progress-content"> <view class="u-progress-content">
<view class="u-progress-dot"></view> <view class="u-progress-dot"></view>
<view class="u-progress-info"> <view class="u-progress-info">
@ -37,12 +42,14 @@
</view> </view>
</u-circle-progress> </u-circle-progress>
</view> </view>
<!-- 3 已完成 -->
<view <view
class="flex items-center justify-center font-black text-red-800 rounded-full icon-column" class="flex items-center justify-center font-black text-red-800 rounded-full icon-column"
@tap="changeStatus($event, 3)" @tap="changeStatus($event, 3)"
v-if="status === 3" v-if="status === 3"
> >
<u-circle-progress :percent="80" active-color="#2979ff" bg-color="rgba(255,255,255,0)" borderWidth="6" width="66"> <u-circle-progress :percent="80" active-color="#2979ff" bg-color="rgba(255,255,255,0)" border-width="6" width="66">
<view class="u-progress-content"> <view class="u-progress-content">
<view class="u-progress-dot"></view> <view class="u-progress-dot"></view>
<view class="u-progress-info"> <view class="u-progress-info">
@ -53,18 +60,26 @@
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { mapMutations } from 'vuex'; import { mapMutations } from 'vuex';
// 0 1 2 3
//
//
//
export default { export default {
name: 'TimeStatus', name: 'TimeStatus',
props: { props: {
status: { default: 0, type: Number }, // status: { default: 0, type: Number },
content: { default: '', type: String }, content: { default: '', type: String },
}, },
data() { data() {
return { return {
status: 2,
time: 20, time: 20,
start: [{ text: '确认开始任务', color: 'blue' }], start: [{ text: '确认开始任务', color: 'blue' }],
pause: [{ text: '继续' }, { text: '重新开始任务', color: 'blue' }, { text: '结束' }], pause: [{ text: '继续' }, { text: '重新开始任务', color: 'blue' }, { text: '结束' }],
@ -72,6 +87,31 @@ export default {
again: [{ text: '重新开始任务', color: 'blue' }], again: [{ text: '重新开始任务', color: 'blue' }],
}; };
}, },
computed: {
//
orderStyle() {
let color = 'text-gray-400';
let icon = '';
switch (this.status) {
case 1: //
color = 'text-blue-400';
break;
case 2:
color = 'text-red-400';
break;
case 3:
color = 'text-green-400';
break;
default:
//
color = 'text-gray-400';
break;
}
return { color };
},
},
methods: { methods: {
...mapMutations('task', ['setClient', 'setTips', 'setStatus', 'setTipsContent']), ...mapMutations('task', ['setClient', 'setTips', 'setStatus', 'setTipsContent']),

Loading…
Cancel
Save