|
@@ -14,11 +14,13 @@ import {
|
|
nextTick,
|
|
nextTick,
|
|
} from 'vue'
|
|
} from 'vue'
|
|
import * as echarts from 'echarts'
|
|
import * as echarts from 'echarts'
|
|
|
|
+import { useDictionaryStore } from '@/stores'
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
data: <any>{},
|
|
data: <any>{},
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+const DictionaryStore = useDictionaryStore()
|
|
const { proxy } = getCurrentInstance()
|
|
const { proxy } = getCurrentInstance()
|
|
const state = reactive({
|
|
const state = reactive({
|
|
resizeObserver: <any>null,
|
|
resizeObserver: <any>null,
|
|
@@ -26,88 +28,87 @@ const state = reactive({
|
|
})
|
|
})
|
|
const ref_chart = ref()
|
|
const ref_chart = ref()
|
|
const ref_main = ref()
|
|
const ref_main = ref()
|
|
|
|
+const getLevelNum = (name) => {
|
|
|
|
+ return DictionaryStore.difficultyLevelList.filter((v) => v.label == name)[0]
|
|
|
|
+ ?.value
|
|
|
|
+}
|
|
const initChart = () => {
|
|
const initChart = () => {
|
|
echarts.dispose(ref_chart.value)
|
|
echarts.dispose(ref_chart.value)
|
|
const chart = echarts.init(ref_chart.value)
|
|
const chart = echarts.init(ref_chart.value)
|
|
- const option = {
|
|
|
|
- title: {
|
|
|
|
- text: '知识点掌握情况',
|
|
|
|
- left: 'center',
|
|
|
|
- textStyle: {
|
|
|
|
- fontSize: 14,
|
|
|
|
|
|
+ if (props.data.length > 0) {
|
|
|
|
+ const option = {
|
|
|
|
+ title: {
|
|
|
|
+ text: '知识点掌握情况',
|
|
|
|
+ left: 'center',
|
|
|
|
+ textStyle: {
|
|
|
|
+ fontSize: 14,
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- },
|
|
|
|
- tooltip: {
|
|
|
|
- trigger: 'item',
|
|
|
|
- valueFormatter: (p) => {
|
|
|
|
- const map = new Map([
|
|
|
|
- [1, 'A'],
|
|
|
|
- [2, 'S'],
|
|
|
|
- [3, 'T'],
|
|
|
|
- ])
|
|
|
|
- return map.get(p)
|
|
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: 'item',
|
|
|
|
+ valueFormatter: (p) => {
|
|
|
|
+ const map = new Map([
|
|
|
|
+ [1, 'A'],
|
|
|
|
+ [2, 'S'],
|
|
|
|
+ [3, 'T'],
|
|
|
|
+ ])
|
|
|
|
+ return map.get(p)
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- },
|
|
|
|
- legend: {
|
|
|
|
- bottom: 0,
|
|
|
|
- left: 'center',
|
|
|
|
- },
|
|
|
|
- radar: {
|
|
|
|
- radius: '70%',
|
|
|
|
- splitNumber: 3,
|
|
|
|
- indicator: [
|
|
|
|
- { name: '基础知识', max: 3 },
|
|
|
|
- { name: '文言文', max: 3 },
|
|
|
|
- { name: '现代文阅读', max: 3 },
|
|
|
|
- { name: '诗歌鉴赏', max: 3 },
|
|
|
|
- { name: '作文', max: 3 },
|
|
|
|
- { name: '语言运用', max: 3 },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- series: [
|
|
|
|
- {
|
|
|
|
- name: '掌握程度',
|
|
|
|
- type: 'radar',
|
|
|
|
- data: [
|
|
|
|
- {
|
|
|
|
- value: [1, 2, 3, 2, 1, 2],
|
|
|
|
- name: '当前水平',
|
|
|
|
- lineStyle: {
|
|
|
|
- width: 2,
|
|
|
|
- color: 'rgba(211, 73, 71, 1)',
|
|
|
|
- },
|
|
|
|
- itemStyle: {
|
|
|
|
- color: 'rgba(211, 73, 71, 1)',
|
|
|
|
- },
|
|
|
|
- areaStyle: {
|
|
|
|
- color: 'rgba(211, 73, 71, 0.2)',
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- value: [3, 2, 1, 2, 3, 1],
|
|
|
|
- name: '班级平均',
|
|
|
|
- lineStyle: {
|
|
|
|
- width: 2,
|
|
|
|
- color: 'rgba(2, 50, 112, 1)',
|
|
|
|
- },
|
|
|
|
- itemStyle: {
|
|
|
|
- color: 'rgba(2, 50, 112, 1)',
|
|
|
|
|
|
+ legend: {
|
|
|
|
+ bottom: 0,
|
|
|
|
+ left: 'center',
|
|
|
|
+ },
|
|
|
|
+ radar: {
|
|
|
|
+ radius: '70%',
|
|
|
|
+ splitNumber: 3,
|
|
|
|
+ indicator: props.data.map((v) => ({ name: v.typeName, max: 3 })),
|
|
|
|
+ },
|
|
|
|
+ series: [
|
|
|
|
+ {
|
|
|
|
+ name: '掌握程度',
|
|
|
|
+ type: 'radar',
|
|
|
|
+ data: [
|
|
|
|
+ {
|
|
|
|
+ value: props.data.map((v) => getLevelNum(v.level)),
|
|
|
|
+ name: '当前水平',
|
|
|
|
+ lineStyle: {
|
|
|
|
+ width: 2,
|
|
|
|
+ color: 'rgba(211, 73, 71, 1)',
|
|
|
|
+ },
|
|
|
|
+ itemStyle: {
|
|
|
|
+ color: 'rgba(211, 73, 71, 1)',
|
|
|
|
+ },
|
|
|
|
+ areaStyle: {
|
|
|
|
+ color: 'rgba(211, 73, 71, 0.2)',
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- areaStyle: {
|
|
|
|
- color: 'rgba(2, 50, 112, 0.2)',
|
|
|
|
|
|
+ {
|
|
|
|
+ value: props.data.map((v) => getLevelNum(v.avgLevel)),
|
|
|
|
+ name: '班级平均',
|
|
|
|
+ lineStyle: {
|
|
|
|
+ width: 2,
|
|
|
|
+ color: 'rgba(2, 50, 112, 1)',
|
|
|
|
+ },
|
|
|
|
+ itemStyle: {
|
|
|
|
+ color: 'rgba(2, 50, 112, 1)',
|
|
|
|
+ },
|
|
|
|
+ areaStyle: {
|
|
|
|
+ color: 'rgba(2, 50, 112, 0.2)',
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- }
|
|
|
|
- chart.setOption(option)
|
|
|
|
- state.resizeObserver = new ResizeObserver((entries) => {
|
|
|
|
- for (const entry of entries) {
|
|
|
|
- chart && chart.resize()
|
|
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
}
|
|
}
|
|
- })
|
|
|
|
- state.resizeObserver.observe(ref_main.value)
|
|
|
|
|
|
+ chart.setOption(option)
|
|
|
|
+ state.resizeObserver = new ResizeObserver((entries) => {
|
|
|
|
+ for (const entry of entries) {
|
|
|
|
+ chart && chart.resize()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ state.resizeObserver.observe(ref_main.value)
|
|
|
|
+ }
|
|
return chart
|
|
return chart
|
|
}
|
|
}
|
|
watch(
|
|
watch(
|