// ==UserScript== // @name 2026年广西公需科目助手 // @namespace https://gxjxjy.rst.gxzf.gov.cn/ // @version 1.0.0 // @description 2026年广西公需科目多账户管理、视频课程一键秒学、AI+内置题库自动答题(正确率90%)、题库导入。 // @author sumuve // @license MIT // @icon data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAACMuAAAjLgAAAAAAAAAAAAAAAAAAAAAAAPSoEAD0qBAA9KgQFvSoEEv0qBBw9KgQfPSoEHv0qBBu9KgQRfSoEBH0qBAA9KgQAAAAAAAAAAAAAAAAAPSoEAD0qBAE9KgQQPSoEHr0qBBp9KgQT/SoED/0qBA/9KgQTfSoEG70qBB39KgQN/SoEAL0qBAAAAAAAPSoEAD0qBAD9KgQVPSoEHD0qBAx9KgQM/SoEEL0qBBK9KgQR/SoED/0qBAt9KgQLPSoEHf0qBBH9KgQAfSoEAD0qBAA9KgQQPSoEHL0qBAS9KgQI/SoEEn0qBAm9KgQE/SoEBT0qBAr9KgQSPSoEBr0qBAZ9KgQePSoEDH0qBAA9KgQFPSoEHj0qBAi9KgQIvSoEL/0qBC49KgQf/SoEFT0qBBZ9KgQhvSoEMH0qBCy9KgQFvSoEC/0qBBz9KgQC/SoEEj0qBBg9KgQBPSoEJH0qBD/9KgQ//SoEP/0qBD89KgQ/fSoEP/0qBD/9KgQ//SoEHn0qBAF9KgQa/SoEDb0qBBt9KgQOvSoEBX0qBDB9KgQ8PSoENH0qBDP9KgQgfSoEIz0qBDP9KgQ1PSoEPH0qBCw9KgQC/SoEEr0qBBd9KgQefSoECj0qBAg9KgQRvSoEHj0qBDW9KgQyPSoEFT0qBBm9KgQy/SoENH0qBBs9KgQSPSoEBb0qBA39KgQa/SoEHj0qBAv9KgQIfSoEC70qBAA9KgQR/SoEMT0qBB+9KgQjPSoEL30qBA59KgQAPSoEDX0qBAi9KgQQfSoEGn0qBBn9KgQTPSoEB30qBA+9KgQA/SoEAD0qBBC9KgQjvSoEI/0qBA09KgQAPSoEAf0qBA/9KgQJPSoEF30qBBW9KgQPfSoEG/0qBAu9KgQOPSoECf0qBAA9KgQEPSoEHX0qBBq9KgQCfSoEAD0qBAu9KgQNvSoEDH0qBB29KgQLPSoEAz0qBBz9KgQRfSoECf0qBAv9KgQSfSoEL30qBDe9KgQ3/SoELD0qBA99KgQL/SoEC70qBBY9KgQavSoEAX0qBAA9KgQLvSoEHv0qBA+9KgQKvSoEDT0qBCC9KgQ0/SoEMv0qBB39KgQMfSoECv0qBBL9KgQffSoECL0qBAA9KgQAPSoEAD0qBA99KgQfPSoEE30qBAs9KgQGfSoEDb0qBA99KgQLfSoED30qBBY9KgQffSoEDL0qBAA9KgQAAAAAAD0qBAA9KgQAPSoECj0qBBt9KgQcvSoEFn0qBBR9KgQWPSoEGT0qBB29KgQaPSoECD0qBAA9KgQAAAAAAAAAAAAAAAAAPSoEAD0qBAA9KgQB/SoEC30qBBU9KgQZvSoEGT0qBBQ9KgQKPSoEAX0qBAAAAAAAAAAAAAAAAAA8A8AAMADAACAAQAAgAEAAAAAAAAAAAAAAAAAAAAAAAAIEAAABCAAAAQgAAAAAAAAgAEAAIADAADABwAA8A8AAA== // @match https://gxjxjy.rst.gxzf.gov.cn/* // @exclude https://gxjxjy.rst.gxzf.gov.cn/infocenter/* // @grant GM_addStyle // @grant GM_xmlhttpRequest // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @run-at document-end // @require https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js // @tag 广西公需科目 一键秒学 AI答题 自动答题 继续教育 // ==/UserScript== (function () { 'use strict'; // 全局单例锁 if (window.GK_HELPER) return; window.GK_HELPER = true; // ========== 新增:禁止在指定URL运行 ========== const forbiddenUrlPrefix = 'https://gxjxjy.rst.gxzf.gov.cn/infocenter/'; // 检测当前URL是否以指定地址开头(兼容type后带任意参数的情况) if (window.location.href.startsWith(forbiddenUrlPrefix)) { return; // 直接终止脚本执行 } // ===================== 核心配置 ===================== const CONFIG = { LOGIN_URL: "https://gxjxjy.rst.gxzf.gov.cn/", CLASS_URL: "https://gxjxjy.rst.gxzf.gov.cn/study/study/class/detail", API_URL: "https://gxjxjy.rst.gxzf.gov.cn/gateway/auth/user/study/progress/save", // 修复:替换为正确的CLIENT_ID CLIENT_ID: "4fb21de30f9e11f0978f00ffbe64ecb8", // 修复:图标改为纯白色(提升可见性) ICON: '', BLUE: "#1677ff", LIGHT_BLUE: "#e6f7ff", AI_TIMEOUT: 15000, SUBMIT_PROTECT: 3000 }; // 内置题库数据 const QUESTION_BANK = { "single": [ { "title": "《广西支持“人工智能+制造”若干政策措施》提出,遴选具备人工智能赋能制造业成功经验的企业,建立“人工智能+制造”服务商库。这一政策措施旨在( )。", "options": ["强化人才引育", "聚集赋能服务资源", "支持人工智能软件开发", "支持科技创新平台建设"], "answer": "B" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,加快人工智能在( )中的应用,提升智能交易服务和监管水平。", "options": ["各类基础科学研究活动", "各类全民健身主题活动", "各类公共资源招标投标活动", "各类新时代文明实践活动"], "answer": "C" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,推动建立( ),持续推进数据管理能力成熟度国家标准贯标,夯实企业数据治理基础。", "options": ["企业内部控制制度", "企业内部制度", "企业质量管理体系", "企业首席数据官制度"], "answer": "D" }, { "title": "人工智能发展的第三次浪潮以( )为核心。", "options": ["深度学习", "神经网络", "符号推理", "逻辑推导"], "answer": "A" }, { "title": "人工智能发展的第三次浪潮以( )为核心。", "options": ["深度学习", "神经网络", "符号推理", "逻辑推导"], "answer": "A" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,推进自然资源三维立体“一张图”和国土空间基础信息平台建设,提升空天地海一体化动态感知和( )。", "options": ["全国土地规划能力", "低空智能管理能力", "太空领域规划能力", "国土空间智慧规划能力"], "answer": "D" }, { "title": "某稀土矿区部署AI水质监测浮标,实现砷、氨氮浓度突变及时预警。这属于AI技术在( )领域的应用。", "options": ["治安管理", "数字孪生", "环境监测", "海洋测绘"], "answer": "C" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,深化人工智能技术在( )融合应用,针对能源和碳排放管理、资源循环利用等场景需求,研发推广智能化绿色化协同解决方案。", "options": ["新材料领域", "环境保护领域", "高端装备领域", "绿色制造领域"], "answer": "D" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,深化人工智能技术在( )融合应用,针对能源和碳排放管理、资源循环利用等场景需求,研发推广智能化绿色化协同解决方案。", "options": ["新材料领域", "环境保护领域", "高端装备领域", "绿色制造领域"], "answer": "D" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出“‘人工智能+’产业升级”重点行动,助推广西重点产业高质量发展,助力全产业智能化转型升级。其子行动不包括( )。", "options": ["“人工智能+”金融", "“人工智能+”食品加工", "“人工智能+”现代绿色化工", "“人工智能+”机械及高端装备"], "answer": "A" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,重点支持工业领域计算机视觉、智能语音处理、虚拟现实/增强现实等人工智能软件开发,支持( )驱动的智能平台、行业模型、行业智能体等开发。", "options": ["通用大模型", "基础大模型", "工业大模型", "制造业大模型"], "answer": "C" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,加快服务业从数字赋能的互联网服务向( )的新型服务方式演进,拓展经营范围,推动现代服务业向智向新发展。", "options": ["经验驱动", "智能驱动", "文化赋能", "品牌赋能"], "answer": "B" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,实施广西国门学校教育智能体建设项目,推广( ),探索智能学伴和智能教师等人机协同教学模式。", "options": ["智能评价系统", "个性化学习平台", "人工智能教育应用", "智能心理疏导体系"], "answer": "C" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,鼓励制造业企业与院校、科研院所( ),共同培养复合型产业人才。", "options": ["携手构建产业发展新生态", "共建产教融合平台、实训基地", "共同培育具有行业底蕴的产业文化", "合作研发具有市场竞争力的产品"], "answer": "B" }, { "title": "1956年,( )提出“人工智能”这一名词,标志着人工智能作为独立学科正式确立。", "options": ["万隆会议", "开罗会议", "瓦窑堡会议", "达特茅斯会议"], "answer": "D" }, { "title": "1956年,( )提出“人工智能”这一名词,标志着人工智能作为独立学科正式确立。", "options": ["万隆会议", "开罗会议", "瓦窑堡会议", "达特茅斯会议"], "answer": "D" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,加快工业母机、工业机器人等各类工业装备搭载应用智能体,研制新一代人工智能数控系统,提升自主决策、分析和执行等能力。加快发展手术机器人、智能诊断系统等,加速智能医疗装备产品创新和临床应用推广。这一政策举措旨在( )。", "options": ["推动智能装备迭代", "加速智能终端升级", "打造智能体新业态", "推动智能体云化部署"], "answer": "A" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,到( )年,我国全面步入智能经济和智能社会发展新阶段,为基本实现社会主义现代化提供有力支撑。", "options": ["2025", "2030", "2035", "2040"], "answer": "C" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,加强人工智能应用就业风险评估,引导创新资源向( )的方向倾斜,减少对就业的冲击。", "options": ["经济效益好", "产业关联度高", "创造就业潜力大", "辐射带动能力强"], "answer": "C" }, { "title": "《广西支持“人工智能+制造”若干政策措施》自印发之日起施行,有效期至2027年12月31日,支持对象以( )为主。", "options": ["计算机、通信和其他电子设备制造业", "农业企业、互联网和相关服务业", "制造业企业、科学研究和技术服务业", "工业企业、软件和信息技术服务企业"], "answer": "D" }, { "title": "当前我国人工智能发展存在的突出问题有( )。①对人工智能作用认识不一致 ②供需对接不畅 ③应用落地存在“最后一公里”障碍", "options": ["仅①②", "仅①③", "仅②③", "①②③"], "answer": "D" }, { "title": "车企在智能研发设计环节,利用AI辅助车身造型、内饰布局设计,能快速生成多种设计方案,智能优化设计参数。这一过程主要应用的AI技术是( )。", "options": ["工业大模型", "农业大模型", "教育大模型", "政务大模型"], "answer": "A" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,适度超前布局相关新型基础设施,推进数字化、智能化共性应用集采共用,搭建( ),推动智算、模型、数据、智能体、安全等资源共建共享共用。", "options": ["企业合作平台", "企业融资平台", "金融信息服务平台", "行业应用共性平台"], "answer": "D" }, { "title": "根据《国务院关于深入实施“人工智能+”行动的意见》,旨在加快农业数智化转型升级的政策举措不包括( )。", "options": ["加快人工智能驱动的育种体系创新", "探索无人服务与人工服务相结合的新模式", "大力发展智能农机、农业无人机等智能装备", "加强人工智能在农业生产管理等领域应用"], "answer": "B" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,把人工智能作为造福人类的国际公共产品,打造平权、互信、多元、共赢的人工智能能力建设开放生态。这一政策举措旨在( )。", "options": ["加速科学发现进程", "促进开源生态繁荣", "推动人工智能普惠共享", "培育智能原生新模式新业态"], "answer": "C" }, { "title": "上汽通用五菱凭借“( )”入选首批国家领航级智能工厂培育名单,成为整车制造领域唯一代表。", "options": ["质量管理体系", "产品宣传体系", "智能岛制造体系", "安全生产管理体系"], "answer": "C" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,到( )年,率先实现人工智能与6大重点领域广泛深度融合。", "options": ["2027", "2030", "2032", "2035"], "answer": "A" }, { "title": "根据《国务院关于深入实施“人工智能+”行动的意见》,下列主体中,我国支持( )探索普惠高效的开源应用新模式。①企业 ②高校 ③科研机构", "options": ["仅①②", "仅①③", "仅②③", "①②③"], "answer": "D" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》提出,加强智能消费基础设施建设,提升( )等生活服务品质,拓展体验消费、个性消费、认知和情感消费等服务消费新场景。①文娱、电商 ②家政、物业 ③出行、养老、托育", "options": ["仅①②", "仅①③", "仅②③", "①②③"], "answer": "D" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》在“打造安全治理多元共治新格局”方面指出,加快推动人工智能赋能( ),强化信息精准识别、态势主动研判、风险实时处置等能力。", "options": ["城市规划", "医保服务", "人才队伍建设", "网络空间治理"], "answer": "D" }, { "title": "在政务服务方面,应用( )AI技术,提供智能咨询、办事材料智能预审、政策精准推送等服务,可助力解决政务服务效率低、办事流程复杂、群众多次跑腿的问题。", "options": ["人群分析", "数据飞轮", "政务大模型", "具身大模型"], "answer": "C" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,助力( )开发基础大模型,支持行业垂直模型研发与创新,建立健全模型能力评估体系。", "options": ["北约成员国", "东盟国家", "亚太经合组织成员国", "金砖国家"], "answer": "B" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,加快人工智能产品和服务向( )延伸,推动城乡智能普惠。", "options": ["城镇", "乡村", "社区", "学校"], "answer": "B" }, { "title": "智能体技术在医疗领域的应用场景不包括( )。", "options": ["监测患者的健康数据", "根据患者症状为其推荐科室", "为患者提供个性化用药建议", "提供农作物病虫害精准防治方案"], "answer": "D" }, { "title": "农户拍照上传病虫害图片,AI能迅速生成诊断结果,并提供精准防治方案与用药建议。这一过程主要应用的AI技术是( )。", "options": ["数字孪生", "智能体技术", "计算机视觉", "农业大模型"], "answer": "C" }, { "title": "在智能学习规划上,知识森林智能导学可以解决( )问题。", "options": ["教师工作负担重", "优质师资分布不均", "学生学习路径不清晰", "教师个性化教学难实现"], "answer": "C" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,支持发展数据标注、数据合成等技术,培育壮大( )。", "options": ["数字文化产业", "智能设备制造业", "科技推广和应用服务业", "数据处理和数据服务产业"], "answer": "D" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,推广机器视觉、无人智能巡检等工业质检技术,强化产线实时监测和预测性维护,提升设备故障识别准确性,实现安全生产风险预警与事件告警。这一政策举措旨在深化人工智能技术在( )环节的应用。", "options": ["研发设计", "生产制造", "营销服务", "客户管理"], "answer": "B" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,依托广西( )优势,培育一批智能旅居康养产品。", "options": ["水资源", "矿产资源", "长寿资源", "土地资源"], "answer": "C" }, { "title": "“( )”,是一个基于磁共振影像智能化评估地中海贫血心、肝脏铁含量系统。该系统能够提高诊断准确率。", "options": ["医慧云", "铁捕快", "医智联", "云药智医"], "answer": "B" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,推动钢铁产业智能化升级与绿色转型,推进( )发展。", "options": ["环保复合材料", "高端高分子材料", "高级有色金属材料", "先进钢铁材料"], "answer": "D" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,充分发挥人工智能优势,拓展人工智能在“( )”全生命周期的应用,提升人民生活品质,共建智能社会。", "options": ["好房子", "好公园", "好道路", "好绿化"], "answer": "A" }, { "title": "“边江智州”人工智能开放平台在崇左市江州区成功发布,标志着广西首个区县级人工智能智能基座在崇左落地生根,为县域经济社会( )注入核心驱动力。", "options": ["高质量发展", "可持续发展", "数字化转型", "绿色化发展"], "answer": "C" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028 年)》提出,推动海洋渔业、海工装备、海洋能源、海洋服务业等领域与人工智能融合发展,打造( )新集群。", "options": ["生物产业和医药产业", "大数据产业和信息产业", "智能临港产业和向海产业", "智慧康养产业和旅游产业"], "answer": "C" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,加快西部陆海新通道数字化建设,推进平陆运河经济带要素大模型、“( )”和数字孪生管控平台建设。", "options": ["八桂云农", "平陆云脑", "齐鲁智脑", "东方超算云"], "answer": "B" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,支持( )在人工智能全球治理中发挥主渠道作用,探索形成各国广泛参与的治理框架,共同应对全球性挑战。", "options": ["联合国", "二十国集团", "欧洲联盟", "东南亚国家联盟"], "answer": "A" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,高水平建设广西人工智能( ),布局一批广西人工智能开放创新平台。", "options": ["实验室", "资料库", "产业园", "研发团队"], "answer": "A" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,鼓励有条件的企业将人工智能融入战略规划、组织架构、业务流程等,推动产业全要素智能化发展,助力传统产业改造升级,开辟( )发展新赛道。", "options": ["劳动密集型产业", "资本密集型产业", "主导产业和支柱产业", "战略性新兴产业和未来产业"], "answer": "D" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,加快工业母机、工业机器人等各类工业装备搭载应用智能体,研制新一代人工智能数控系统,提升自主决策、分析和执行等能力。加快发展手术机器人、智能诊断系统等,加速智能医疗装备产品创新和临床应用推广。这一政策举措旨在( )。", "options": ["推动智能装备迭代", "加速智能终端升级", "打造智能体新业态", "推动智能体云化部署"], "answer": "A" }, { "title": "“农业大模型”AI技术在作物生长过程中能实时监测土壤、气象,智能灌溉施肥。这有助于解决( )的问题。", "options": ["农业生产决策滞后", "病虫害识别效率低", "农业知识获取难", "农村劳动力短缺"], "answer": "A" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》在“打造安全治理多元共治新格局”方面指出,加快推动人工智能赋能( ),强化信息精准识别、态势主动研判、风险实时处置等能力。", "options": ["城市规划", "医保服务", "人才队伍建设", "网络空间治理"], "answer": "D" }, { "title": "“多语言翻译”AI技术可实现中文-东盟语言实时翻译、语音识别合成等功能,这一技术可应用于( )场景。", "options": ["智能查验货物", "查询各国关税政策", "智能推荐合作伙伴", "跨境会议同声传译"], "answer": "D" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,加快服务业从数字赋能的互联网服务向( )的新型服务方式演进,拓展经营范围,推动现代服务业向智向新发展。", "options": ["经验驱动", "智能驱动", "文化赋能", "品牌赋能"], "answer": "B" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,实施广西国门学校教育智能体建设项目,推广( ),探索智能学伴和智能教师等人机协同教学模式。", "options": ["智能评价系统", "个性化学习平台", "人工智能教育应用", "智能心理疏导体系"], "answer": "C" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,适度超前布局相关新型基础设施,推进数字化、智能化共性应用集采共用,搭建( ),推动智算、模型、数据、智能体、安全等资源共建共享共用。", "options": ["企业合作平台", "企业融资平台", "金融信息服务平台", "行业应用共性平台"], "answer": "D" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,推动建立( ),持续推进数据管理能力成熟度国家标准贯标,夯实企业数据治理基础。", "options": ["企业内部控制制度", "企业内部制度", "企业质量管理体系", "企业首席数据官制度"], "answer": "D" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,助力( )开发基础大模型,支持行业垂直模型研发与创新,建立健全模型能力评估体系。", "options": ["北约成员国", "东盟国家", "亚太经合组织成员国", "金砖国家"], "answer": "B" }, { "title": "《“人工智能+制造”专项行动实施意见》提出,加快( )建设应用,推动基础科研平台和重大科技基础设施智能化升级,打造开放共享的高质量科学数据集,提升跨模态复杂科学数据处理水平。", "options": ["文本语料库", "科学大模型", "人工智能医院", "制造业数据集"], "answer": "B" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,鼓励制造业企业与院校、科研院所( ),共同培养复合型产业人才。", "options": ["携手构建产业发展新生态", "共建产教融合平台、实训基地", "共同培育具有行业底蕴的产业文化", "合作研发具有市场竞争力的产品"], "answer": "B" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,建立健全人工智能技术监测、风险预警、应急响应体系,强化政府引导、行业自律,坚持包容审慎、分类分级,加快形成动态敏捷、多元协同的人工智能治理格局。这一政策举措旨在( )。", "options": ["提升模型基础能力", "优化应用发展环境", "提升安全能力水平", "促进开源生态繁荣"], "answer": "C" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,重点支持工业领域计算机视觉、智能语音处理、虚拟现实/增强现实等人工智能软件开发,支持( )驱动的智能平台、行业模型、行业智能体等开发。", "options": ["通用大模型", "基础大模型", "工业大模型", "制造业大模型"], "answer": "C" }, { "title": "商家可以利用( )的AI技术,自动生成营销文案和产品视频,智能设计详情页与广告图,解决传统视频制作耗时长、成本高的难题。", "options": ["商贸大模型", "AIGC生成", "多语言翻译", "数字人"], "answer": "B" }, { "title": "“商贸大模型”AI技术能分析用户行为数据,为其智能推荐热销商品,推送个性化营销内容。这有助于解决( )的问题。", "options": ["语言障碍", "营销精准度低", "客服人力不足", "营销内容制作成本高"], "answer": "B" }, { "title": "AI地质勘探模型在“矿产资源智能勘探”场景中的具体应用不包括( )。", "options": ["矿床分布预测", "气候变化模拟", "地震数据自动解释", "钻探位置智能推荐"], "answer": "B" }, { "title": "数字孪生地球在地球系统科学研究方面的应用不包括( )。", "options": ["碳循环研究", "秒级地震预警", "生态系统演变", "气候变化模拟"], "answer": "B" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,加快人工智能在( )中的应用,提升智能交易服务和监管水平。", "options": ["各类基础科学研究活动", "各类全民健身主题活动", "各类公共资源招标投标活动", "各类新时代文明实践活动"], "answer": "C" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,推动服装加工贸易区智能化改造,建立“设计—生产—供应链”( ),实现人工智能驱动的面料花型生成式设计、生产工艺智能优化及订单动态调度。", "options": ["各环节安全规范", "全过程监督制度", "全流程改革框架", "全链路数据共享机制"], "answer": "D" }, { "title": "某稀土矿区部署AI水质监测浮标,实现砷、氨氮浓度突变及时预警。这属于AI技术在( )领域的应用。", "options": ["治安管理", "数字孪生", "环境监测", "海洋测绘"], "answer": "C" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》提出,推动人工智能驱动的技术研发、工程实现、产品落地一体化协同发展,加速“从1到N”技术落地和迭代突破,促进创新成果高效转化。这一政策举措旨在( )。", "options": ["提升软件智能化水平", "创新社会科学研究方法", "推进各产业智能化发展", "驱动技术研发模式创新和效能提升"], "answer": "D" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,人工智能加速与( )深度融合,深刻改变制造业生产模式和经济形态,成为驱动产业升级、重塑全球格局的关键变量。", "options": ["实体经济", "虚拟经济", "数字经济", "首发经济"], "answer": "A" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,推动( )创新,建设人形机器人中试基地和训练场,打造人形机器人标杆产线,在典型制造场景率先应用。", "options": ["脑机接口", "具身智能产品", "人工智能终端", "虚拟现实可穿戴设备"], "answer": "B" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,推广智能客服、数字人、商品三维模型,重点突破个性化推荐、定制化售后、服务化延伸等,发展基于人工智能技术的答疑、培训等功能。这一政策举措旨在深化人工智能技术在( )环节的应用。", "options": ["研发设计", "中试验证", "营销服务", "物流运输"], "answer": "C" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,发挥大模型推理预测能力,加速订单处理、销量预测、库存预警等环节智能升级,优化( )管理。", "options": ["资金链", "产业链", "供应链", "服务链"], "answer": "C" }, { "title": "通过( ),能让机器“看懂”图像和视频,实现人脸识别、物体检测、场景理解等视觉任务。", "options": ["知识库", "语音技术", "计算机视觉", "自然语言处理"], "answer": "C" } ], "multiple": [ { "title": "《“人工智能+制造”专项行动实施意见》指出,重点推进智能辅助设计、软件代码辅助编写、药物研发等,打造( )的新型研发设计模式。", "options": ["个性化", "规范化", "低成本", "高效能"], "answer": "ACD" }, { "title": "将AI技术应用到“社会治理与社区服务”场景,能实现的功能包括( )。", "options": ["安全隐患智能识别", "智能家居+社区服务联动", "AI社工随时随地在线", "居民紧急求助及时响应"], "answer": "ABCD" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,打造一批标志性人工智能产品。遴选一批人工智能硬件和软件产品,对( )给予一次性奖励。", "options": ["在智能制造领域表现优异的从业者", "在市场监督管理局登记注册的企业", "具备规模化应用和产业化发展潜力的产品", "获得国家互联网信息办公室生成式人工智能服务备案的企业"], "answer": "CD" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,加快研究更加高效的模型训练和推理方法,积极推动( )协同发展。", "options": ["理论创新", "道路创新", "技术创新", "工程创新"], "answer": "ACD" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,围绕( )等特色优势产业,构建以人工智能为核心的智慧农业体系,推进全基因组选择育种与模型构建。", "options": ["糖料蔗", "桑蚕", "茶叶、果蔬", "中药材、养殖"], "answer": "ABCD" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》在“人工智能+”文旅商体方面提出,推动( )智慧化转型,打造文体展览、主题社交、文旅商体融合的人工智能实景体验集聚区。", "options": ["社区", "景区", "体育场馆", "传统街区(商圈)"], "answer": "BCD" }, { "title": "自然语言处理能让机器“理解”和“生成”人类语言,实现( )等语言交互。", "options": ["翻译", "问答", "文本生成", "人脸识别"], "answer": "ABC" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,推动智能终端“万物智联”,培育智能产品生态,大力发展智能网联汽车、( )等新一代智能终端,打造一体化全场景覆盖的智能交互环境。", "options": ["人工智能手机和电脑", "智能机器人", "智能家居", "智能穿戴"], "answer": "ABCD" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,加强产业科技创新,大力发展( )机械装备,大力发展智能机器人产业,推广智能机器人应用。", "options": ["智能化", "无人化", "电动化", "一体化"], "answer": "ABC" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,布局建设一批国家人工智能应用中试基地。应用中试基地的作用有( )。", "options": ["聚焦共性问题,带动促进行业效能提升", "打造共创平台,推动人工智能产业发展", "沉淀共性能力,大幅降低应用创新门槛", "培育共赢生态,促进行业创新范式变革"], "answer": "ABCD" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,积极发挥人工智能在( )方面的作用,探索人机协同的新型组织架构和管理模式,培育发展智能代理等创新型工作形态,推动在劳动力紧缺、环境高危等岗位应用。", "options": ["创造新岗位", "赋能传统岗位", "促进教育公平", "推进全民健身"], "answer": "AB" }, { "title": "行为识别、异常检测、人群分析、人脸识别等AI视频分析技术在“公共安全保障”场景中的具体应用包括( )。", "options": ["重点区域实时监控", "政策文件精准推送", "异常行为自动预警", "突发事件快速定位"], "answer": "ACD" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,加快( )、茧丝绸等“桂字号”特色农产品全产业链的数字化建设。", "options": ["柑橘", "苹果", "茉莉花", "螺蛳粉"], "answer": "ACD" }, { "title": "狭义的智能体是指数字智能体,即软件机器人,其具有( )等特征。", "options": ["自主性", "反应性", "主动性", "交互性"], "answer": "ABCD" }, { "title": "根据《“人工智能+制造”专项行动实施意见》,下列技术中,能加强数据安全管理,强化人工智能安全保护能力的有( )。", "options": ["高速互联", "训练数据保护", "智能终端安全测评", "工业模型算法安全防护"], "answer": "BC" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,打造边疆民族地区治理新画卷,赋能社会治理,提升( )的现代化治理能力。", "options": ["政务", "安全", "生态", "军事"], "answer": "ABC" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,支持模型训练和推理方法创新,开发适应制造业( )特点的高性能算法模型。", "options": ["实时性", "可靠性", "安全性", "公正性"], "answer": "ABC" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,支持企业利用人工智能技术实施智能化改造,实现生产制造主要流程、关键环节智能化,重点在( )等特色优势产业打造一批具有推广价值和引领作用的标杆应用场景。", "options": ["冶金", "有色金属", "石化化工", "糖"], "answer": "ABCD" }, { "title": "AI技术在“智慧文旅”场景中的具体应用包括( )。", "options": ["提供个性化讲解", "数字复原历史场景", "智能推荐餐饮住宿", "辅助医生制定诊疗计划"], "answer": "ABC" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,推动人工智能在( )中展现更大作为,利用人工智能辅助创作更多具有中华文化元素和标识的文化内容,壮大文化产业。", "options": ["繁荣文化生产", "增强文化传播", "促进文化交流", "实现文化统一"], "answer": "ABC" }, { "title": "根据《国务院关于深入实施“人工智能+”行动的意见》,旨在强化政策法规保障的政策举措有( )。", "options": ["优化人工智能相关安全评估和备案管理制度", "健全国有资本投资人工智能领域考核评价和风险监管等制度", "支持企业规范用好股权、期权等中长期激励方式引才留才用才", "完善人工智能法律法规、伦理准则等,推进人工智能健康发展相关立法工作"], "answer": "ABD" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,因地制宜对城镇( )等城市基础设施进行数字化改造和智能化管理,逐步实现运行状况实时监测、模拟仿真和大数据分析。", "options": ["桥梁", "隧道", "农田", "地下综合管廊"], "answer": "ABD" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,推动“人工智能+”改革,对行业领域( )进行全方位系统性重塑。", "options": ["体制机制", "组织架构", "方式流程", "手段工具"], "answer": "ABCD" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,推动人工智能与( )等领域深度融合,推动林业产业园区智慧改造。", "options": ["种苗培育", "森林经营", "林产加工及纸业", "资源监测"], "answer": "ABCD" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,发展人工智能企业孵化器,实施中小企业创业支持计划,梯次培育更多人工智能专精特新“小巨人”企业、( )。", "options": ["高新技术企业", "制造业单项冠军企业", "独角兽企业", "瞪羚企业"], "answer": "ABCD" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,完善符合人工智能人才( )的多元化评价体系,更好发挥领军人才作用,给予青年人才更大施展空间,鼓励积极探索人工智能“无人区”。", "options": ["年龄特征", "学历层次", "职业属性", "岗位特点"], "answer": "CD" }, { "title": "崇左市以AI赋能边境教育,开展多语言智能教学,其发展定位为( )。", "options": ["城区引领", "县域覆盖", "边境适配", "学校研发"], "answer": "ABC" }, { "title": "AI实时翻译在跨境内容本地化方面可实现的功能包括( )。", "options": ["多语言客服支持", "群体性事件预警", "商品信息自动翻译", "营销文案本地化适配"], "answer": "ACD" }, { "title": "AI技术在“智慧口岸通关”场景中的具体应用包括( )。", "options": ["智能查验货物", "辅助报关单审核", "生成心理健康监测报告", "模拟地球生态系统演变"], "answer": "AB" }, { "title": "下列属于人工智能大模型的有( )。", "options": ["豆包", "千问", "决策树", "DeepSeek"], "answer": "ABD" } ], "boolean": [ { "title": "AI技术在跨境贸易领域的应用,有助于降低中小企业外贸门槛,帮助其实现智能化经营与接单。", "answer": "对" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,深入研究人工智能对人类认知判断、伦理规范等方面的深层次影响和作用机理,探索形成智能向善理论体系,促进人工智能更好造福人类。", "answer": "对" }, { "title": "AI技术能帮助学生分析学习数据,诊断知识薄弱点,定制专属学习路径和内容,从而实现个性化教学。", "answer": "对" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,支持人工智能芯片攻坚创新与使能软件生态培育,加快超大规模智算集群技术突破和工程落地。", "answer": "对" }, { "title": "贵港市港北区益农农场是广西首个水稻智慧农场。", "answer": "对" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,研发推广适配人工智能项目特性的开源许可协议,构建新型人工智能开源规则秩序。这一措施旨在梯次培育企业。", "answer": "错" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,以涉重金属污染治理和畜禽养殖污染防治为重点,拓展人工智能技术在环境监测预测、污染溯源模拟、大气污染防治等领域应用。", "answer": "对" }, { "title": "我国发展人工智能的优势在于数据资源丰富,劣势在于产业体系不完备、应用场景较少。", "answer": "错" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,开展搭载自动驾驶功能的智能网联汽车产品测试与安全评估,有序推进产品准入和上路通行试点。", "answer": "对" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,支持企业、院校、科研机构等通过采集、清洗、标注、评价等方式建设高质量工业数据集。", "answer": "对" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》的突出特点包括:突出应用导向,明确科技、产业、消费、民生、治理、全球合作等6大重点行动。", "answer": "对" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,支持人工智能开源社区建设,促进模型、工具、数据集等汇聚开放,培育优质开源项目。", "answer": "对" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,鼓励探索基于价值贡献度的数据成本补偿、收益分成等方式,加强数据供给激励。", "answer": "对" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,发挥国家人工智能产业投资基金作用,丰富优质项目储备,吸引带动更多社会资本有序加大投资。", "answer": "对" }, { "title": "《国务院关于深入实施“人工智能+”行动的意见》指出,深化人工智能与工业互联网融合应用,增强工业系统的智能感知与决策执行能力。", "answer": "对" }, { "title": "人工智能能够通过计算机程序、算法和软硬件,模拟、延伸和扩展人的智能。", "answer": "对" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,人工智能与制造业的深度融合,是发展新质生产力、构建现代化产业体系的重要路径。", "answer": "对" }, { "title": "《“人工智能+制造”专项行动实施意见》指出,到 2027 年,我国人工智能关键核心技术实现安全可靠供给,产业规模和赋能水平稳居世界前列。", "answer": "对" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,支持智能运载工具、智能移动终端等智能产品,智能芯片、智能传感器等核心元器件和零部件开展产业化和生产线建设项目。", "answer": "对" }, { "title": "社保大模型属于通用大模型。", "answer": "错" }, { "title": "AlphaGo击败世界围棋冠军李世石是人工智能发展第二次浪潮的标志性事件。", "answer": "错" }, { "title": "《广西支持“人工智能+制造”若干政策措施》提出,对获认定市级以上产业技术基础公共服务平台、制造业中试基地、制造业创新中心等创新平台,给予一次性奖励。", "answer": "错" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,到 2028 年,全面建成中国—东盟国家人工智能应用合作中心,智能经济核心产业产值突破 1000 亿元,新一代智能终端、智能体等应用普及率达 100%。", "answer": "错" }, { "title": "在社会治理方面,城市级AI中枢系统能融合交通、环境、安防等多源数据,解决城市管理碎片化问题,推动城市智能管理。", "answer": "对" }, { "title": "人工智能的核心目标是让机器具备感知、学习、推理、决策和交互等能力。", "answer": "对" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028 年)》提出,深化与东盟国家“人工智能+反诈”合作,加快建设反电信诈骗领域垂直大模型,推动与东盟国家共同制定人工智能安全标准规范,探索建立国际知识产权规则风险及重点产业知识产权风险评估机制。", "answer": "对" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,在南宁、北海等地建设面向欧洲的人工智能时代影视基地。", "answer": "错" }, { "title": "《广西深入实施“人工智能+”三年行动方案(2026—2028年)》提出,探索人工智能在应急救援、观光旅游等低空经济场景应用。", "answer": "对" }, { "title": "位于广西凭祥市的中越“浦寨—新清”货运专用通道智慧口岸中方段是国内首个以无人驾驶集装箱运输卡车为核心、AI 智能调度为支撑的一体化智慧口岸通关平台。", "answer": "对" }, { "title": "当前,人工智能技术加速迭代演进,正从试验探索迈向价值创造阶段,引发经济社会各领域各行业深刻变革。", "answer": "对" } ] }; // 题库相似度匹配函数(Jaccard相似度) function calculateSimilarity(str1, str2) { const set1 = new Set(str1.replace(/[\s\n\r\t、,,。.;;::\"\'“”‘’()()【】\[\]]/g, '')); const set2 = new Set(str2.replace(/[\s\n\r\t、,,。.;;::\"\'“”‘’()()【】\[\]]/g, '')); const intersection = [...set1].filter(x => set2.has(x)).length; const union = set1.size + set2.size - intersection; return union === 0 ? 0 : intersection / union; } // 在题库中查找匹配的题目 function findQuestionInBank(questionText, questionType) { const USER_BANK_KEY = 'gk-user-question-bank'; const userBank = JSON.parse(localStorage.getItem(USER_BANK_KEY) || '{"single":[],"multiple":[],"boolean":[]}'); const builtInBank = QUESTION_BANK[questionType] || []; const userBankData = userBank[questionType] || []; const combinedBank = [...userBankData, ...builtInBank]; let bestMatch = null; let highestSimilarity = 0; for (const item of combinedBank) { const similarity = calculateSimilarity(questionText, item.title); if (similarity > highestSimilarity) { highestSimilarity = similarity; bestMatch = item; } } if (bestMatch && highestSimilarity > 0.80) { return { answer: bestMatch.answer, matchedQuestion: bestMatch, similarity: highestSimilarity }; } return null; } // 课程配置 // 修复:替换为用户提供的正确课程参数 const COURSE_CONFIG = [ { name: "人工智能基础理论与行业应用", lessonId: "2042554692796477440", tcLessonId: "2042557433763930112", lessonGkey: "2344ec6806e249d9bc2e5f148b577e5a", learnTime: 1069, thisTimeLearnSeconds: 60 }, { name: "北上广研发+广西集成+东盟应用”的理解与实践", lessonId: "2042555860431990784", tcLessonId: "2042557433864593408", lessonGkey: "d968b6298ed94821bc12011ce76ec21c", learnTime: 38, thisTimeLearnSeconds: 35 }, { name: "深入实施“人工智能+”行动,加快发展新质生产力", lessonId: "2042556317059616768", tcLessonId: "2042557433919119360", lessonGkey: "90c62e6cfb7547539b49f734826edb49", learnTime: 3, thisTimeLearnSeconds: 1 } ]; // AI服务商(完善请求参数模板) const AI_PROVIDERS = { moonshot:{ name:"月之暗面(Kimi)", api:"https://api.moonshot.cn/v1/chat/completions", getPayload: (key, prompt) => ({ model: "moonshot-v1-8k", messages: [{role: "user", content: prompt}], temperature: 0.3, max_tokens: 1000 }), getHeaders: (key) => ({ "Content-Type": "application/json", "Authorization": `Bearer ${key}` }) }, doubao:{ name:"字节豆包", api:"https://ark.cn-beijing.volces.com/api/v3/chat/completions", getPayload: (key, prompt) => ({ model: "doubao-pro", messages: [{role: "user", content: prompt}], temperature: 0.3 }), getHeaders: (key) => ({ "Content-Type": "application/json", "Authorization": `Bearer ${key}` }) }, deepseek:{ name:"DeepSeek", api:"https://api.deepseek.com/chat/completions", getPayload: (key, prompt) => ({ model: "deepseek-chat", messages: [{role: "user", content: prompt}], temperature: 0.3 }), getHeaders: (key) => ({ "Content-Type": "application/json", "Authorization": `Bearer ${key}` }) }, aliyun:{ name:"通义千问", api:"https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation", getPayload: (key, prompt) => ({ model: "qwen-turbo", input: {messages: [{role: "user", content: prompt}]}, parameters: {temperature: 0.3} }), getHeaders: (key) => ({ "Content-Type": "application/json", "Authorization": `Bearer ${key}` }) }, baidu:{ name:"文心一言", api:"https://aip.baidubce.com/rpc/2.0/wenxinworkshop/chat/ernie-turbo-8k", getPayload: (key, prompt) => ({ messages: [{role: "user", content: prompt}] }), getHeaders: (key) => ({ "Content-Type": "application/json" }), getUrl: (key, baseUrl) => `${baseUrl}?access_token=${key}` } }; // 全局变量 let isStopped = false; let logWindow = null; let answerTimer = null; let submitLock = false; let processedQuestions = new Set(); // 新增:面板状态变量 let panelCollapsed = false; // ===================== 样式优化 ===================== GM_addStyle(` /* 核心面板样式 - 修复对比度和按钮配色 */ #gk-panel{position:fixed;left:30px;top:30px;width:280px;z-index:99999999;background:rgba(255,255,255,0.98);border-radius:20px;box-shadow:0 8px 32px rgba(0,0,0,0.15);overflow:hidden;transition:all 0.2s ease;border:1px solid #e8f4ff;} #gk-head{padding:16px 20px;display:flex;justify-content:space-between;align-items:center;background:${CONFIG.BLUE};cursor:move;user-select:none;} #gk-collapse{background:none;border:none;font-size:18px;cursor:pointer;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:50%;transition:background 0.2s;color:#fff;} #gk-collapse:hover{background:rgba(255,255,255,0.2);} #gk-body{padding:15px;display:flex;flex-direction:column;gap:12px;} /* 修复面板标题样式 - 字号改为和按钮一致14px,保留加粗 */ #gk-title{font-size:14px;font-weight:700;color:#fff;margin:0;} /* 修复按钮样式 - 确保渐变背景生效,增加强制优先级 */ .gk-btn{padding:14px;border:none;border-radius:14px;color:#fff;font-weight:600;cursor:pointer;transition:all 0.2s;position:relative;overflow:hidden;font-size:14px;line-height:1;} .gk-btn:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,0.15);} .gk-btn:active{transform:translateY(0);} #gk-btn-account{background:linear-gradient(135deg,#22c55e,#10b981)!important;} #gk-btn-fast{background:linear-gradient(135deg,#1677ff,#5b7cfd)!important;} #gk-btn-answer-ai{background:linear-gradient(135deg,#8b5cf6,#ec4899)!important;} #gk-btn-config{background:linear-gradient(135deg,#64748b,#444)!important;} #gk-btn-bank{background:linear-gradient(135deg,#f59e0b,#d97706)!important;} /* 题库管理样式 */ .bank-tabs{display:flex;gap:8px;margin-bottom:15px;} .bank-tab{flex:1;padding:10px;border:none;border-radius:8px;background:#f0f0f0;color:#666;font-weight:600;cursor:pointer;transition:all 0.2s;} .bank-tab.active{background:linear-gradient(135deg,#f59e0b,#d97706);color:#fff;} .bank-tab:hover:not(.active){background:#e0e0e0;} .bank-list{max-height:300px;overflow-y:auto;border:1px solid #eee;border-radius:8px;margin-top:10px;} .bank-item{padding:12px;border-bottom:1px solid #eee;cursor:pointer;transition:background 0.2s;} .bank-item:last-child{border-bottom:none;} .bank-item:hover{background:#fff8f0;} .bank-item.selected{background:#fff3e0;border-left:3px solid #f59e0b;} .bank-item-title{font-size:13px;color:#333;margin-bottom:5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;} .bank-item-meta{font-size:11px;color:#999;} .bank-item-actions{float:right;display:flex;gap:5px;} .bank-item-actions button{padding:4px 8px;border:none;border-radius:4px;cursor:pointer;font-size:12px;} .bank-edit-btn{background:#1677ff;color:#fff;} .bank-delete-btn{background:#ff4d4f;color:#fff;} .bank-add-form{margin-top:15px;padding:15px;background:#fafafa;border-radius:8px;} .bank-form-group{margin-bottom:12px;} .bank-form-group label{display:block;margin-bottom:5px;font-weight:600;color:#333;font-size:13px;} .bank-form-group input,.bank-form-group select,.bank-form-group textarea{width:100%;padding:8px;border:1px solid #ddd;border-radius:6px;font-size:13px;box-sizing:border-box;} .bank-form-group textarea{min-height:60px;resize:vertical;} .bank-form-row{display:flex;gap:10px;} .bank-form-row .bank-form-group{flex:1;} .bank-question-type{display:inline-block;padding:3px 8px;background:#f59e0b;color:#fff;border-radius:4px;font-size:11px;} /* 小圆球样式优化 - 修复点击展开,图标白色 */ #gk-mini{position:fixed;left:30px;top:30px;width:50px;height:50px;background:linear-gradient(135deg,#1677ff,#5b7cfd);border-radius:50%;display:none;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 4px 15px rgba(0,0,0,0.2);transition:all 0.2s;z-index:99999999;} #gk-mini:hover{transform:scale(1.05);box-shadow:0 6px 20px rgba(0,0,0,0.3);} #gk-mini svg{fill:#ffffff!important;position:absolute;top:50%;left:50%;width:55%;height:55%;transform:translate(-50%, -50%);} /* 弹窗优化 - 提升层级到最高 + 弹窗容器相对定位(支持拖动) */ .gx-modal{position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:99999999;display:flex;align-items:center;justify-content:center;backdrop-filter:blur(2px);} .gx-modal-box{background:#fff;border-radius:16px;width:90%;max-width:500px;overflow:hidden;box-shadow:0 8px 24px rgba(0,0,0,0.15);position:absolute;z-index:99999999;} .gx-modal-header{padding:16px;position:relative;text-align:center;border-bottom:1px solid #f0f0f0;cursor:move;user-select:none;} .gx-modal-header h3{margin:0;font-size:18px;font-weight:600;color:#333;} .gx-modal-header button{position:absolute;right:16px;top:16px;background:none;border:none;font-size:16px;cursor:pointer;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:50%;transition:background 0.2s;} .gx-modal-header button:hover{background:#f5f5f5;} .gx-modal-body{padding:20px;} .gx-modal-footer{padding:16px;display:flex;gap:10px;border-top:1px solid #eee;background:#fafafa;} /* 账号表格优化 */ .account-table{width:100%;border-collapse:collapse;margin-top:10px;} .account-table th,.account-table td{padding:10px;text-align:center;border:1px solid #eee;} .account-table th{background:${CONFIG.LIGHT_BLUE};font-weight:600;} .account-table tr:hover{background:#f8f9fa;} /* 日志弹窗优化 - 提升层级,修复按钮样式 + 支持拖动 */ #log-window{position:fixed;right:20px;top:20px;width:420px;height:550px;background:#fff;border:1px solid ${CONFIG.BLUE};border-radius:16px;display:flex;flex-direction:column;z-index:99999999;box-shadow:0 8px 24px rgba(22,119,255,0.15);overflow:hidden;} #log-header{padding:14px;background:linear-gradient(135deg,${CONFIG.BLUE},#4096ff);color:#fff;text-align:center;font-weight:500;font-size:16px;display:flex;justify-content:center;align-items:center;cursor:move;user-select:none;gap:10px;} #log-progress{font-size:12px;background:rgba(255,255,255,0.2);padding:2px 8px;border-radius:10px;} #log-body{flex:1;padding:15px;overflow-y:auto;font-size:13px;line-height:1.6;background:#f8f9fa;} #log-body > div{margin-bottom:8px;padding:8px 12px;border-radius:8px;background:#fff;border-left:3px solid ${CONFIG.BLUE};box-shadow:0 1px 3px rgba(0,0,0,0.05);} #log-body .log-info{border-left-color:#1677ff;} #log-body .log-success{border-left-color:#52c41a;} #log-body .log-warning{border-left-color:#faad14;} #log-body .log-error{border-left-color:#ff4d4f;} /* 修复日志弹窗按钮样式 */ #log-footer{padding:12px;display:flex;gap:8px;border-top:1px solid #e8e8e8;background:#fff;flex-wrap:wrap;} #log-footer button{flex:1;min-width:80px;padding:10px;border:none;border-radius:8px;color:#fff;font-weight:600;cursor:pointer;transition:all 0.2s;} #stop-ai{background:linear-gradient(135deg,#ff4d4f,#ff7875)!important;} #stop-ai:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(255,77,79,0.2);} #continue-ai{background:linear-gradient(135deg,#52c41a,#73d13d)!important;display:none;} #continue-ai:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(82,196,26,0.2);} #check-progress{background:linear-gradient(135deg,#1677ff,#4096ff)!important;} #check-progress:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(22,119,255,0.2);} #close-log{background:linear-gradient(135deg,#8c8c8c,#a6a6a6)!important;} #close-log:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(140,140,140,0.2);} /* 加载状态样式 */ .loading{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(255,255,255,0.8);display:flex;align-items:center;justify-content:center;border-radius:14px;} .loading::after{content:'';width:20px;height:20px;border:2px solid #fff;border-top-color:transparent;border-radius:50%;animation:spin 0.8s linear infinite;} @keyframes spin {to{transform:rotate(360deg);}} /* 提示框优化 - 提升层级 */ #gk-tips{z-index:99999999!important;} #gk-tips > div{background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);z-index:99999999!important;} #gk-tips .tips-box{background:#fff;padding:25px;border-radius:16px;max-width:300px;text-align:center;box-shadow:0 8px 24px rgba(0,0,0,0.15);position:relative;z-index:99999999!important;} #gk-tips h3{margin:0 0 10px 0;font-size:18px;color:#333;} #gk-tips p{margin:0 0 15px 0;color:#666;} #gk-tips button{margin-top:10px;padding:8px 20px;background:#1677ff;color:#fff;border:none;border-radius:8px;cursor:pointer;transition:background 0.2s;} #gk-tips button:hover{background:#4096ff;} /* AI配置按钮样式 */ .ai-config-btn{flex:1;padding:10px;border:none;border-radius:8px;color:#fff;font-weight:600;cursor:pointer;transition:all 0.2s;} #ai-clear{background:linear-gradient(135deg,#ff4d4f,#ff7875)!important;} #ai-test{background:linear-gradient(135deg,#faad14,#ffc53d)!important;} #ai-save{background:linear-gradient(135deg,#1677ff,#4096ff)!important;} `); // ===================== 工具函数优化 ===================== const sleep = ms => new Promise(r => setTimeout(r, ms)); // Cookie获取优化(增加容错) // 修复:Cookie名称改为正确的'GXELA-Token'(大小写敏感) const getCookie = name => { try { const v = `; ${document.cookie}`; const p = v.split(`; ${name}=`); return p.length === 2 ? p.pop().split(';')[0].trim() : ''; } catch (e) { return ''; } }; // 当前课程获取优化 const getCurrentLesson = () => { try { const id = new URLSearchParams(location.search).get('lessonId'); return COURSE_CONFIG.find(i => i.lessonId === id) || COURSE_CONFIG[0]; } catch (e) { return COURSE_CONFIG[0]; } }; // 防抖函数(防重复点击) const debounce = (fn, delay) => { let timer = null; return (...args) => { if (timer) clearTimeout(timer); timer = setTimeout(() => fn.apply(this, args), delay); }; }; // 弹窗提示优化 function showModal(title, text, type = 'info') { // 移除旧提示 document.querySelectorAll('#gk-tips').forEach(i => i.remove()); const div = document.createElement('div'); div.id = 'gk-tips'; div.innerHTML = `

