<template>
    <div class="personalProfile">
        <!-- 我的历次成绩子组件 -->
        <MyGradeHistory :grade-history-data="gradeHistoryData" v-loading="historyloading"
            @selection-change="handleSelectionChange" @page-change="handlePageChange" 
            @export-knowledge-paps="exportKnowledgePaps"/>

        <!-- 历次考试知识点追踪 -->
        <KnowledgeTrack :exam-range="knowledgeMapData.examRange" :knowledge-stats="knowledgeStats"
            v-loading="knowledgeloading" />

        <!-- 零分知识点、高频错题知识点 -->
        <zeroScoreKnowledge ref="knowledgeGraphRef" @knowledge-item-click="handleKnowledgeItemClick"
            :active-view="activeView" @view-change="activeView = $event" :subject-name="portraitData.subjectName"
            :subject-score-rate="subjectScoreRate" :table-data="treeData" :fatal-vulnerability="fatalVulnerability"
            :high-vulnerability="highVulnerability" :all-knowledge-list="allKnowledgeList"
            @activeTabChange="handleActiveTabChange" @legend-change="handleLegendChange" v-loading="zeroloading" />

        <!-- 历次变化 -->
        <HistoricalChangeChart ref="historicalChangeChartRef" :personalList="historicalChangeData.personalList"
            :classList="historicalChangeData.classList" :gradeList="historicalChangeData.gradeList"
            :examName="historicalChangeData.examName" :knowledgeName="knowledgeName"
            v-loading="historicalChangeLoading" />
        <!-- 薄弱知识点精准提升 -->
        <knowledgePaps :knowledgeName="knowledgeName" v-loading="knowledgePapsLoading" :knowledgData="knowledgData"
             />
        <!-- 下载试题 -->
        <Download ref="downloadRef" :visible.sync="visible" :examId="portraitData.examId"
            :subjectCode="portraitData.subjectCode" :knowledgeId="knowledgeId" />

    </div>
</template>
<script>
import MyGradeHistory from './MyGradeHistory.vue'; //我的历次成绩子组件 
import KnowledgeTrack from './KnowledgeTrack.vue'; //历次考试知识点追踪子组件
import zeroScoreKnowledge from './zeroScoreKnowledge.vue'; //零分知识点、高频错题知识点子组件
import HistoricalChangeChart from './HistoricalChangeChart.vue'; //历次变化子组件
import knowledgePaps from './knowledgePaps.vue'; //薄弱知识点精准提升子组件
import Download from './Download.vue'; //下载组件

