Browse Source

feat: 添加训练计划详情

develop
song 4 years ago
parent
commit
49f64caabe
  1. 1
      CHANGELOG.md
  2. 20
      src/components/Evaluated/EvaluatedNLCP.vue
  3. 25
      src/components/Evaluated/EvaluatedXLJH.vue
  4. 48
      src/components/Evaluated/components/EvaluatedDetail.vue
  5. 171
      src/components/Evaluated/components/ResultLevel.vue
  6. 10
      src/components/TimeLine/component/TimeBox.vue
  7. 12
      src/pagesYanyuan/ascription/ascription.vue
  8. 9
      src/store/task/mutations.js

1
CHANGELOG.md

@ -144,6 +144,7 @@
- | 切换日历时查询小红点 | [7091789](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7091789)
- | 初始展示角色修改 | [2ac4053](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/2ac4053)
- | 卸载stylus | [610b465](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/610b465)
- | 完善雷达图 | [5f52d35](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/5f52d35)
- | 定期任务key值修改 | [c6688db](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/c6688db)
- | 定期任务接口 | [aa4981c](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/aa4981c)
- | 定期任务插件 | [92b3254](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/92b3254)

20
src/components/Evaluated/EvaluatedNLCP.vue

@ -2,9 +2,10 @@
<view class="charts-box">
<view class="flex justify-between">
<text>{{ task.name }}</text>
<u-icon name="arrow-down" color="#909399"></u-icon>
<u-icon name="arrow-up" color="#909399" v-if="task.data.showDetail" @click="changeShowState"></u-icon>
<u-icon name="arrow-down" color="#909399" v-else @click="changeShowState"></u-icon>
</view>
<view class="bg-white" v-if="obj && obj.id">
<view class="bg-white" v-if="obj && obj.id && task.data.showDetail">
<UCharts
:canvas-id="obj.id"
:chartType="obj.chartType"
@ -32,8 +33,9 @@
</template>
<script>
import { mapMutations } from 'vuex';
export default {
props: { task: { type: Object, default: null } },
props: { task: { type: Object, default: null }, taskIndex: { type: Number, default: 0 }, itemIndex: { type: Number, default: 0 } },
data() {
return {
cWidth: '',
@ -58,6 +60,8 @@ export default {
},
methods: {
...mapMutations('task', ['setShowDetail']),
//
getData() {
const { attentionNum, countNum, directionNum, expressNum, logicNum, memoryNum, viewNum } = this.task.data.mentalTest;
@ -81,6 +85,16 @@ export default {
max: 1,
};
},
//
changeShowState() {
const { taskIndex, itemIndex } = this;
const options = {
taskIndex,
itemIndex,
};
this.setShowDetail(options);
},
},
};
</script>

25
src/components/Evaluated/EvaluatedXLJH.vue

@ -32,17 +32,38 @@
轻松完成
</view>
</view>
<u-icon name="arrow-down" color="#909399"></u-icon>
<u-icon name="arrow-up" color="#909399" v-if="task.data.showDetail" @click="changeShowState"></u-icon>
<u-icon name="arrow-down" color="#909399" v-else @click="changeShowState"></u-icon>
</view>
<!-- 详情 -->
<EvaluatedDetail :task="task.data.train" v-if="task.data.showDetail" />
</view>
</template>
<script>
import { mapMutations } from 'vuex';
import EvaluatedDetail from './components/EvaluatedDetail';
export default {
props: { task: { type: Object, default: null } },
components: { EvaluatedDetail },
props: { task: { type: Object, default: null }, taskIndex: { type: Number, default: 0 }, itemIndex: { type: Number, default: 0 } },
data() {
return { count: 3 };
},
methods: {
...mapMutations('task', ['setShowDetail']),
//
changeShowState() {
const { taskIndex, itemIndex } = this;
const options = {
taskIndex,
itemIndex,
};
this.setShowDetail(options);
},
},
};
</script>

48
src/components/Evaluated/components/EvaluatedDetail.vue

@ -0,0 +1,48 @@
<template>
<view class="my-2">
<view v-if="train.contentDetails.length" class="text-xs">
<!-- 训练目标 训练元素 训练原理 训练步骤 -->
<view v-for="(purpose, purposeIndex) in train.contentDetails" :key="purposeIndex">
<view class="font-bold">{{
purpose.type === 0
? '训练目标'
: purpose.type === 1
? '训练元素'
: purpose.type === 2
? '训练原理'
: purpose.type === 3
? '训练步骤'
: ''
}}</view>
<view v-for="detail in purpose.details" :key="detail.id">
<view v-if="detail.content" class="text-gray-200">
{{ detail.content }}
</view>
<view v-if="detail.supplementaries" class="text-gray-200">
<view v-for="(img, imgIndex) in detail.supplementaries" :key="imgIndex">
<img :src="img.src" class="w-full" />
</view>
</view>
</view>
</view>
</view>
<!-- 训练结果 -->
<view v-if="purpose.trains.length">
<view v-for="(trainResult, resultIndex) in purpose.trains" :key="trainResult.trainRecordId">
<ResultLevel :trains="trainResult" :resultIndex="resultIndex" v-if="trainResult.resultType === 0" />
<view v-if="trainResult.resultType === 1">过程记录</view>
</view>
</view>
</view>
</template>
<script>
import ResultLevel from './ResultLevel';
export default {
components: { ResultLevel },
props: { train: { type: Object, default: null } },
};
</script>
<style></style>

171
src/components/Evaluated/components/ResultLevel.vue

@ -0,0 +1,171 @@
<template>
<view>
<view class="flex flex-nowrap mt-10 rounded-3xl relative">
<view
class="bubble"
:style="{
left: level.left || 0,
color: level.color || '#EDEDED',
backgroundImage: `url(${level.bgPic || 'https://www.tall.wiki/staticrec/yanyuan/bubble-gray.png'})`,
backgroundSize: '100% 100%',
backgroundRepeat: 'no-repeat',
}"
>
{{ trains.finishResult === 1 ? '非常困难' : trains.finishResult === 2 ? '略有困难' : '轻松完成' }}
</view>
<view v-for="i in levels" :key="i.value" class="flex-1" :class="i.value === 3 ? '' : 'box'">
<view class="w-full h-2" :class="i.checked ? level.boxBg : 'bg-gray-100'"></view>
</view>
</view>
<!-- 时间 -->
<view class="text-sm text-gray-400 flex flex-nowrap items-center">
<view class="num mr-2">{{ resultIndex + 1 }}</view>
1分钟50秒
</view>
</view>
</template>
<script>
export default {
props: { trains: { type: Object, default: null }, resultIndex: { type: Number, default: 0 } },
data() {
return {
// trains: {
// finishResult: 3,
// finishTime: 15,
// },
levels: [
{
value: 0.5,
checked: false,
},
{
value: 1,
checked: false,
},
{
value: 1.5,
checked: false,
},
{
value: 2,
checked: false,
},
{
value: 2.5,
checked: false,
},
{
value: 3,
checked: false,
},
],
width: 0,
level: {},
};
},
computed: {},
mounted() {
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query
.selectAll('.box')
.boundingClientRect(data => {
this.width = data[0].width;
this.setLevel();
})
.exec();
});
},
methods: {
setLevel() {
if (!this.trains.finishResult) return;
if (this.trains.finishResult <= 0.5) {
this.setParam(1, 0);
} else if (this.trains.finishResult <= 1) {
this.setParam(1, 1);
} else if (this.trains.finishResult <= 1.5) {
this.setParam(2, 2);
} else if (this.trains.finishResult <= 2) {
this.setParam(2, 3);
} else if (this.trains.finishResult <= 2.5) {
this.setParam(3, 4);
} else {
this.setParam(3, 5);
}
this.setBox();
},
setParam(type, value) {
const { level, width } = this;
if (type == 1) {
level.color = '#EB5A0D';
level.value = '非常困难';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-red.png';
level.boxBg = 'bg-red-500';
}
if (type == 2) {
level.color = '#F4C130';
level.value = '略有困难';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-yellow.png';
level.boxBg = 'bg-yellow-500';
}
if (type == 3) {
level.color = '#1890FF';
level.value = '轻松完成';
level.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-blue.png';
level.boxBg = 'bg-blue-500';
}
level.left = value * width + 'px';
},
setBox() {
let index = 0;
this.levels.forEach((line, i) => {
if (this.trains.finishResult > i / 2) {
index = i + 1;
}
if (this.trains.finishResult === i / 2) {
index = i;
}
if (i < index) {
line.checked = true;
} else {
line.checked = false;
}
});
},
},
};
</script>
<style lang="scss" scoped>
.box {
margin-right: 2px;
}
.bubble {
position: absolute;
top: -40px;
width: 70px;
height: 30px;
line-height: 26px;
text-align: center;
font-size: 14px;
}
.num {
width: 40rpx;
height: 40rpx;
text-align: center;
line-height: 40rpx;
border-radius: 50%;
border: 1px solid $uni-bg-color-blue;
color: $uni-bg-color-blue;
}
</style>

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