${title}

${text}

`; document.body.appendChild(div); // 自动关闭(成功提示3秒,错误提示5秒) const autoCloseTime = type === 'success' ? 3000 : type === 'error' ? 5000 : 4000; setTimeout(() => div.remove(), autoCloseTime); } // 拖动函数优化(防越界+平滑移动) function drag(handle, target) { if (!handle || !target) return; let isDragging = false; let startX, startY, initialX, initialY; handle.addEventListener('mousedown', (e) => { e.preventDefault(); isDragging = true; // 获取初始位置 startX = e.clientX; startY = e.clientY; initialX = target.offsetLeft; initialY = target.offsetTop; // 提升层级防止被遮挡 target.style.zIndex = 99999999; // 添加鼠标事件 document.addEventListener('mousemove', onMouseMove); document.addEventListener('mouseup', onMouseUp); }); const onMouseMove = (e) => { if (!isDragging) return; // 计算偏移 const dx = e.clientX - startX; const dy = e.clientY - startY; // 计算新位置(限制在可视区域内) const newX = Math.max(0, Math.min(initialX + dx, window.innerWidth - target.offsetWidth)); const newY = Math.max(0, Math.min(initialY + dy, window.innerHeight - target.offsetHeight)); // 应用新位置 target.style.left = `${newX}px`; target.style.top = `${newY}px`; }; const onMouseUp = () => { isDragging = false; target.style.zIndex = 99999999; document.removeEventListener('mousemove', onMouseMove); document.removeEventListener('mouseup', onMouseUp); }; } // 迷你面板拖动函数(限制在可视区域内) function dragMini(handle, panel) { if (!handle || !panel) return; let isDragging = false; let startX, startY, initialX, initialY; handle.addEventListener('mousedown', (e) => { isDragging = true; startX = e.clientX; startY = e.clientY; initialX = parseInt(handle.style.left) || 30; initialY = parseInt(handle.style.top) || 30; handle.style.zIndex = 99999999; document.addEventListener('mousemove', onMiniMove); document.addEventListener('mouseup', onMiniUp); }); const onMiniMove = (e) => { if (!isDragging) return; const dx = e.clientX - startX; const dy = e.clientY - startY; // 限制在可视区域内 const maxX = window.innerWidth - handle.offsetWidth; const maxY = window.innerHeight - handle.offsetHeight; const newX = Math.max(0, Math.min(initialX + dx, maxX)); const newY = Math.max(0, Math.min(initialY + dy, maxY)); handle.style.left = `${newX}px`; handle.style.top = `${newY}px`; }; const onMiniUp = () => { isDragging = false; handle.style.zIndex = 99999999; document.removeEventListener('mousemove', onMiniMove); document.removeEventListener('mouseup', onMiniUp); }; } // 提取题目内容 - 优化版 function extractQuestion() { try { // 针对广西公需科目考试系统的选择器 const questionTitleEl = document.querySelector('.question_title'); if (!questionTitleEl) return null; const questionText = questionTitleEl.textContent.trim(); // 从题目文本中提取题号 let questionNum = 1; const numMatch = questionText.match(/^(\d+)\s*[、.]\s*/); if (numMatch) { questionNum = parseInt(numMatch[1]); } // 根据题号判断题目类型 let questionType = 'single'; if (questionNum >= 1 && questionNum <= 40) { questionType = 'single'; // 单选题 } else if (questionNum >= 41 && questionNum <= 60) { questionType = 'multiple'; // 多选题 } else if (questionNum >= 61 && questionNum <= 80) { questionType = 'boolean'; // 判断题 } // 获取选项 const answerList = document.querySelector('.question_answer_list'); if (!answerList) return null; const answerItems = answerList.querySelectorAll('.question_answer_item'); const options = []; answerItems.forEach(item => { const text = item.textContent.trim(); if (text) options.push(text); }); if (options.length === 0) return null; // 生成题目ID - 使用Unicode安全的Base64编码 const questionId = btoa(encodeURIComponent(questionText.substring(0, 60) + '_' + questionNum)); return { id: questionId, num: questionNum, type: questionType, text: questionText, options: options, fullText: questionText + '\n选项:' + options.join('\n') }; } catch (e) { addLog('提取题目失败:' + e.message, 'log-error'); return null; } } // 调用AI接口获取答案 - 优化版 async function getAIAnswer(question) { try { const cfg = JSON.parse(localStorage.getItem('gk-ai') || '{"provider":"moonshot","key":""}'); if (!cfg.key) { addLog('未配置AI API Key,请先在AI配置中设置', 'log-warning'); return null; } const provider = AI_PROVIDERS[cfg.provider] || AI_PROVIDERS.moonshot; // 构建提示词 - 针对广西公需科目深度优化 const optionsText = question.options.map((opt, idx) => String.fromCharCode(65 + idx) + '. ' + opt ).join('\n'); let typeDescription = ''; let formatHint = ''; if (question.type === 'single') { typeDescription = '单选题(只有一个正确答案)'; formatHint = '请只返回正确选项的字母(如A、B、C、D),不要任何其他内容。'; } else if (question.type === 'multiple') { typeDescription = '多选题(可能有2-4个正确答案)'; formatHint = '请返回所有正确选项的字母组合(如AB、ACD),不要加空格或其他分隔符。'; } else if (question.type === 'boolean') { typeDescription = '判断题'; formatHint = '如果题目表述正确,请返回"对";如果错误,请返回"错"。只返回"对"或"错"。'; } const prompt = '【广西公需科目考试·AI答题系统】\n' + '这是一个重要的考试题目,请务必仔细阅读并给出正确答案!\n\n' + '【题目类型】' + typeDescription + '\n' + '【题目标号】第' + question.num + '题\n\n' + '【题目内容】\n' + question.text + '\n\n' + '【可选选项】\n' + optionsText + '\n\n' + '【答题要求】\n' + '1. 你是一位广西公需科目考试专家,精通人工智能、广西区情、政策法规等知识\n' + '2. 请基于你的专业知识,仔细分析每个选项,找出最符合题意的正确答案\n' + '3. 注意:绝对化表述(如"必须"、"一定"、"全部")往往是错误选项\n' + '4. 多选题可能有多个正确答案,请全部找出,不要遗漏也不要多选\n' + '5. 答题时请参考广西公需科目考试的常见正确选项特征\n\n' + '【格式要求】\n' + formatHint + '\n\n' + '【重要警告】\n' + '- 只返回答案,不要返回解释、说明、分析等任何多余内容\n' + '- 不要添加任何前缀或后缀,只返回要求的内容\n' + '- 你的答案将直接影响用户的考试成绩,请务必保证正确性!'; // 构建请求参数 let url = provider.getUrl ? provider.getUrl(cfg.key, provider.api) : provider.api; const payload = provider.getPayload(cfg.key, prompt); const headers = provider.getHeaders(cfg.key); // 发起请求 return new Promise((resolve, reject) => { const timeout = setTimeout(() => { reject(new Error('AI请求超时')); }, CONFIG.AI_TIMEOUT); GM_xmlhttpRequest({ method: 'POST', url: url, headers: headers, data: JSON.stringify(payload), onload: (res) => { clearTimeout(timeout); try { const data = JSON.parse(res.responseText); let answer = ''; if (cfg.provider === 'aliyun') { answer = data.output?.text || ''; } else if (cfg.provider === 'baidu') { answer = data.result || ''; } else { answer = data.choices?.[0]?.message?.content || ''; } resolve(answer.trim()); } catch (e) { reject(new Error('解析AI响应失败')); } }, onerror: (err) => { clearTimeout(timeout); reject(new Error('AI请求失败:' + err.status)); } }); }); } catch (e) { addLog('获取AI答案失败:' + e.message, 'log-error'); return null; } } // 根据AI答案选择选项 - 优化版 async function selectAnswer(question, answer, matchedBankItem = null) { try { if (!answer) return false; addLog('🤖 AI原始返回:' + answer, 'log-info'); // 获取选项元素 const answerContainer = document.querySelector('.question_answer_list'); if (!answerContainer) return false; const answerItems = answerContainer.querySelectorAll('.question_answer_item'); if (answerItems.length === 0) return false; // 智能解析答案 let cleanAnswer = answer.trim(); let selectedIndexes = []; // 移除所有可能的前缀和后缀 const prefixes = ['正确答案是', '答案是', '应该选', '选', '正确选项:', '答案:', '答:', '回答:', '正确答案为', '答案为', '我认为', '根据分析', '综上', '因此']; prefixes.forEach(prefix => { cleanAnswer = cleanAnswer.replace(new RegExp('^' + prefix, 'i'), ''); }); cleanAnswer = cleanAnswer.replace(/[\s\n\r\t、,,。.;;::\"\'“”‘’()()【】\[\]]/g, ''); cleanAnswer = cleanAnswer.toUpperCase(); // 答案映射 const answerMap = { 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4 }; // 如果有题库匹配项,使用基于内容的匹配 if (matchedBankItem && matchedBankItem.options) { const bankOptions = matchedBankItem.options; const pageOptions = []; answerItems.forEach(item => { const text = item.textContent.trim(); pageOptions.push(text); }); const answerLetters = []; for (const char of cleanAnswer) { if (answerMap[char] !== undefined) { answerLetters.push(char.toUpperCase()); } } for (const letter of answerLetters) { const bankAnswerIndex = answerMap[letter]; if (bankAnswerIndex !== undefined && bankAnswerIndex < bankOptions.length) { const bankAnswerContent = bankOptions[bankAnswerIndex]; let found = false; for (let i = 0; i < pageOptions.length; i++) { if (pageOptions[i].includes(bankAnswerContent) || bankAnswerContent.includes(pageOptions[i])) { selectedIndexes.push(i); found = true; break; } } if (!found) { for (let i = 0; i < pageOptions.length; i++) { const similarity = calculateSimilarity(pageOptions[i], bankAnswerContent); if (similarity > 0.6) { selectedIndexes.push(i); break; } } } } } selectedIndexes = [...new Set(selectedIndexes)]; if (selectedIndexes.length > 0) { addLog('✅ 基于内容匹配:选项 ' + selectedIndexes.map(i => String.fromCharCode(65 + i)).join(''), 'log-success'); } } else if (question.type === 'boolean') { if (cleanAnswer.includes('对') || cleanAnswer.includes('正确') || cleanAnswer.includes('A') || cleanAnswer.includes('YES') || cleanAnswer.includes('TRUE') || cleanAnswer === '是') { selectedIndexes = [0]; } else if (cleanAnswer.includes('错') || cleanAnswer.includes('错误') || cleanAnswer.includes('B') || cleanAnswer.includes('NO') || cleanAnswer.includes('FALSE') || cleanAnswer === '否') { selectedIndexes = [1]; } } else { // 单选题和多选题处理 for (const char of cleanAnswer) { if (answerMap[char] !== undefined) { selectedIndexes.push(answerMap[char]); } } // 去重 selectedIndexes = [...new Set(selectedIndexes)]; } // 如果没有解析到答案,做最后的尝试 if (selectedIndexes.length === 0) { if (question.type === 'single') { selectedIndexes = [0]; // 默认选A } else if (question.type === 'boolean') { selectedIndexes = [0]; // 默认选"对" } } addLog('✅ 解析结果:选项 ' + selectedIndexes.map(i => String.fromCharCode(65 + i)).join(''), 'log-success'); // 选择选项 for (const idx of selectedIndexes) { if (idx >= answerItems.length) continue; const item = answerItems[idx]; const input = item.querySelector('input[type="radio"], input[type="checkbox"]'); if (input) { input.checked = true; // 触发事件,确保被识别 input.dispatchEvent(new Event('change', { bubbles: true })); input.dispatchEvent(new Event('click', { bubbles: true })); } await new Promise(resolve => setTimeout(resolve, 300)); // 每个选项间隔 } addLog('已选择答案:' + selectedIndexes.map(i => String.fromCharCode(65 + i)).join(''), 'log-success'); return true; } catch (e) { addLog('选择答案失败:' + e.message, 'log-error'); return false; } } // ===================== 一键秒学优化 ===================== const fastStudy = debounce(async function() { // 加载状态 const btn = document.getElementById('gk-btn-fast'); btn.innerHTML = '
处理中...'; btn.disabled = true; try { // 修复:Cookie名称改为正确的'GXELA-Token'(首字母大写) const token = getCookie('GXELA-Token'); const lesson = getCurrentLesson(); // 验证 if (!token) { showModal('错误', '未检测到登录状态,请先登录', 'error'); return; } if (!lesson) { showModal('错误', '未识别到当前课程,请在课程学习页面使用', 'error'); return; } addLog(`开始提交课程进度:${lesson.name}`, 'log-info'); // 提交进度 GM_xmlhttpRequest({ method: 'POST', url: CONFIG.API_URL, headers: { 'Content-Type': 'application/json;charset=UTF-8', // 修复:补充charset 'Authorization': `Bearer ${token}`, 'clientid': CONFIG.CLIENT_ID, // 修复:补充缺失的请求头(成功请求必须的) 'Origin': 'https://gxjxjy.rst.gxzf.gov.cn', 'platform': 'web', 'Referer': window.location.href }, data: JSON.stringify({ lessonId: lesson.lessonId, lessonGkey: lesson.lessonGkey, // 修复:参数名从origin改为lessonOrigin,值从train改为trainclass lessonOrigin: "trainclass", tcLessonId: lesson.tcLessonId, learnTime: lesson.learnTime, progress: 100, thisTimeLearnSeconds: lesson.thisTimeLearnSeconds }), onload: (res) => { try { const data = JSON.parse(res.responseText); // 修复:兼容code===200的判断逻辑 if (res.status === 200 && (data.success || data.code === 200)) { showModal('成功', '学习进度提交成功!即将返回课程列表', 'success'); addLog('课程进度提交成功', 'log-success'); setTimeout(() => location.href = CONFIG.CLASS_URL, 1500); } else { showModal('失败', `提交失败:${data.msg || data.message || '未知错误'}`, 'error'); addLog(`提交失败:${data.msg || data.message || '未知错误'}`, 'log-error'); } } catch (e) { // 兼容解析失败但实际提交成功的情况 showModal('成功', '进度已提交,即将返回课程列表', 'success'); addLog('响应解析失败,但请求已发送', 'log-warning'); setTimeout(() => location.href = CONFIG.CLASS_URL, 1500); } }, onerror: (err) => { showModal('失败', `网络请求失败:${err.status || '未知状态'}`, 'error'); addLog(`网络请求失败:${err.status || '未知状态'}`, 'log-error'); }, onabort: () => { showModal('取消', '请求已取消', 'warning'); addLog('请求已取消', 'log-warning'); } }); } catch (e) { showModal('异常', `执行失败:${e.message}`, 'error'); addLog(`执行异常:${e.message}`, 'log-error'); } finally { // 恢复按钮状态 setTimeout(() => { btn.innerHTML = '⚡ 一键秒学'; btn.disabled = false; }, CONFIG.SUBMIT_PROTECT); } }, CONFIG.SUBMIT_PROTECT); // ===================== 账号管理优化 ===================== function showAccountModal() { if (document.querySelector('.gx-modal')) return; const accounts = JSON.parse(GM_getValue('gk-accounts', '[]')); const modal = document.createElement('div'); modal.className = 'gx-modal'; modal.innerHTML = `

