|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="i_body" >
|
|
|
+ <div class="i_body">
|
|
|
<div class="i_body_title">个人总览</div>
|
|
|
<div class="i_body_panel">
|
|
|
<div class="i_icon"><span></span></div>
|
|
@@ -68,14 +68,14 @@
|
|
|
export default {
|
|
|
props: {
|
|
|
userid: {
|
|
|
- type: String,
|
|
|
+ type: String
|
|
|
},
|
|
|
oid: {
|
|
|
- type: String,
|
|
|
+ type: String
|
|
|
},
|
|
|
org: {
|
|
|
- type: String,
|
|
|
- },
|
|
|
+ type: String
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -87,7 +87,7 @@ export default {
|
|
|
// count3: 0,
|
|
|
// count4: 0,
|
|
|
// count5: 0,
|
|
|
- typeList: [],
|
|
|
+ typeList: []
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -95,11 +95,12 @@ export default {
|
|
|
let params = {
|
|
|
uid: this.userid,
|
|
|
oid: this.oid,
|
|
|
- org: this.org,
|
|
|
+ org: this.org
|
|
|
};
|
|
|
this.ajax
|
|
|
.get(this.$store.state.api + "selectSRecordY", params)
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
+ console.log("总学习记录数量", res);
|
|
|
this.count = res.data[0].length; //总学习记录数量
|
|
|
var data = res.data[0]; //总学习记录
|
|
|
var ftype = res.data[1]; //公共父级分类
|
|
@@ -153,30 +154,73 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // 是按照,上面总条数来循环下面的数据的条数的,只用父级循环,不能用子集,
|
|
|
+ //不然子集的循环数据会重复,导致数据重复
|
|
|
+ // console.log('allfType',allfType);
|
|
|
+ // console.log('stype',stype);
|
|
|
+
|
|
|
+ // 将每个大分类下的小分类数据提取出来,在大分类下创建一个child来存储
|
|
|
+ allfType.forEach(e => {
|
|
|
+ e.child = [];
|
|
|
+ stype.forEach(i => {
|
|
|
+ if (e.id == i.pid) {
|
|
|
+ e.child.push(i.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // console.log("allfType1111111111", allfType);
|
|
|
+
|
|
|
+ // 将数据所选的小分类变成数组
|
|
|
+ data.forEach(e => {
|
|
|
+ e.type = e.type.split(",");
|
|
|
+ });
|
|
|
+ // console.log("data", data);
|
|
|
+
|
|
|
var ftypeList1 = [];
|
|
|
- for (var i = 0; i < allfType.length; i++) {
|
|
|
+
|
|
|
+ allfType.forEach(e => {
|
|
|
var count = 0;
|
|
|
- for (var j = 0; j < typeList1.length; j++) {
|
|
|
- if (allfType[i].id == typeList1[j].pid) {
|
|
|
+ data.forEach(d => {
|
|
|
+ let arr = [];
|
|
|
+ arr = e.child.filter(value => d.type.includes(value));
|
|
|
+ if (arr.length > 0) {
|
|
|
count++;
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
ftypeList1.push({
|
|
|
- id: allfType[i].id,
|
|
|
- name: allfType[i].name,
|
|
|
- count: count,
|
|
|
+ id: e.id,
|
|
|
+ name: e.name,
|
|
|
+ count: count
|
|
|
});
|
|
|
- }
|
|
|
+ });
|
|
|
+ // console.log("ftypeList1", ftypeList1);
|
|
|
+
|
|
|
+ // var ftypeList1 = [];
|
|
|
+ // for (var i = 0; i < allfType.length; i++) {
|
|
|
+ // var count = 0;
|
|
|
+ // for (var j = 0; j < typeList1.length; j++) {
|
|
|
+ // if (allfType[i].id == typeList1[j].pid) {
|
|
|
+ // count++;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // ftypeList1.push({
|
|
|
+ // id: allfType[i].id,
|
|
|
+ // name: allfType[i].name,
|
|
|
+ // count: count,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
this.typeList = ftypeList1;
|
|
|
+ // console.log('this.typeList',this.typeList);
|
|
|
})
|
|
|
- .catch((err) => {
|
|
|
+ .catch(err => {
|
|
|
console.error(err);
|
|
|
});
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getData();
|
|
|
- },
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -300,4 +344,4 @@ export default {
|
|
|
font-size: 12px;
|
|
|
margin-top: 0px;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|