* @description 面板 * @returns
()
| 5860 | * @returns |
| 5861 | */ |
| 5862 | function Panel() { |
| 5863 | // 运行设置标签 |
| 5864 | const runLabels = [ |
| 5865 | { |
| 5866 | title: '自动开始', |
| 5867 | tip: '启动时, 自动开始任务, 在倒计时结束前自动开始可随时取消; 如果在自动开始前手动开始任务, 此次自动开始将取消', |
| 5868 | type: SettingType.AUTO_START, |
| 5869 | }, |
| 5870 | { |
| 5871 | title: '同屏任务', |
| 5872 | tip: '运行任务时,所有任务均在当前页面以弹窗方式运行', |
| 5873 | type: SettingType.SAME_TAB, |
| 5874 | }, |
| 5875 | { |
| 5876 | title: '静默运行', |
| 5877 | tip: '同屏任务时, 不显示任务弹窗静默运行', |
| 5878 | type: SettingType.SILENT_RUN, |
| 5879 | }, |
| 5880 | { |
| 5881 | title: '定时刷新', |
| 5882 | tip: '定时刷新页面,重新进行任务,此功能需要长时间占用浏览器', |
| 5883 | type: SettingType.SCHEDULE_RUN, |
| 5884 | }, |
| 5885 | { |
| 5886 | title: '视频静音', |
| 5887 | tip: '视听学习时,静音播放视频', |
| 5888 | type: SettingType.VIDEO_MUTED, |
| 5889 | }, |
| 5890 | ]; |
| 5891 | // 运行设置标签 |
| 5892 | const examLabels = [ |
| 5893 | { |
| 5894 | title: '随机作答', |
| 5895 | tip: '无答案时, 随机选择或者填入答案, 不保证正确', |
| 5896 | type: SettingType.RANDOM_EXAM, |
| 5897 | }, |
| 5898 | { |
| 5899 | title: '自动答题', |
| 5900 | tip: '进入答题页面时,自动答题并提交答案', |
| 5901 | type: SettingType.AUTO_ANSWER, |
| 5902 | }, |
| 5903 | ]; |
| 5904 | // 推送设置标签 |
| 5905 | const pushLabels = [ |
| 5906 | { |
| 5907 | title: '远程推送', |
| 5908 | tip: '利用 pushplus 推送, 将登录二维码直接推送到微信公众号', |
| 5909 | type: SettingType.REMOTE_PUSH, |
| 5910 | }, |
| 5911 | ]; |
| 5912 | // 处理设置变化 |
| 5913 | const handleSettingsChange = (e, type, title) => { |
| 5914 | // 开关 |
| 5915 | const { checked } = e.target; |
| 5916 | if (settings[type] !== checked) { |
| 5917 | settings[type] = checked; |
| 5918 | // 设置 |
| 5919 | GM_setValue('studySettings', JSON.stringify(settings)); |
no test coverage detected