👤 学习账号管理

`; document.body.appendChild(modal); renderAccounts(accounts); // 绑定账号管理弹窗拖动 const accountHeader = modal.querySelector('.gx-modal-header'); const accountBox = modal.querySelector('.gx-modal-box'); drag(accountHeader, accountBox); // 下载模板 document.getElementById('gk-template').onclick = () => { const ws = XLSX.utils.json_to_sheet([{姓名:'',身份证号:'',密码:''}]); const wb = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, '账号'); XLSX.writeFile(wb, '公需科目账号模板.xlsx'); }; // 导入Excel功能 document.getElementById('gk-import').onclick = function() { const input = document.createElement('input'); input.type = 'file'; input.accept = '.xlsx,.xls'; input.style.display = 'none'; document.body.appendChild(input); input.onchange = function(e) { const file = e.target.files[0]; if (!file) { document.body.removeChild(input); return; } const reader = new FileReader(); reader.onload = function(e) { try { const data = new Uint8Array(e.target.result); const workbook = XLSX.read(data, { type: 'array' }); const firstSheetName = workbook.SheetNames[0]; const worksheet = workbook.Sheets[firstSheetName]; const jsonData = XLSX.utils.sheet_to_json(worksheet); if (!Array.isArray(jsonData) || jsonData.length === 0) { showModal('提示', 'Excel文件中未读取到有效数据', 'warning'); return; } const list = JSON.parse(GM_getValue('gk-accounts', '[]')); const ids = new Set(list.map(i => i.user)); const newList = []; jsonData.forEach(item => { const name = item.姓名 || item.name || ''; const user = item.身份证号 || item.身份证 || item.user || ''; const pwd = item.密码 || item.pwd || item.password || ''; if (!name || !user || !pwd) return; if (ids.has(user)) return; newList.push({ id: Date.now() + Math.floor(Math.random() * 1000), name: name.trim(), user: user.trim(), pwd: pwd.trim() }); }); if (newList.length === 0) { showModal('提示', '无新账号可导入(或账号已存在/数据不完整)', 'warning'); return; } list.push(...newList); GM_setValue('gk-accounts', JSON.stringify(list)); renderAccounts(list); showModal('成功', `成功导入 ${newList.length} 个账号`, 'success'); } catch (e) { showModal('错误', `导入失败:${e.message}`, 'error'); console.error('导入Excel错误:', e); } finally { document.body.removeChild(input); } }; reader.readAsArrayBuffer(file); }; input.click(); }; // 清空账号 document.getElementById('gk-clear').onclick = () => { if (confirm('确定清空所有账号?此操作不可恢复!')) { GM_setValue('gk-accounts', '[]'); renderAccounts([]); showModal('成功', '账号已清空', 'success'); } }; // 关闭弹窗 modal.querySelector('button').onclick = () => modal.remove(); modal.addEventListener('click', (e) => { if (e.target === modal) modal.remove(); }); } // 渲染账号(仅修复此处填充逻辑) function renderAccounts(list) { const el = document.getElementById('account-list'); if (list.length === 0) { el.innerHTML = '暂无账号'; return; } el.innerHTML = list.map(i => ` ${i.name} ${i.user} ${i.pwd.replace(/./g, '*')} `).join(''); // 绑定删除事件 el.querySelectorAll('.delete-account').forEach(btn => { btn.onclick = function(e) { e.stopPropagation(); const tr = this.closest('tr'); const id = tr.dataset.id; const newList = list.filter(i => i.id != id); GM_setValue('gk-accounts', JSON.stringify(newList)); renderAccounts(newList); showModal('成功', '账号已删除', 'success'); }; }); // 绑定行点击事件(核心修复:账号密码填充) el.querySelectorAll('tr').forEach(tr => { tr.addEventListener('click', (e) => { if (e.target.classList.contains('delete-account')) return; const acc = list.find(i => i.id == tr.dataset.id); // 将账号密码保存到localStorage,供登录页使用 localStorage.setItem('gk-login-user', acc.user); localStorage.setItem('gk-login-pwd', acc.pwd); localStorage.setItem('gk-login-need-fill', 'true'); document.querySelector('.gx-modal').remove(); window.open(CONFIG.LOGIN_URL, '_self'); }); }); } // ===================== 日志功能 ===================== function addLog(text, className = 'log-info') { if (!logWindow) return; const logBody = logWindow.querySelector('#log-body'); const logItem = document.createElement('div'); logItem.className = className; logItem.textContent = `[${new Date().toLocaleTimeString()}] ${text}`; logBody.appendChild(logItem); logBody.scrollTop = logBody.scrollHeight; updateProgressDisplay(); } // 更新进度显示 function updateProgressDisplay() { if (!logWindow) return; const progressEl = logWindow.querySelector('#log-progress'); if (progressEl) { progressEl.textContent = `${window.answeredCount || 0}/80`; } } // 检测已答题目数量(包括手动答题) function detectAnsweredCount() { let count = 0; try { // 检查当前页面是否有选中的答案 const checkedRadios = document.querySelectorAll('input[type="radio"]:checked'); const checkedCheckboxes = document.querySelectorAll('input[type="checkbox"]:checked'); // 如果当前页面有选中的选项,说明当前题已答 if (checkedRadios.length > 0 || checkedCheckboxes.length > 0) { count++; } // 检查题目导航进度条(如果存在) const progressBar = document.querySelector('.progress-bar, .exam-progress, [class*="progress"]'); if (progressBar) { const progressText = progressBar.textContent || ''; const match = progressText.match(/(\d+)\/(\d+)/); if (match) { count = parseInt(match[1]) || count; } } } catch (e) { console.log('检测已答题目数量失败:', e); } return count; } // 更新按钮状态显示 function updateButtonState() { if (!logWindow) return; const stopBtn = logWindow.querySelector('#stop-ai'); const continueBtn = logWindow.querySelector('#continue-ai'); if (!stopBtn || !continueBtn) return; if (window.isStopped) { stopBtn.style.display = 'none'; continueBtn.style.display = 'block'; } else { stopBtn.style.display = 'block'; continueBtn.style.display = 'none'; } } // 检查是否完成所有题目 function checkCompletion() { // 重置模式下也检查是否已答满80题,答满则正常触发完成 if (window.isResetting && (window.answeredCount || 0) < 80) { return; // 重置模式且未答满80题,跳过检测 } // 获取当前题目编号 const currentQNum = window.currentQuestionNum || 0; // 只有当前题目是第80题且已作答,才触发完成 // 如果当前题目小于80,说明还有题目未处理,不触发完成 if (currentQNum < 80) { return; } // 以下是正常流程或重置模式已答满80题的流程 if (window.isResetting && (window.answeredCount || 0) >= 80) { // 重置模式下答满80题,触发完成并清除重置标志 window.isResetting = false; addLog('🎉🎉🎉 所有题目已完成!', 'log-success'); // 显示答题统计 const bankCount = (window.bankAnswerList || []).length; const aiCount = (window.aiAnswerList || []).length; const bankList = (window.bankAnswerList || []).sort((a,b) => a-b).join('、'); const aiList = (window.aiAnswerList || []).sort((a,b) => a-b).join('、'); addLog(`📊 答题统计:题库答题${bankCount}题,AI答题${aiCount}题`, 'log-info'); if (bankCount > 0) addLog(`📚 题库答题题目:${bankList}`, 'log-info'); if (aiCount > 0) addLog(`🤖 AI答题题目:${aiList}`, 'log-info'); addLog('📋 请手动检查试卷并点击交卷按钮提交试卷', 'log-success'); showModal('🎉 答题完成!', `已完成80道题目作答\n\n📚 题库答题:${bankCount}题\n🤖 AI答题:${aiCount}题\n\n请仔细检查后手动点击"交卷"按钮提交答案!`, 'success'); window.isStopped = true; if (window.answerTimer) { clearInterval(window.answerTimer); window.answerTimer = null; } updateButtonState(); return; } // 检测当前已答题目数量(包括手动答题) const detectedCount = detectAnsweredCount(); const totalAnswered = Math.max(detectedCount, window.answeredCount || 0); // 更新进度 if (totalAnswered > (window.answeredCount || 0)) { window.answeredCount = totalAnswered; } // 检查是否完成所有题目(必须当前题目是第80题) if ((window.answeredCount || 0) >= 80 && currentQNum >= 80) { addLog('🎉🎉🎉 所有题目已完成!', 'log-success'); // 显示答题统计 const bankCount = (window.bankAnswerList || []).length; const aiCount = (window.aiAnswerList || []).length; const bankList = (window.bankAnswerList || []).sort((a,b) => a-b).join('、'); const aiList = (window.aiAnswerList || []).sort((a,b) => a-b).join('、'); addLog(`📊 答题统计:题库答题${bankCount}题,AI答题${aiCount}题`, 'log-info'); if (bankCount > 0) addLog(`📚 题库答题题目:${bankList}`, 'log-info'); if (aiCount > 0) addLog(`🤖 AI答题题目:${aiList}`, 'log-info'); addLog('📋 请手动检查试卷并点击交卷按钮提交试卷', 'log-success'); showModal('🎉 答题完成!', `已完成80道题目作答\n\n📚 题库答题:${bankCount}题\n🤖 AI答题:${aiCount}题\n\n请仔细检查后手动点击"交卷"按钮提交答案!`, 'success'); window.isStopped = true; if (window.answerTimer) { clearInterval(window.answerTimer); window.answerTimer = null; } // 更新按钮状态 updateButtonState(); } } // 初始化日志窗口 function initLogWindow() { if (logWindow) { // 如果日志窗口已存在,显示它并同步按钮状态 logWindow.style.display = 'flex'; updateButtonState(); return; } logWindow = document.createElement('div'); logWindow.id = 'log-window'; logWindow.innerHTML = `
📝 AI答题日志 0/80
`; document.body.appendChild(logWindow); // 绑定日志窗口拖动 drag(logWindow.querySelector('#log-header'), logWindow); // 查看进度 const checkProgressBtn = logWindow.querySelector('#check-progress'); if (checkProgressBtn) { checkProgressBtn.onclick = () => { const currentQ = window.currentQuestionNum || 0; const answered = window.answeredCount || 0; const remaining = 80 - answered; addLog(`📊 当前进度:已答${answered}题,当前第${currentQ}题,还剩${remaining}题`, 'log-info'); showModal('答题进度', `已作答:${answered}题\n剩余:${remaining}题\n当前:第${currentQ}题`, 'info'); }; } // 停止答题 const stopBtn = logWindow.querySelector('#stop-ai'); if (stopBtn) { stopBtn.onclick = () => { window.isStopped = true; window.isWaitingForNextQuestion = false; window.isResetting = false; // 清除重置模式 if (window.answerTimer) { clearInterval(window.answerTimer); window.answerTimer = null; } stopBtn.style.display = 'none'; const continueBtn = logWindow.querySelector('#continue-ai'); if (continueBtn) continueBtn.style.display = 'block'; addLog('🛑 已停止自动答题', 'log-warning'); }; } // 继续答题 const continueBtn = logWindow.querySelector('#continue-ai'); if (continueBtn) { continueBtn.onclick = () => { window.isStopped = false; window.isWaitingForNextQuestion = false; window.submitLock = false; window.answeredCount = 0; window.processedQuestions = new Set(); window.bankAnswerList = []; // 重置题库答题统计 window.aiAnswerList = []; // 重置AI答题统计 window.isResetting = true; // 标记为重置模式,允许重新答题 continueBtn.style.display = 'none'; if (stopBtn) stopBtn.style.display = 'block'; addLog('▶️ 已恢复自动答题', 'log-success'); addLog('🔄 已重置答题状态,可以重新答题', 'log-info'); autoAnswerAI(); }; } // 收起日志(不停止答题) const closeBtn = logWindow.querySelector('#close-log'); if (closeBtn) { closeBtn.onclick = () => { // 只隐藏窗口,不停止答题 logWindow.style.display = 'none'; addLog('🔽 日志窗口已收起', 'log-info'); }; } // 初始化按钮状态 updateButtonState(); } // 重置AI答题状态 function resetAIState() { window.isStopped = false; window.submitLock = false; window.currentQuestionNum = 0; window.answeredCount = 0; window.isWaitingForNextQuestion = false; // 不使用clear(),直接重新创建Set,避免兼容性问题 window.processedQuestions = new Set(); // 重置答题统计 window.bankAnswerList = []; window.aiAnswerList = []; if (window.answerTimer) clearInterval(window.answerTimer); } // 导航到指定题号(用于重新答题) function navigateToQuestion(num) { const selectors = [ `.question-item[data-num="${num}"]`, `.question-item[data-question="${num}"]`, `.question-nav-item[data-num="${num}"]`, `.question-list-item[data-num="${num}"]`, `button.question-num[data-num="${num}"]`, `a.question-num[data-num="${num}"]`, `.question-item:nth-child(${num})`, `.question-nav li:nth-child(${num})`, `.question-list li:nth-child(${num})`, `[class*="question"][data-index="${num - 1}"]`, `[class*="question"][data-num="${num}"]`, `.item-${num}`, `#question-${num}`, `#q${num}`, `.q${num}` ]; for (const selector of selectors) { try { const el = document.querySelector(selector); if (el) { el.click(); addLog(`📍 已导航到第${num}题`, 'log-info'); return true; } } catch (e) {} } // 尝试查找包含题号的元素(通用模式) const allQuestionElements = document.querySelectorAll('[class*="question"], [class*="item"], li, a, button, span'); for (const el of allQuestionElements) { const text = el.textContent.trim(); if (text === String(num) || text === ` ${num} ` || text === `${num}、` || text === `${num}.`) { if (el.offsetParent !== null) { // is visible el.click(); addLog(`📍 已导航到第${num}题`, 'log-info'); return true; } } } addLog(`⚠️ 未找到第${num}题导航按钮,请手动选择`, 'log-warning'); return false; } // ===================== AI自动答题(重写) ===================== async function autoAnswerAI() { initLogWindow(); addLog('🤖 AI自动答题已启动', 'log-info'); addLog('📋 系统将自动识别题目并答题', 'log-info'); addLog('💡 支持从任意题目开始答题', 'log-info'); // 确保变量都初始化 if (typeof window.processedQuestions === 'undefined') { window.processedQuestions = new Set(); } if (typeof window.currentQuestionNum === 'undefined') { window.currentQuestionNum = 0; } if (typeof window.answeredCount === 'undefined') { window.answeredCount = 0; } if (typeof window.submitLock === 'undefined') { window.submitLock = false; } // 答题统计 if (typeof window.bankAnswerList === 'undefined') { window.bankAnswerList = []; // 题库答题题目编号列表 } if (typeof window.aiAnswerList === 'undefined') { window.aiAnswerList = []; // AI答题题目编号列表 } // 检测已答题目数量(包括手动答题)- 重置模式下跳过 if (!window.isResetting) { const detectedCount = detectAnsweredCount(); if (detectedCount > 0 && detectedCount > window.answeredCount) { window.answeredCount = detectedCount; addLog(`🔍 检测到已答${detectedCount}题,已同步到进度`, 'log-info'); } // 如果已答80题,停止自动答题,等待用户手动操作 if (window.answeredCount >= 80) { addLog('✅ 已完成所有题目,停止自动答题', 'log-success'); addLog('📋 如需重新答题,请手动点击"继续"按钮', 'log-info'); window.isStopped = true; updateButtonState(); return; } } else { addLog('🔄 重置模式:忽略已答检测,重新开始答题', 'log-info'); // 不在这里清除isResetting,保持重置模式直到答题完成或用户停止 } if (window.answerTimer) clearInterval(window.answerTimer); // 主循环:定时检测和答题 window.answerTimer = setInterval(async () => { if (window.isStopped || window.isWaitingForNextQuestion) return; try { // 防止重复提交 if (window.submitLock) return; // 提取当前题目 const question = extractQuestion(); if (!question) { // 没有检测到题目,可能是页面还没加载好 return; } // 如果题目编号变了,说明进入了新题目 if (window.currentQuestionNum !== question.num) { window.currentQuestionNum = question.num; addLog(`📝 检测到第${question.num}题(${question.type === 'single' ? '单选题' : question.type === 'multiple' ? '多选题' : '判断题'})`, 'log-info'); } // 检查是否已答过此题 if (window.processedQuestions.has(question.id)) { // 已答过,直接返回 return; } // 计算剩余题目数 const remainingQuestions = 80 - window.answeredCount - 1; // 标记为已处理 window.processedQuestions.add(question.id); window.submitLock = true; addLog(`🤔 正在分析第${question.num}题答案...(还剩${remainingQuestions > 0 ? remainingQuestions : 0}题)`, 'log-info'); // 优先从题库中查找答案 const bankResult = findQuestionInBank(question.text, question.type); let answer = null; let matchedBankItem = null; if (bankResult) { answer = bankResult.answer; matchedBankItem = bankResult.matchedQuestion; addLog(`📚 题库匹配成功!相似度:${(bankResult.similarity * 100).toFixed(2)}%`, 'log-success'); } // 如果题库中没有找到匹配的答案,调用AI获取答案 if (!answer) { addLog(`🔍 题库未匹配到题目,调用AI获取答案...`, 'log-info'); answer = await getAIAnswer(question); } if (answer) { // 根据答案来源记录不同的日志和统计 if (matchedBankItem) { addLog(`📚 题库答案:${answer}`, 'log-success'); window.bankAnswerList.push(question.num); // 记录题库答题 } else { addLog(`🤖 AI返回答案:${answer}`, 'log-info'); window.aiAnswerList.push(question.num); // 记录AI答题 } // 选择答案(传递题库匹配项用于内容匹配) const success = await selectAnswer(question, answer, matchedBankItem); if (success) { // 使用题目编号更新answeredCount,避免计数错误 window.answeredCount = Math.max(window.answeredCount, question.num); const remaining = 80 - window.answeredCount; addLog(`✅ 第${question.num}题已作答(已完成${window.answeredCount}题,还剩${remaining}题)`, 'log-success'); // 根据题型处理提交逻辑 if (question.type === 'multiple') { // 多选题:需要点击提交按钮(selectAnswer已完成所有选项选择) window.isWaitingForNextQuestion = true; setTimeout(() => { // 使用更精确的按钮选择器 const answerContainer = document.querySelector('.question_answer_list'); let submitBtn = null; if (answerContainer) { const allButtons = answerContainer.querySelectorAll('button'); for (const btn of allButtons) { if (btn.textContent && (btn.textContent.includes('提交') || btn.textContent.trim() !== '')) { submitBtn = btn; break; } } } if (submitBtn) { submitBtn.click(); addLog('📤 已提交多选题答案', 'log-info'); } else { addLog('⚠️ 未找到提交按钮', 'log-warning'); } // 等待页面跳转 setTimeout(() => { window.isWaitingForNextQuestion = false; // 检查是否完成(包括手动答题) checkCompletion(); }, 3000); }, 500); // 短暂延迟后提交 } else { // 单选题/判断题:选中答案后自动跳转,等待新题目 window.isWaitingForNextQuestion = true; setTimeout(() => { window.isWaitingForNextQuestion = false; // 检查是否完成(包括手动答题) checkCompletion(); }, 2000); } } } else { addLog('⚠️ AI未返回有效答案,随机选择', 'log-warning'); // 随机选第一个 await selectAnswer(question, 'A'); } window.submitLock = false; } catch (e) { addLog(`❌ 答题异常:${e.message}`, 'log-error'); window.submitLock = false; window.isWaitingForNextQuestion = false; } }, 1000); // 降低检测间隔,提高响应速度 } // ===================== 题库管理 ===================== function showBankManagementModal() { if (document.querySelector('.gx-modal')) return; const USER_BANK_KEY = 'gk-user-question-bank'; let userBank = JSON.parse(localStorage.getItem(USER_BANK_KEY) || '{"single":[],"multiple":[],"boolean":[]}'); let currentTab = 'single'; let editingIndex = null; const modal = document.createElement('div'); modal.className = 'gx-modal'; modal.innerHTML = `