@ -2,7 +2,7 @@
<view class="column">
<!-- v-if="tasks && tasks.length" -->
<view>
<view :key="task.id" v-for="task in tasks" :id="`a${task.id}`">
<view :key="task.id" v-for="(task, taskIndex) in tasks" :id="`a${task.id}`">
<!-- 外层 -->
<view v-if="task.id">
<view class="flex">
@ -62,7 +62,7 @@
<view v-else>{{ $moment(+task[0].planStart).format('D日') }}</view>
</view>
</view>
<view v-for="item in task" :key="item.id">
<view v-for="(item, itemIndex) in task" :key="item.id">
<view class="border-l-2 border-gray-300 plugin">
<view class="h-3" v-if="item.process === 4"></view>
<view class="ml-3 overflow-hidden shadow-lg task-box">
@ -95,8 +95,8 @@
<view class="p-0 u-col-between">
<NotEvaluated :task="item" v-if="item.data.mentalTest.finishStatus === 0" />
<view v-else>
<EvaluatedNLCP :task="item" v-if="item.data.type === 0" />
<EvaluatedXLJH :task="item" v-if="item.data.type === 1" />
<EvaluatedNLCP :task="item" :taskIndex="taskIndex" :itemIndex="itemIndex" v-if="item.data.type === 0" />
<EvaluatedXLJH :task="item" :taskIndex="taskIndex" :itemIndex="itemIndex" v-if="item.data.type === 1" />
</view>
</view>
</view>
@ -131,6 +131,8 @@ export default {
};
},
watch: {},
computed: {
...mapState('role', ['roleId']),
...mapState('task', ['timeUnit', 'tasks', 'taskLoading', 'showSkeleton', 'isEvaluated']),

12
src/pagesYanyuan/ascription/ascription.vue

@ -146,15 +146,15 @@ export default {
position.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-red.png';
position.boxBg = 'bg-red-500';
} else if (value < 5) {
position.color = '#1890FF';
position.value = '略有困难';
position.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-blue.png';
position.boxBg = 'bg-blue-500';
} else {
position.color = '#F4C130';
position.value = '轻松完成';
position.value = '略有困难';
position.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-yellow.png';
position.boxBg = 'bg-yellow-500';
} else {
position.color = '#1890FF';
position.value = '轻松完成';
position.bgPic = 'https://www.tall.wiki/staticrec/yanyuan/bubble-blue.png';
position.boxBg = 'bg-blue-500';
}
this.lists[index].levels.forEach((line, i) => {

9
src/store/task/mutations.js

@ -210,6 +210,15 @@ const mutations = {
setIsEvaluated(state, show) {
state.isEvaluated = show;
},
/**
* 设置任务展开状态
* @param {Object} state
* @param {Boolean} data
*/
setShowDetail(state, data) {
state.tasks[data.taskIndex][data.itemIndex].data.showDetail = !state.tasks[data.taskIndex][data.itemIndex].data.showDetail;
},
};
export default mutations;

Loading…
Cancel
Save