export default {
    name: "PersonalProfile",
    components: {
        MyGradeHistory,
        KnowledgeTrack,
        zeroScoreKnowledge,
        HistoricalChangeChart,
        knowledgePaps,
        Download
    },
    computed: {
        portraitData() {
            return this.$store.state.report.filterObject;
        },
        // 动态生成知识统计文本
        knowledgeStats() {
            const stats = [];
            const prefix = ''; // 定义prefix变量

            // 当有知识点数据时，生成统计文本
            if (this.knowledgeMapData.konwLenght > 0 || this.knowledgeMapData.knowledgeList) {
                // 获取得分率变化的文本部分
                let changeText = '';
                const hasRaise = this.knowledgeMapData.raiseKnowledgeList; // 提升部分
                const hasDrop = this.knowledgeMapData.dropKnowledgeList;   // 下降部分
                const hasKnowledgeList = this.knowledgeMapData.knowledgeList; // 知识点列表
                const knowledgeNum = this.knowledgeMapData.konwLenght; // 知识点数量
                // 基础文本：包含的知识点数量
                if (knowledgeNum > 0) {
                    changeText += `共包含<span style='color:#2E64FA'>${knowledgeNum}</span>个知识点`;
                }

                // 添加知识点列表（可选）
                if (hasKnowledgeList && hasKnowledgeList.length > 0) {
                    changeText += `，共有<span style="color:#2E64FA">${this.knowledgeMapData.repeatKnowledgeNum}</span>个知识点重复出现`;
                }

                // 当repeatKnowledgeNum大于0时，添加得分率变化信息
                if (this.knowledgeMapData.repeatKnowledgeNum > 0) {
                    // 只有当raiseKnowledgeList不为空时，添加得分率提升的部分
                    if (hasRaise) {
                        changeText += `，其中<span style="color:#333333;font-weight:600;">${hasRaise}</span>${prefix}得分率<span style="color:#3BA272;font-weight:600;">提升</span>`;
                    }
                    // 当下降部分不为空时，添加得分率下降的部分
                    if (hasDrop) {
                        // 当提升部分不为空时，添加逗号
                        if (hasRaise) {
                            changeText += `，`;
                        } else {
                            changeText += `，其中`;
                        }
                        changeText += `<span style="color:#333333;font-weight:600;">${hasDrop}</span>${prefix}得分率<span style="color:#F56C6C;font-weight:600;">下降</span>，希望针对下降的知识点进行总结和反思。`;
                    } else if (!hasRaise) {
                        // 如果没有提升和下降，添加完整句号
                        changeText += `。`;
                    } else {
                        // 如果只有提升，添加句号
                        changeText += `。`;
                    }
                } else if(this.knowledgeMapData.repeatKnowledgeNum === 0){
                    // 如果repeatKnowledgeNum为0，添加完整句号
                    changeText += ``;
                }else{
                    changeText += `。`;
                }

                // 确保始终返回数组
                if (changeText) {
                    stats.push(changeText);
                }
            } else if (this.knowledgeMapData.knowledgeList) {
                // 如果只有考试范围数据，添加说明文本
                stats.push(`本次考试涵盖<span style="color:#333333;font-weight:600;">${this.knowledgeMapData.knowledgeList}</span>，暂无详细知识点追踪数据。`);
            }

            return stats;
        },

    },
    data() {
        return {
            // 历次成绩数据
            gradeHistoryData: [],
            // 历次考试知识点追踪数据
            knowledgeMapData: {
                examRange: [], //考试名称
                konwLenght: 0, // 包含知识点数
                knowledgeList: [],// 包含知识点列表 
                repeatKnowledgeNum: 0, // 重复知识点数
                raiseKnowledgeList: [], //提升知识点
                dropKnowledgeList: [],//下降知识点 
            },
            // 零点知识点数据
            activeView: 'graph', // 默认图形视图
            // 按图形查看
            subjectScoreRate: 0, // 科目得分率
            // 知识点树状图数据
            treeData: [],
            // 零分知识点数据
            fatalVulnerability: [],
            // 高频错题知识点数据
            highVulnerability: [],
            // 所有知识点数据
            allKnowledgeList: [],
            // 知识点名称
            knowledgeName: '',
            knowledgeId: '',
            // 历次变化图表数据
            historicalChangeData: {
                personalList: [], //个人得分率
                classList: [], //班级得分率
                gradeList: [],//年级得分率
                examName: [] // 考试名称
            },
            // 薄弱知识点数据
            knowledgData: [],
            // 我的历次成绩-加载状态
            historyloading: false,
            // 历次考试知识点追踪-加载状态
            knowledgeloading: false,
            // 零分知识点、高频错题知识点-加载状态
            zeroloading: false,
            // 历次变化图表-加载状态
            historicalChangeLoading: false,
            // 薄弱知识点精准提升-加载状态
            knowledgePapsLoading: false,
            // 下载组件显示状态
            visible: false,
        };
    },
    watch: {
        // 监听knowledgeId变化
        portraitData(newVal, oldVal) {
            if (newVal !== oldVal) {
                // 点击知识点后，更新历次变化
                this.MyGradeHistoryData();
            }
        }
    },
    created() {
        // 我的历次成绩-并且获取历次考试ids examIds用于调用其余接口
        this.MyGradeHistoryData();
    },
    methods: {
        // 我的历次成绩---年级画像
        MyGradeHistoryData(currentPage = 1, pageSize = 10) {
            // 加载状态-清空数据
            this.historyloading = true;
            // 历次考试知识点追踪-加载状态
             this.knowledgeloading = true;
            // 零分知识点、高频错题知识点-加载状态
             this.zeroloading = true;
             // 薄弱知识点精准提升-加载状态
             this.knowledgePapsLoading = true;
            // 历次变化图表-加载状态
            this.historicalChangeLoading = true;
            this.gradeHistoryData = { records: [], total: 0 };
            let examParams = {
                examId: this.portraitData.examId,
                subjectCode: this.portraitData.subjectCode,
                page: currentPage,
                size: pageSize,
            };
            this.$api.personalProfile.examScoreList(examParams).then(res => {
                if (res.code === 200) {
                    let data = res.data || {};
                    if (data) {
                        // 确保total是数字类型
                        if (data.total !== undefined) {
                            data.total = Number(data.total);
                        }
                        this.gradeHistoryData = data;
                        let examIds = (data.records[0].data || []).map(item => item.examId || '');
                        this.portraitData.examIds = examIds;
                        // 加载状态
                        this.historyloading = false;

                        // 零分知识点、高频错题知识点
                        this.vulerabData();
                        // 历次考试知识点追踪
                        this.previousExamsData();
                    } else {
                        // 加载状态
                        // 历次考试知识点追踪-加载状态
                        this.knowledgeloading = false;
                        // 零分知识点、高频错题知识点-加载状态
                        this.zeroloading = false;
                        // 薄弱知识点精准提升-加载状态
                        this.knowledgePapsLoading = false;
                        // 历次变化图表-加载状态
                        this.historicalChangeLoading = false;
                        this.historyloading = false;
                        this.gradeHistoryData = { records: [], total: 0 };
                    }
                } else {
                    // 加载状态
                    this.historyloading = false;
                    // 历次考试知识点追踪-加载状态
                    this.knowledgeloading = false;
                    // 零分知识点、高频错题知识点-加载状态
                    this.zeroloading = false;
                    // 薄弱知识点精准提升-加载状态
                    this.knowledgePapsLoading = false;
                    // 历次变化图表-加载状态
                    this.historicalChangeLoading = false;
                    this.gradeHistoryData = { records: [], total: 0 };
                }
            })
        },
        // 处理选择变化
        handleSelectionChange(selectedExamIds) {
            this.portraitData.examIds = selectedExamIds;
            // 历次考试知识点追踪
            this.previousExamsData();
            // 零分知识点、高频错题知识点（会自动调用 KnowledgeTrackData 和 pushQuestionData）
            this.vulerabData();
        },
        // 处理分页变化
        handlePageChange(pageInfo) {
            const { currentPage, pageSize } = pageInfo;
            // 重新调用接口获取对应页码的数据
            this.MyGradeHistoryData(currentPage, pageSize);
        },
        //历次考试知识点追踪
        previousExamsData() {
            // 加载状态-清空数据
            this.knowledgeloading = true;
            this.knowledgeMapData = {
                examRange: [], //考试名称
                konwLenght: 0, // 包含知识点数
                knowledgeList: [],// 包含知识点列表 
                repeatKnowledgeNum: 0, // 重复知识点数
                raiseKnowledgeList: [], //提升知识点
                dropKnowledgeList: [],//下降知识点 
            };
            let examParams = {
                examId: this.portraitData.examId, //当前考试id
                subjectCode: this.portraitData.subjectCode, //学科code
                examIds: this.portraitData.examIds, //历次考试ids
            };
            this.$api.personalProfile.examKnowledgePointTrack(examParams).then(res => {
                if (res.code === 200) {
                    let data = res.data;
                    if (data) {
                        this.knowledgeloading = false;
                        // 考试名称列表
                        if (data.examNameList) {
                            this.knowledgeMapData.examRange =data.examNameList ? data.examNameList : [];
                        }
                        // 知识点列表
                        if (data.knowledgeList) {
                            this.knowledgeMapData.konwLenght = data.knowledgeList.length || 0; //知识点列表长度
                            this.knowledgeMapData.knowledgeList = data.knowledgeList.join('、') || '';
                        }
                        this.knowledgeMapData.repeatKnowledgeNum = data.repeatKnowledgeNum || 0; //重复知识点数
                        // 提升知识点
                        if (data.raiseKnowledgeList) {
                            this.knowledgeMapData.raiseKnowledgeList = data.raiseKnowledgeList.join('、') || '';
                        }
                        // 下降知识点
                        if (data.dropKnowledgeList) {
                            this.knowledgeMapData.dropKnowledgeList = data.dropKnowledgeList.join('、') || '';
                        }
                    } else {
                        // 加载状态
                        this.knowledgeloading = false;
                        this.knowledgeMapData = {
                            examRange: [], //考试名称
                            konwLenght: 0, // 包含知识点数
                            knowledgeList: [],// 包含知识点列表 
                            repeatKnowledgeNum: 0, // 重复知识点数
                            raiseKnowledgeList: [], //提升知识点
                            dropKnowledgeList: [],//下降知识点 
                        };
                    }
                } else {
                    // 加载状态
                    this.knowledgeloading = false;
                    this.knowledgeMapData = {
                        examRange: [], //考试名称
                        konwLenght: 0, // 包含知识点数
                        knowledgeList: [],// 包含知识点列表 
                        repeatKnowledgeNum: 0, // 重复知识点数
                        raiseKnowledgeList: [], //提升知识点
                        dropKnowledgeList: [],//下降知识点 
                    };
                }
            })
        },

        // 零分知识点、高频错题知识点----年级
        vulerabData() {
            // 加载状态-清空数据
            this.zeroloading = true;
            this.treeData = [];
            this.subjectScoreRate = 0; //科目得分率
            this.fatalVulnerability = []; // 零分知识点数据
            this.highVulnerability = []; // 高频错题知识点数据
            this.allKnowledgeList = []; // 所有知识点数据
            let examParams = {
                examId: this.portraitData.examId, //当前考试id
                examIds: this.portraitData.examIds, //历次考试ids
                subjectCode: this.portraitData.subjectCode, //学科code
                knowledgeId: this.portraitData.knowledgeId, //	知识点id(针对历次和试题查询)
            };
            this.$api.personalProfile.studentKnowledgeGraph(examParams).then(res => {
                if (res.code === 200) {
                    let data = res.data;
                    if (data) {
                        // 加载状态-清空数据
                        this.zeroloading = false;

                        // 将字符串转换为数字类型
                        this.subjectScoreRate = parseFloat(data.subjectScoreRate) || 0; //科目得分率
                        // 零分知识点数据
                        this.fatalVulnerability = data.fatalVulnerability || [];
                        // 高频错题知识点数据
                        this.highVulnerability = data.highVulnerability || [];
                        // 所有知识点数据
                        this.allKnowledgeList = data.allKnowledgeList || [];

                        // 新增：调用studentKnowledgeDataTree API获取treeData
                        this.getStudentKnowledgeDataTree();

                        // 获取知识点第一条数据id 全部>高频错题>零分知识点
                        if (this.allKnowledgeList.length > 0) {
                            this.knowledgeName = this.allKnowledgeList[0].knowledgeName || '';
                            this.knowledgeId = this.allKnowledgeList[0].knowledgeId || 0;
                        } else {
                            if (this.highVulnerability.length > 0) {
                                this.knowledgeName = this.highVulnerability[0].knowledgeName || '';
                                this.knowledgeId = this.highVulnerability[0].knowledgeId || 0;
                            } else if (this.fatalVulnerability.length > 0) {
                                this.knowledgeName = this.fatalVulnerability[0].knowledgeName || '';
                                this.knowledgeId = this.fatalVulnerability[0].knowledgeId || 0;
                            } else {
                                this.knowledgeName = '';
                                this.knowledgeId = '';
                            }
                        }

                        // 首次加载默认获取知识点
                        this.KnowledgeTrackData();
                        // 加载推送试题
                        this.pushQuestionData();
                    } else {
                        this.treeData = [];
                        this.subjectScoreRate = 0; //科目得分率
                        this.fatalVulnerability = []; // 零分知识点数据
                        this.highVulnerability = []; // 高频错题知识点数据
                        this.allKnowledgeList = []; // 所有知识点数据
                        // 首次加载默认获取知识点
                        this.zeroloading = false;
                        this.historicalChangeLoading = false;
                        this.knowledgePapsLoading = false;
                        // 清除历次变化图表数据
                        this.historicalChangeData = {
                            personalList: [],
                            classList: [],
                            gradeList: [],
                            examName: []
                        };
                        // 接口调用成功后，刷新图表
                        this.$nextTick(() => {
                            if (this.$refs.knowledgeGraphRef) {
                                this.$refs.knowledgeGraphRef.updateChart();
                            }
                        });
                    }
                } else {
                    this.treeData = [];
                    this.subjectScoreRate = 0; //科目得分率
                    this.fatalVulnerability = []; // 零分知识点数据
                    this.highVulnerability = []; // 高频错题知识点数据
                    this.allKnowledgeList = []; // 所有知识点数据
                    // 加载状态
                    this.zeroloading = false;
                    // 接口调用成功后，刷新图表
                    this.$nextTick(() => {
                        if (this.$refs.knowledgeGraphRef) {
                            this.$refs.knowledgeGraphRef.updateChart();
                        }
                    });
                }
            })
        },

        // 新增：获取知识点树状图数据
        getStudentKnowledgeDataTree(knowledgeType = 0, scoreRateTypes = null) {
            this.treeData = [];
            let params = {
                examId: this.portraitData.examId, //当前考试id
                examIds: this.portraitData.examIds, //历次考试ids
                subjectCode: this.portraitData.subjectCode, //学科code
                knowledgeId: this.portraitData.knowledgeId, //知识点id(针对历次和试题查询)
                scoreRateTypes: scoreRateTypes, // 得分率类型 1薄弱 2良好 3优秀（精准提升），为空是全部
                knowledgeType: knowledgeType // 知识点类型 0全部 1高频错题知识点 2零分知识点（精准提升）
            };

            this.$api.personalProfile.studentKnowledgeDataTree(params).then(res => {
                if (res.code === 200) {
                    let data = res.data;
                    if (data) {
                        // 从新API获取treeData
                        this.treeData = data || [];

                        // 接口调用成功后，刷新图表
                        this.$nextTick(() => {
                            if (this.$refs.knowledgeGraphRef) {
                                this.$refs.knowledgeGraphRef.updateChart();
                            }
                        });
                    } else {
                        this.treeData = [];
                        // 接口调用成功后，刷新图表
                        this.$nextTick(() => {
                            if (this.$refs.knowledgeGraphRef) {
                                this.$refs.knowledgeGraphRef.updateChart();
                            }
                        });
                    }
                } else {
                    this.treeData = [];
                    // 接口调用成功后，刷新图表
                    this.$nextTick(() => {
                        if (this.$refs.knowledgeGraphRef) {
                            this.$refs.knowledgeGraphRef.updateChart();
                        }
                    });
                }
            });
        },

        // 处理图例变化事件
        handleLegendChange(data) {
            // 调用getStudentKnowledgeDataTree方法，传递knowledgeType和scoreRateTypes
            this.getStudentKnowledgeDataTree(data.knowledgeType, data.scoreRateTypes);
        },

        // 获取历次变化数据
        KnowledgeTrackData() {
            // 加载状态-清空数据
            this.historicalChangeLoading = false;
            // 清除历次变化图表数据
            this.historicalChangeData = {
                personalList: [],
                classList: [],
                gradeList: [],
                examName: []
            };
            let params = {
                examId: this.portraitData.examId, //当前考试id
                examIds: this.portraitData.examIds, //历次考试ids
                subjectCode: this.portraitData.subjectCode, //学科code
                knowledgeId: this.knowledgeId, //	知识点id(针对历次和试题查询)
            };
            this.$api.personalProfile.knowledgeExamPrevious(params).then(res => {
                if (res.code === 200) {
                    let data = res.data
                    if (!data) {
                        this.$message.error(res.msg);
                        return
                    }
                    // 加载状态-清空数据
                    this.historicalChangeLoading = false;

                    // 初始化空数组
                    let personalList = []; //个人得分率
                    let classList = []; //班级得分率
                    let gradeList = []; //年级得分率
                    let examNames = []; //考试名称

                    // 遍历数据
                    if (data && Array.isArray(data)) {
                        data.forEach(item => {
                            // 添加个人得分率
                            personalList.push(item.personalScoreRate);
                            // 添加班级得分率
                            classList.push(item.classScoreRate);
                            // 添加年级得分率
                            gradeList.push(item.gradeScoreRate);
                            // 添加考试名称
                            examNames.push(item.examName);
                        });
                    }
                    // 更新历次变化图表数据
                    this.historicalChangeData = {
                        personalList: personalList,
                        classList: classList,
                        gradeList: gradeList,
                        examName: examNames,
                    };

                    this.$nextTick(() => {
                        if (this.$refs.historicalChangeChartRef) {
                            this.$refs.historicalChangeChartRef.initChart();
                        }
                    });
                } else {
                    // 清除历次变化图表数据
                    this.historicalChangeData = {
                        personalList: [],
                        classList: [],
                        gradeList: [],
                        examName: []
                    };
                    // 加载状态-清空数据
                    this.historicalChangeLoading = false;
                }
            }).catch(err => {
                // 清除历次变化图表数据
                this.historicalChangeData = {
                    personalList: [],
                    classList: [],
                    gradeList: [],
                    examName: []
                };
                // 加载状态-清空数据
                this.historicalChangeLoading = false;
            })
        },

        // 推题列表
        pushQuestionData() {
            this.knowledgData = [];
            let params = {
                examId: this.portraitData.examId, //当前考试id
                subjectCode: this.portraitData.subjectCode, //学科code
                knowledgeId: this.knowledgeId, //知识点id(针对历次和试题查询)
            };
            this.$api.personalProfile.pushQuestionList(params).then(res => {
                if (res.code === 200) {
                    let data = res.data;
                    if (data) {
                        // 加载状态-清空数据
                        this.knowledgePapsLoading = false;
                        // 更新推题列表数据
                        this.knowledgData = data || [];
                    } else {
                        // 加载状态-清空数据
                        this.knowledgePapsLoading = false;
                        // 更新推题列表数据
                        this.knowledgData = [];
                    }
                } else {
                    // 加载状态-清空数据
                    this.knowledgePapsLoading = false;
                    // 更新推题列表数据
                    this.knowledgData = [];
                }
            });
        },

        // 知识点列表点击事件
        handleKnowledgeItemClick(data) {
            // 点击知识点后，更新图表数据
            this.knowledgeId = data.item.knowledgeId;
            this.knowledgeName = data.item.knowledgeName;
            // 点击知识点后，更新历次变化
            this.KnowledgeTrackData();
            // 点击知识点后，更新推题列表
            this.pushQuestionData();
        },

        // 零分、高频、全部知识点切换
        handleActiveTabChange(tab) {
            // highFreq 高频
            // zero 零分
            // all 所有知识点
            let knowledgeType = 0;

            if (tab === 'highFreq') {
                // 高频知识点
                knowledgeType = 1;
                if (this.highVulnerability.length > 0) {
                    this.knowledgeId = this.highVulnerability[0].knowledgeId;
                    this.knowledgeName = this.highVulnerability[0].knowledgeName;
                } else {
                    this.knowledgeId = '';
                    this.knowledgeName = '';
                }
            } else if (tab === 'zero') {
                // 零分知识点
                knowledgeType = 2;
                if (this.fatalVulnerability.length > 0) {
                    this.knowledgeId = this.fatalVulnerability[0].knowledgeId || 0;
                    this.knowledgeName = this.fatalVulnerability[0].knowledgeName || '';
                } else {
                    this.knowledgeId = '';
                    this.knowledgeName = '';
                }
            } else if (tab === 'all') {
                // 所有知识点
                knowledgeType = 0;
                if (this.allKnowledgeList.length > 0) {
                    this.knowledgeId = this.allKnowledgeList[0].knowledgeId || 0;
                    this.knowledgeName = this.allKnowledgeList[0].knowledgeName || '';
                } else {
                    this.knowledgeId = '';
                    this.knowledgeName = '';
                }
            }

            // 重置图例状态：让三个图例恢复成原先的模样
            if (this.$refs.knowledgeGraphRef) {
                this.$refs.knowledgeGraphRef.selectedLegend = {
                    weak: true,
                    good: true,
                    excellent: true
                };
                // 重置后更新图表
                this.$refs.knowledgeGraphRef.$nextTick(() => {
                    if (this.$refs.knowledgeGraphRef.activeView === 'graph' && this.$refs.knowledgeGraphRef.chart) {
                        this.$refs.knowledgeGraphRef.updateChart();
                    }
                });
            }

            // 根据tab切换调用新API，传递对应的knowledgeType和重置后的scoreRateTypes=null
            this.getStudentKnowledgeDataTree(knowledgeType, null);

            if (!this.knowledgeId) {
                this.historicalChangeData = {
                    personalList: [],
                    classList: [],
                    gradeList: [],
                    examName: []
                };
                this.$nextTick(() => {
                    if (this.$refs.historicalChangeChartRef) {
                        this.$refs.historicalChangeChartRef.initChart();
                    }
                });
                return
            }
            // 点击知识点后，更新历次变化
            this.KnowledgeTrackData();
            // 点击知识点后，更新推题列表
            this.pushQuestionData();
        },

        // 导出精准提升试题
        exportKnowledgePaps() {
            // if (this.knowledgData.length === 0) {
            //     this.$message.warning('暂无知识点推题');
            //     return
            // }
            // 触发Download组件弹窗
            this.visible = true;
        },
        // 导出试题（供父组件调用）
        ExportQuestions() {
            this.exportKnowledgePaps();
        }
    },
}
</script>

<style scoped lang="scss">
.personalProfile {

    // 确保所有子组件之间有10px的间隔
    >* {
        margin-bottom: 10px;
        font-family: PingFang SC, PingFang SC;
        font-size: 14px;
        font-weight: 400;
        color: #333333;
    }

    >*:last-child {
        margin-bottom: 0;
    }

    // 画像切换
    .report_header {
        padding: 10px 0;
        text-align: center;
        font-size: 14px;
        background: #ffffff;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding-left: 10px;

        /* 选中状态 */
        :deep(.el-radio-button__orig-radio:checked + .el-radio-button__inner) {
            font-weight: 600 !important;
            color: #ffffff !important;
        }

        :deep(.el-radio-button__inner) {
            height: 36px;
            line-height: 34px;
            padding: 0px;
            width: 76px;
            text-align: center;
            color: #999999;
        }
    }
}
</style>