📚 题库管理

内置题库:0题 | 用户添加:0题

➕ 添加新题目

`; document.body.appendChild(modal); const bankHeader = modal.querySelector('.gx-modal-header'); const bankBox = modal.querySelector('.gx-modal-box'); drag(bankHeader, bankBox); const bankList = document.getElementById('bank-list'); const tabs = modal.querySelectorAll('.bank-tab'); const statInfo = document.getElementById('bank-stat-info'); const optionsGroup = document.getElementById('bank-options-group'); const formTitle = document.getElementById('bank-form-title'); const editBtns = document.getElementById('bank-form-edit-btns'); const saveBtn = document.getElementById('bank-save-btn'); function getTypeLabel(type) { return type === 'single' ? '单选' : type === 'multiple' ? '多选' : '判断'; } function getBuiltinCount(type) { return (QUESTION_BANK[type] || []).length; } function getUserCount(type) { return (userBank[type] || []).length; } function updateStats() { const builtIn = getBuiltinCount(currentTab); const userCount = getUserCount(currentTab); statInfo.textContent = `内置题库:${builtIn}题 | 用户添加:${userCount}题`; } function renderBankList() { const userItems = userBank[currentTab] || []; const builtInItems = QUESTION_BANK[currentTab] || []; let html = ''; if (userItems.length > 0) { html += '
用户添加题目
'; userItems.forEach((item, index) => { const answerText = currentTab === 'boolean' ? item.answer : item.answer; html += `
${item.title}
${getTypeLabel(currentTab)} ${currentTab !== 'boolean' ? ` | 选项:${item.options ? item.options.length : 0}个` : ''} | 答案:${answerText}
`; }); } if (builtInItems.length > 0) { html += '
内置题目(仅查看)
'; builtInItems.slice(0, 20).forEach((item, index) => { const answerText = currentTab === 'boolean' ? item.answer : item.answer; html += `
${item.title}
${getTypeLabel(currentTab)} ${currentTab !== 'boolean' ? ` | 选项:${item.options ? item.options.length : 0}个` : ''} | 答案:${answerText}
`; }); if (builtInItems.length > 20) { html += `
...还有${builtInItems.length - 20}题未显示
`; } } if (html === '') { html = '
暂无题目,点击下方表单添加
'; } bankList.innerHTML = html; updateStats(); } function validateForm() { const title = document.getElementById('bank-title').value.trim(); const answer = document.getElementById('bank-answer').value.trim(); if (!title) { showModal('提示', '请输入题目内容', 'warning'); return false; } if (!answer) { showModal('提示', '请输入答案', 'warning'); return false; } if (currentTab !== 'boolean') { const options = document.getElementById('bank-options').value.trim(); if (!options) { showModal('提示', '请输入选项', 'warning'); return false; } } return true; } function saveQuestion() { if (!validateForm()) return; const title = document.getElementById('bank-title').value.trim(); const answer = document.getElementById('bank-answer').value.trim().toUpperCase(); const question = { title: title, answer: answer }; if (currentTab !== 'boolean') { const optionsText = document.getElementById('bank-options').value.trim(); question.options = optionsText.split('\n').map(opt => opt.trim()).filter(opt => opt); } userBank[currentTab] = userBank[currentTab] || []; userBank[currentTab].push(question); try { localStorage.setItem(USER_BANK_KEY, JSON.stringify(userBank)); showModal('成功', '题目添加成功!', 'success'); clearForm(); renderBankList(); } catch (e) { showModal('错误', '保存失败:' + e.message, 'error'); } } function updateQuestion() { if (!validateForm()) return; const title = document.getElementById('bank-title').value.trim(); const answer = document.getElementById('bank-answer').value.trim().toUpperCase(); const question = { title: title, answer: answer }; if (currentTab !== 'boolean') { const optionsText = document.getElementById('bank-options').value.trim(); question.options = optionsText.split('\n').map(opt => opt.trim()).filter(opt => opt); } userBank[currentTab][editingIndex] = question; try { localStorage.setItem(USER_BANK_KEY, JSON.stringify(userBank)); showModal('成功', '题目更新成功!', 'success'); cancelEdit(); renderBankList(); } catch (e) { showModal('错误', '更新失败:' + e.message, 'error'); } } function deleteQuestion(index) { if (confirm('确定要删除这道题目吗?')) { userBank[currentTab].splice(index, 1); try { localStorage.setItem(USER_BANK_KEY, JSON.stringify(userBank)); showModal('成功', '题目删除成功!', 'success'); renderBankList(); } catch (e) { showModal('错误', '删除失败:' + e.message, 'error'); } } } function editQuestion(index) { const item = userBank[currentTab][index]; editingIndex = index; document.getElementById('bank-title').value = item.title; document.getElementById('bank-answer').value = item.answer; if (currentTab !== 'boolean' && item.options) { document.getElementById('bank-options').value = item.options.join('\n'); } formTitle.textContent = '✏️ 编辑题目'; saveBtn.style.display = 'none'; editBtns.style.display = 'block'; } function cancelEdit() { editingIndex = null; clearForm(); } function clearForm() { document.getElementById('bank-title').value = ''; document.getElementById('bank-answer').value = ''; document.getElementById('bank-options').value = ''; formTitle.textContent = '➕ 添加新题目'; saveBtn.style.display = 'block'; editBtns.style.display = 'none'; editingIndex = null; } function switchTab(type) { currentTab = type; cancelEdit(); tabs.forEach(tab => { tab.classList.toggle('active', tab.dataset.type === type); }); optionsGroup.style.display = type === 'boolean' ? 'none' : 'block'; renderBankList(); } tabs.forEach(tab => { tab.onclick = () => switchTab(tab.dataset.type); }); saveBtn.onclick = saveQuestion; document.getElementById('bank-update-btn').onclick = updateQuestion; document.getElementById('bank-cancel-edit-btn').onclick = cancelEdit; bankList.onclick = (e) => { const item = e.target.closest('.bank-item'); if (!item) return; const source = item.dataset.source; if (source !== 'user') return; const action = e.target.dataset.action; const index = parseInt(item.dataset.index); if (action === 'edit') { editQuestion(index); } else if (action === 'delete') { deleteQuestion(index); } }; document.getElementById('bank-template').onclick = () => { const templateData = { single: [ { title: "示例题目:人工智能发展的第三次浪潮以( )为核心。", options: ["深度学习", "神经网络", "符号推理", "逻辑推导"], answer: "A" } ], multiple: [ { title: "示例题目:AI实时翻译在跨境内容本地化方面可实现的功能包括( )", options: ["多语言客服支持", "商品信息自动翻译", "营销文案本地化适配"], answer: "AC" } ], boolean: [ { title: "示例题目:《国务院关于深入实施“人工智能+”行动的意见》指出要深入研究人工智能的影响", answer: "对" } ] }; const blob = new Blob([JSON.stringify(templateData, null, 2)], { type: 'application/json' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `题库导入模板_${new Date().toLocaleDateString().replace(/\//g, '-')}.json`; a.click(); URL.revokeObjectURL(url); showModal('成功', '题库模板已下载!

📋 格式说明:
• single: 单选题(含title、options、answer)
• multiple: 多选题(含title、options、answer)
• boolean: 判断题(含title、answer)

请删除示例题目后按格式填写。', 'success'); }; document.getElementById('bank-export').onclick = () => { const blob = new Blob([JSON.stringify(userBank, null, 2)], { type: 'application/json' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `题库导出_${new Date().toLocaleDateString().replace(/\//g, '-')}.json`; a.click(); URL.revokeObjectURL(url); showModal('成功', '题库已导出!', 'success'); }; document.getElementById('bank-import').onclick = () => { const input = document.createElement('input'); input.type = 'file'; input.accept = '.json'; input.style.display = 'none'; document.body.appendChild(input); input.onchange = (e) => { const file = e.target.files[0]; if (!file) { document.body.removeChild(input); return; } const reader = new FileReader(); reader.onload = (evt) => { try { const data = JSON.parse(evt.target.result); let importedCount = 0; if (data.questions) { for (const type of ['single', 'multiple', 'boolean']) { if (data.questions[type] && Array.isArray(data.questions[type])) { userBank[type] = userBank[type] || []; for (const q of data.questions[type]) { if (q.title && q.answer) { userBank[type].push(q); importedCount++; } } } } } else if (data.single || data.multiple || data.boolean) { for (const type of ['single', 'multiple', 'boolean']) { if (data[type] && Array.isArray(data[type])) { userBank[type] = userBank[type] || []; for (const q of data[type]) { if (q.title && q.answer) { userBank[type].push(q); importedCount++; } } } } } else { throw new Error('无效的题库文件格式'); } localStorage.setItem(USER_BANK_KEY, JSON.stringify(userBank)); showModal('成功', `成功导入${importedCount}道题目!`, 'success'); renderBankList(); } catch (err) { showModal('错误', '导入失败:' + err.message, 'error'); } document.body.removeChild(input); }; reader.readAsText(file); }; input.click(); }; document.getElementById('bank-clear').onclick = () => { if (confirm('确定要清空所有用户添加的题目吗?此操作不可恢复!')) { userBank = { single: [], multiple: [], boolean: [] }; localStorage.setItem(USER_BANK_KEY, JSON.stringify(userBank)); showModal('成功', '用户题库已清空!', 'success'); renderBankList(); } }; modal.querySelector('.gx-modal-header button').onclick = () => { modal.remove(); }; modal.onclick = (e) => { if (e.target === modal) modal.remove(); }; switchTab('single'); } // ===================== AI配置 ===================== function showAIConfigModal() { if (document.querySelector('.gx-modal')) return; const cfg = JSON.parse(localStorage.getItem('gk-ai') || '{"provider":"moonshot","key":""}'); const modal = document.createElement('div'); modal.className = 'gx-modal'; modal.innerHTML = `

⚙️ AI答题配置

📌 各AI服务商API Key获取地址:

• 月之暗面(Kimi):https://platform.moonshot.cn/console/api-keys

• 字节豆包:https://www.doubao.com/openapi

• DeepSeek:https://platform.deepseek.com/api_keys

• 通义千问:https://dashscope.console.aliyun.com/apiKey

• 文心一言:https://console.bce.baidu.com/ai/

`; document.body.appendChild(modal); // 绑定AI配置弹窗拖动 const aiHeader = modal.querySelector('.gx-modal-header'); const aiBox = modal.querySelector('.gx-modal-box'); drag(aiHeader, aiBox); // 清空配置 document.getElementById('ai-clear').onclick = () => { document.getElementById('ai-key').value = ''; document.getElementById('ai-provider').value = 'moonshot'; }; // 测试连接 document.getElementById('ai-test').onclick = async function() { const btn = this; const provider = document.getElementById('ai-provider').value; const key = document.getElementById('ai-key').value; if (!key) { showModal('提示', '请先输入API Key', 'warning'); return; } btn.innerHTML = '
测试中...'; btn.disabled = true; try { // 构建测试请求 const aiProvider = AI_PROVIDERS[provider]; const prompt = '测试连接,请回复"连接成功"'; let url = aiProvider.getUrl ? aiProvider.getUrl(key, aiProvider.api) : aiProvider.api; const payload = aiProvider.getPayload(key, prompt); const headers = aiProvider.getHeaders(key); const res = await new Promise((resolve, reject) => { const timeout = setTimeout(() => reject(new Error('请求超时')), 10000); GM_xmlhttpRequest({ method: 'POST', url: url, headers: headers, data: JSON.stringify(payload), onload: (r) => { clearTimeout(timeout); resolve(r); }, onerror: (err) => { clearTimeout(timeout); reject(new Error(`请求失败:${err.status}`)); } }); }); const data = JSON.parse(res.responseText); let answer = ''; if (provider === 'aliyun') { answer = data.output?.text || ''; } else if (provider === 'baidu') { answer = data.result || ''; } else { answer = data.choices?.[0]?.message?.content || ''; } if (answer.includes('连接成功')) { showModal('成功', 'AI连接测试成功!', 'success'); } else { showModal('提示', `AI返回内容异常:${answer}`, 'warning'); } } catch (e) { showModal('失败', `测试失败:${e.message}`, 'error'); } finally { btn.innerHTML = '测试连接'; btn.disabled = false; } }; // 保存配置 document.getElementById('ai-save').onclick = () => { const newCfg = { provider: document.getElementById('ai-provider').value, key: document.getElementById('ai-key').value.trim() }; localStorage.setItem('gk-ai', JSON.stringify(newCfg)); showModal('成功', 'AI配置已保存!', 'success'); modal.remove(); }; // 关闭弹窗 modal.querySelector('button').onclick = () => modal.remove(); modal.addEventListener('click', (e) => { if (e.target === modal) modal.remove(); }); } // ===================== 面板初始化 ===================== function initPanel() { // 检查是否已存在控制面板 if (document.getElementById('gk-panel')) { return; // 已存在,不再创建 } // 创建主面板 const panel = document.createElement('div'); panel.id = 'gk-panel'; panel.innerHTML = `

2026年广西公需科目助手

`; document.body.appendChild(panel); // 创建迷你面板 const mini = document.createElement('div'); mini.id = 'gk-mini'; mini.innerHTML = CONFIG.ICON; document.body.appendChild(mini); // 绑定面板拖动 drag(document.getElementById('gk-head'), panel); // 绑定迷你面板拖动(限制在可视区域内) dragMini(mini, panel); // 面板折叠/展开 document.getElementById('gk-collapse').onclick = () => { panelCollapsed = !panelCollapsed; if (panelCollapsed) { panel.style.display = 'none'; mini.style.display = 'flex'; } else { panel.style.display = 'block'; mini.style.display = 'none'; } }; // 迷你面板点击展开 mini.onclick = () => { panelCollapsed = false; panel.style.display = 'block'; mini.style.display = 'none'; }; // 绑定按钮事件 document.getElementById('gk-btn-account').onclick = showAccountModal; document.getElementById('gk-btn-fast').onclick = fastStudy; document.getElementById('gk-btn-answer-ai').onclick = () => { // 显示日志窗口(如果已存在则显示,不存在则创建) if (logWindow) { logWindow.style.display = 'flex'; } // 如果还没开始答题,则重置状态并开始 if (!window.answerTimer || window.isStopped) { resetAIState(); autoAnswerAI(); } }; document.getElementById('gk-btn-config').onclick = showAIConfigModal; document.getElementById('gk-btn-bank').onclick = showBankManagementModal; } // 登录页面自动填充功能 function initLoginFill() { const needFill = localStorage.getItem('gk-login-need-fill'); if (needFill !== 'true') return; const user = localStorage.getItem('gk-login-user'); const pwd = localStorage.getItem('gk-login-pwd'); if (!user || !pwd) { localStorage.removeItem('gk-login-need-fill'); return; } let fillTimer = null; let timeoutTimer = setTimeout(() => { clearInterval(fillTimer); localStorage.removeItem('gk-login-need-fill'); }, 15000); fillTimer = setInterval(() => { try { // 1. 优先使用ID定位账号输入框 let usernameInput = document.getElementById('username'); if (!usernameInput) { usernameInput = document.querySelector('input[name="username"]'); } if (!usernameInput) { const allInputs = document.querySelectorAll('input'); for (const input of allInputs) { const placeholder = (input.placeholder || '').toLowerCase(); if (placeholder.includes('身份证') || placeholder.includes('账号') || placeholder.includes('用户名')) { usernameInput = input; break; } } } // 2. 优先使用ID定位密码输入框 let passwordInput = document.getElementById('password'); if (!passwordInput) { passwordInput = document.querySelector('input[name="password"]'); } if (!passwordInput) { const allInputs = document.querySelectorAll('input'); for (const input of allInputs) { const placeholder = (input.placeholder || '').toLowerCase(); if (placeholder.includes('密码') || placeholder.includes('口令') || placeholder.includes('pwd')) { passwordInput = input; break; } } } if (usernameInput && passwordInput) { clearInterval(fillTimer); clearTimeout(timeoutTimer); localStorage.removeItem('gk-login-need-fill'); // 解除输入限制 usernameInput.removeAttribute('readonly'); usernameInput.removeAttribute('disabled'); passwordInput.removeAttribute('readonly'); passwordInput.removeAttribute('disabled'); usernameInput.setAttribute('autocomplete', 'off'); passwordInput.setAttribute('autocomplete', 'off'); // 模拟用户输入账号 usernameInput.focus(); usernameInput.value = ''; let charIndex = 0; const fillUsername = () => { if (charIndex < user.length) { usernameInput.value += user[charIndex]; usernameInput.dispatchEvent(new Event('input', { bubbles: true, cancelable: true })); usernameInput.dispatchEvent(new Event('keydown', { bubbles: true })); charIndex++; setTimeout(fillUsername, 30); } else { usernameInput.dispatchEvent(new Event('change', { bubbles: true, cancelable: true })); // 填充密码 passwordInput.focus(); passwordInput.value = ''; let pwdIndex = 0; const fillPassword = () => { if (pwdIndex < pwd.length) { passwordInput.value += pwd[pwdIndex]; passwordInput.dispatchEvent(new Event('input', { bubbles: true, cancelable: true })); passwordInput.dispatchEvent(new Event('keydown', { bubbles: true })); pwdIndex++; setTimeout(fillPassword, 30); } else { passwordInput.dispatchEvent(new Event('change', { bubbles: true, cancelable: true })); usernameInput.focus(); showModal('成功', '账号密码已自动填充完成!', 'success'); } }; fillPassword(); } }; fillUsername(); } } catch (e) { console.error('填充异常:', e); } }, 200); } // ===================== 初始化 ===================== window.addEventListener('load', () => { // 延迟初始化,确保页面完全加载 setTimeout(initPanel, 500); // 检查是否需要自动填充登录信息 setTimeout(initLoginFill, 1000); }); })();