| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777 |
- <template>
- <div class="learn_container">
- <el-card class="header" style="padding-bottom: 0">
- <div class="tab">
- <div
- class="tab_item pointer"
- v-for="item in tabList"
- :class="tabActive == item.value ? 'tab_active' : ''"
- @click="switchTab(item.value)"
- >
- {{ item.label }}
- </div>
- </div>
- </el-card>
- <!-- 收藏夹 -->
- <div class="content">
- <collect v-if="tabActive == 0"></collect>
- <!-- 错题本 -->
- <mistake v-if="tabActive == 1"></mistake>
- <!-- 学习记录 -->
- <div class="record_content" v-show="tabActive == 2">
- <div class="record_contian">
- <div class="tit">数据统计(总)</div>
- <div style="display: flex; justify-content: space-between">
- <div class="count_item">
- <img src="" alt="" />
- <div class="count_intro">
- <p style="color: #ff974d">{{ learnInfo.videoCount }}</p>
- <p class="gary">共看完视频(节)</p>
- </div>
- </div>
- <div class="count_item">
- <img src="" alt="" />
- <div class="count_intro">
- <p style="color: #89928a">{{ learnInfo.videoMinutes }}</p>
- <p class="gary">共看完视频时长(分钟)</p>
- </div>
- </div>
- <div class="count_item">
- <img src="" alt="" />
- <div class="count_intro">
- <p style="color: #86dcf2">{{ learnInfo.questionCount }}</p>
- <p class="gary">共完成习题</p>
- </div>
- </div>
- <div class="count_item">
- <img src="" alt="" />
- <div class="count_intro">
- <p style="color: #ee625c">
- {{
- learnInfo.correctPercent == "" ? 0 : learnInfo.correctPercent
- }}
- </p>
- <p class="gary">正确率</p>
- </div>
- </div>
- </div>
- </div>
- <div class="record_contian">
- <div class="tit">数据统计(周)</div>
- <el-form
- :inline="true"
- :model="dateForm"
- :rules="dateRule"
- ref="ruleForm"
- class="demo-form-inline"
- >
- <div class="date_contain">
- <el-form-item label="日期" prop="year">
- <el-select
- v-model="dateForm.year"
- placeholder="年份"
- size="small"
- >
- <el-option
- v-for="(item, index) in dateYears"
- :key="index"
- :value="item"
- :label="item + '年'"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="" prop="month">
- <el-select
- v-model="dateForm.month"
- placeholder="月份"
- size="small"
- >
- <el-option
- v-for="(item, index) in dateMonth"
- :key="index"
- :value="item"
- :label="item + '月'"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="周" prop="week">
- <el-select
- v-model="dateForm.week"
- placeholder="第几周"
- size="small"
- >
- <el-option
- v-for="(item, index) in dateWeek"
- :key="index"
- :value="item"
- :label="'第' + item + '周'"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-button
- style="margin-left: 24px; width: 100px; height: 40px"
- type="primary"
- icon="el-icon-search"
- @click="searchData"
- ></el-button>
- </div>
- </el-form>
- <div style="display: flex; justify-content: space-around">
- <div style="width: 300px; height: 269px" id="echarts_quecount"></div>
- <div style="width: 320px; height: 269px" id="echarts_queBySub"></div>
- <div
- style="width: 300px; height: 269px"
- id="echarts_videocount"
- ></div>
- <div style="width: 320px; height: 269px" id="echarts_vidBysub"></div>
- </div>
- </div>
- <div class="record_contian">
- <div class="tit">学习记录</div>
- <div class="video_contian" v-if="videoRecord.length > 0">
- <div class="video_item" v-for="item in videoRecord" :key="item.id">
- <img :src="item.pict" alt="" />
- <p>{{ item.title }}</p>
- <p>
- {{ item.percent > 90 ? "已看完" : "观看" + item.percent + "%" }}
- </p>
- </div>
- </div>
- <div class="empty" v-else>
- <img src="@/assets/images/icon_data.png" />
- <span>没有信息</span>
- </div>
- </div>
- <div class="record_contian">
- <div class="tit">知识点诊断记录</div>
- <div>
- <el-table :data="knowRecord" style="width: 100%">
- <el-table-column prop="day" label="日期"> </el-table-column>
- <el-table-column prop="coursename" label="科目"> </el-table-column>
- <el-table-column prop="knowledgeName" label="知识点" width="500">
- </el-table-column>
- <el-table-column label="用时">
- <template slot-scope="scope">
- {{
- scope.row.seconds != "null"
- ? Math.ceil(scope.row.seconds / 60) + "分钟"
- : scope.row.seconds
- }}
- </template>
- </el-table-column>
- <el-table-column prop="wrongs" label="正确率">
- <template slot-scope="scope">
- {{ (scope.row.rights / 10) * 100 }}%
- </template>
- </el-table-column>
- <template slot="empty">
- <div class="empty">
- <img src="@/assets/images/icon_data.png" />
- <span>没有信息</span>
- </div>
- </template>
- </el-table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Collect from './components/collect'
- import Mistake from './components/mistake'
- import {
- summary,
- questionStatsByDay,
- videoStatsBySubject,
- videoStatsByDay,
- questionStatsBySubject,
- videoWatchRecords,
- knowRecords,
- queCancelCollect,
- queCollect,
- } from "@/api/webApi/webQue.js";
- const echarts = require("echarts/lib/echarts");
- require("echarts/lib/component/title");
- require("echarts/lib/component/tooltip");
- require("echarts/lib/component/grid");
- require("echarts/lib/component/legend");
- require("echarts/lib/chart/line");
- require("echarts/lib/chart/pie");
- var date = new Date();
- var myChart1;
- var myChart2;
- var myChart3;
- var myChart4;
- var flag = 1;
- export default {
- components: {Collect,Mistake},
- data() {
- return {
- tabActive: 0,
- tabList: [
- {
- label:'收藏夹',
- value:0
- },
- {
- label:'错题本',
- value:1
- },
- {
- label:'学习记录',
- value:2
- }
- ],
- dateYears: [2021, 2020],
- dateMonth: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
- dateWeek: [1, 2, 3, 4, 5],
- form: {
- type: "",
- subjectName: "",
- qtype: "",
- worngSubjectName: "",
- wrongType: "",
- },
- types: [
- { type: "question", name: "试题收藏" },
- { type: "paper", name: "试卷收藏" },
- ],
- subjects: [],
- queTypes: [],
- collectQue: [],
- collectPaper: [],
- pageSize: 10,
- pageNum: 1,
- total: 0,
- learnInfo: {},
- dateForm: {
- year: date.getFullYear(),
- month: date.getMonth() + 1,
- week: date.getDay / 7 > 0 ? date.getDay / 7 : 5,
- },
- dateRule: {
- year: [{ required: true, message: "请选择年份", trigger: "change" }],
- month: [{ required: true, message: "请选择月份", trigger: "change" }],
- week: [{ required: true, message: "请选择周数", trigger: "change" }],
- },
- knowRecord: [],
- videoRecord: [],
- // 数据统计-做题数量
- queCountOption: {
- title: {
- text: "做题数目(道数)",
- textStyle: {
- color: "#676767",
- fontWeight: "400",
- fontSize: 16,
- },
- },
- tooltip: {
- trigger: "axis",
- },
- xAxis: {
- type: "category",
- data: ["周一", "周二", "周三", "周四", "周五", "周六", "周七"],
- axisTick: {
- show: false,
- },
- },
- yAxis: {
- type: "value",
- axisTick: {
- show: false,
- },
- axisLine: { show: false },
- },
- series: [
- {
- data: [0, 0, 0, 0, 0, 0, 0],
- type: "line",
- name: "做题数",
- lineStyle: {
- color: "#47c6a2",
- width: 2,
- },
- itemStyle: {
- normal: {
- color: "#47c6a2",
- borderColor: "#47c6a2", //拐点边框颜色
- },
- },
- },
- ],
- },
- // 数据统计-视频时长
- videoCountOption: {
- title: {
- text: "看视频时长(分钟)",
- textStyle: {
- color: "#676767",
- fontWeight: "400",
- fontSize: 16,
- },
- },
- tooltip: {
- trigger: "axis",
- },
- xAxis: {
- type: "category",
- data: ["周一", "周二", "周三", "周四", "周五", "周六", "周七"],
- axisTick: {
- show: false,
- },
- },
- yAxis: {
- type: "value",
- axisTick: {
- show: false,
- },
- axisLine: { show: false },
- },
- series: [
- {
- data: [0, 0, 0, 0, 0, 0, 0],
- type: "line",
- name: "观看时长",
- lineStyle: {
- color: "#2EC7C9",
- width: 2,
- },
- itemStyle: {
- normal: {
- color: "#2EC7C9",
- borderColor: "#2EC7C9", //拐点边框颜色
- },
- },
- },
- ],
- },
- // 数据统计-做题数量 根据科目
- queSubCount: {
- title: {
- text: "学科分类数据(道数)",
- textStyle: {
- color: "#676767",
- fontWeight: "400",
- fontSize: 16,
- },
- },
- tooltip: {
- trigger: "item",
- },
- color: [
- "#5B8FF9",
- "#5AD8A6",
- "#DEEAFF",
- "#FFE18B",
- "#FEB3A2",
- "#BAEF83",
- "#DBC7FA",
- "#FFE6D2",
- "#76DDDC",
- ],
- legend: {
- orient: "vertical",
- left: "right",
- align: "left",
- icon: "circle",
- top: "20",
- },
- series: [
- {
- name: "做题数",
- type: "pie",
- radius: "70%",
- data: [
- { value: 0, name: "语文" },
- { value: 0, name: "数学" },
- { value: 0, name: "英语" },
- { value: 0, name: "物理" },
- { value: 0, name: "化学" },
- { value: 0, name: "生物" },
- { value: 0, name: "历史" },
- { value: 0, name: "地理" },
- { value: 0, name: "政治" },
- ],
- left: "-80",
- label: {
- position: "inside",
- formatter: "{c}",
- color: "#000000",
- },
- labelLine: {
- show: false,
- },
- },
- ],
- },
- // 数据统计-视频时长 根据科目
- vidSubCount: {
- title: {
- text: "学科分类数据(分钟)",
- textStyle: {
- color: "#676767",
- fontWeight: "400",
- fontSize: 16,
- },
- },
- tooltip: {
- trigger: "item",
- },
- color: [
- "#5B8FF9",
- "#5AD8A6",
- "#DEEAFF",
- "#FFE18B",
- "#FEB3A2",
- "#BAEF83",
- "#DBC7FA",
- "#FFE6D2",
- "#76DDDC",
- ],
- legend: {
- orient: "vertical",
- left: "right",
- align: "left",
- icon: "circle",
- top: "20",
- },
- series: [
- {
- name: "做题时长",
- type: "pie",
- radius: "70%",
- data: [
- { value: 0, name: "语文" },
- { value: 0, name: "数学" },
- { value: 0, name: "英语" },
- { value: 0, name: "物理" },
- { value: 0, name: "化学" },
- { value: 0, name: "生物" },
- { value: 0, name: "历史" },
- { value: 0, name: "地理" },
- { value: 0, name: "政治" },
- ],
- label: {
- position: "inside",
- formatter: "{c}",
- color: "#000000",
- },
- left: "-80",
- labelLine: {
- show: false,
- },
- },
- ],
- },
- };
- },
- created() {
- // 设置默认高亮
- this.tabActive = this.$route.query.tabActive
- ? this.$route.query.tabActive
- : 0;
- this.switchTab(this.tabActive);
- },
- methods: {
- switchTab(index) {
- this.tabActive = index;
- if (this.tabActive == 1) {
- } else if (this.tabActive == 2 && flag == 1) {
- let queCountChart = document.getElementById("echarts_quecount");
- myChart1 = echarts.init(queCountChart);
- myChart1.setOption(this.queCountOption);
- let videoCountChart = document.getElementById("echarts_videocount");
- myChart2 = echarts.init(videoCountChart);
- myChart2.setOption(this.videoCountOption);
- let queBySubChart = document.getElementById("echarts_queBySub");
- myChart3 = echarts.init(queBySubChart);
- myChart3.setOption(this.queSubCount);
- let vidBySubChart = document.getElementById("echarts_vidBysub");
- myChart4 = echarts.init(vidBySubChart);
- myChart4.setOption(this.vidSubCount);
- flag++;
- }
- if (index == 2) {
- this.getSummary();
- this.searchData();
- }
- },
- getSummary() {
- summary().then((res) => {
- this.learnInfo = res.data;
- console.log(res);
- });
- },
- // 数据统计-做题数量-按天
- getQuestionStatsByDay() {
- questionStatsByDay({
- year: this.dateForm.year,
- month: this.dateForm.month,
- week: this.dateForm.week,
- }).then((res) => {
- let arr = [];
- const kesArr = Object.keys(res.data).sort();
- for (const key of kesArr) {
- arr.push(res.data[key]);
- }
- this.queCountOption.series[0].data = arr;
- myChart1.setOption(this.queCountOption);
- });
- },
- // 数据统计-视频观看时长 - 按天
- getVideoStatsByDay() {
- videoStatsByDay({
- year: this.dateForm.year,
- month: this.dateForm.month,
- week: this.dateForm.week,
- }).then((res) => {
- let arr = [];
- const kesArr = Object.keys(res.data).sort();
- for (const key of kesArr) {
- arr.push(res.data[key]);
- }
- this.videoCountOption.series[0].data = arr;
- myChart2.setOption(this.videoCountOption);
- });
- },
- // 数据统计-视频观看时长 - 按学科
- getVideoStatsBySubject() {
- videoStatsBySubject({
- year: this.dateForm.year,
- month: this.dateForm.month,
- week: this.dateForm.week,
- }).then((res) => {
- console.log(res);
- if (Object.keys(res.data).length > 0) {
- console.log(res);
- let objArr = [];
- for (const key in res.data) {
- objArr.push({ name: key, value: res.data[key] });
- }
- console.log(objArr);
- this.vidSubCount.series[0].data = objArr;
- myChart4.setOption(this.vidSubCount);
- } else {
- this.vidSubCount.series[0].data = [
- { value: 0, name: "语文" },
- { value: 0, name: "数学" },
- { value: 0, name: "英语" },
- { value: 0, name: "物理" },
- { value: 0, name: "化学" },
- { value: 0, name: "生物" },
- { value: 0, name: "历史" },
- { value: 0, name: "地理" },
- { value: 0, name: "政治" },
- ];
- myChart4.setOption(this.vidSubCount);
- }
- });
- },
- // 数据统计-做题数量 - 按学科
- getQuestionStatsBySubject() {
- questionStatsBySubject({
- year: this.dateForm.year,
- month: this.dateForm.month,
- week: this.dateForm.week,
- }).then((res) => {
- if (Object.keys(res.data).length > 0) {
- console.log(res);
- let objArr = [];
- for (const key in res.data) {
- objArr.push({ name: key, value: res.data[key] });
- }
- console.log(objArr);
- this.queSubCount.series[0].data = objArr;
- myChart3.setOption(this.queSubCount);
- } else {
- this.queSubCount.series[0].data = [
- { value: 0, name: "语文" },
- { value: 0, name: "数学" },
- { value: 0, name: "英语" },
- { value: 0, name: "物理" },
- { value: 0, name: "化学" },
- { value: 0, name: "生物" },
- { value: 0, name: "历史" },
- { value: 0, name: "地理" },
- { value: 0, name: "政治" },
- ];
- myChart3.setOption(this.queSubCount);
- }
- });
- },
- // 视频学习记录
- getVideoRecord() {
- videoWatchRecords({
- year: this.dateForm.year,
- month: this.dateForm.month,
- week: this.dateForm.week,
- }).then((res) => {
- this.videoRecord = res.data;
- console.log(res);
- });
- },
- // 知识点诊断记录
- getKnowRecords() {
- knowRecords({
- year: this.dateForm.year,
- month: this.dateForm.month,
- week: this.dateForm.week,
- }).then((res) => {
- this.knowRecord = res.data;
- console.log(this.knowRecord);
- });
- },
- searchData() {
- console.log(this.dateForm);
- this.$refs.ruleForm.validate((valid) => {
- if (valid) {
- this.getQuestionStatsByDay();
- this.getVideoStatsByDay();
- this.getQuestionStatsBySubject();
- this.getVideoStatsBySubject();
- this.getVideoRecord();
- this.getKnowRecords();
- /* this.getVideoStatsByDay();
- this.getQuestionStatsBySubject(); */
- } else {
- console.log("error submit!!");
- return false;
- }
- });
- },
- toCollectQue(item) {
- queCollect({ questionId: item.id }).then((res) => {
- item.collect = !item.collect;
- this.msgSuccess("收藏成功");
- console.log(res);
- });
- },
- toCancelCollectQue(item) {
- queCancelCollect({ questionId: item.id }).then((res) => {
- item.collect = !item.collect;
- this.msgSuccess("取消收藏成功");
- console.log(res);
- });
- },
- },
- };
- </script>
- <style scoped>
- .empty {
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- font-size: 14px;
- color: #909399;
- }
- .learn_container {
- padding: 20px;
- background: #f7f7f7;
- min-height: 100vh;
- }
- .header {
- margin-bottom: 16px;
- }
- .content {
- background: #fff;
- padding: 20px;
- }
- .record_content .record_contian {
- border-radius: 8px;
- margin-bottom: 20px;
- background: #fff;
- padding: 32px 28px;
- }
- .record_content .record_contian .tit {
- color: #47c6a2;
- margin-bottom: 36px;
- }
- .record_content .record_contian .count_item img {
- margin-right: 16px;
- }
- .tab {
- display: flex;
- margin-bottom: 14px;
- border-bottom: 1px solid #dedede;
- }
- .delete > div:first-child > span {
- color: #f44949;
- }
- .tab .tab_item {
- flex: 1;
- cursor: pointer;
- text-align: center;
- font-size: 16px;
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- line-height: 22px;
- padding-bottom: 28px;
- position: relative;
- }
- .tab .tab_active {
- color: #47c6a2;
- }
- .tab .tab_active::after {
- content: "";
- height: 4px;
- width: 100%;
- background: #47c6a2;
- position: absolute;
- transform: translateY(50%);
- left: 0;
- bottom: 0;
- }
- .gary {
- margin-top: 8px;
- font-size: 16px;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #7a7a7a;
- line-height: 22px;
- }
- .date_contain > span {
- display: inline-block;
- border-radius: 1px;
- margin-right: 16px;
- font-size: 16px;
- }
- .video_contian {
- display: flex;
- }
- .video_contian img {
- width: 200px;
- }
- .video_contian .video_item {
- margin-right: 80px;
- }
- .video_contian .video_item > p:first-child {
- color: #4a4a4a;
- font-size: 14px;
- margin-top: 7px;
- margin-bottom: 4px;
- }
- .video_contian .video_item > p:last-child {
- font-size: 12px;
- color: #bdbdbd;
- }
- </style>
|