Skip to content

Commit

Permalink
feat(script): 新增超星旧版学习页面自动转换新版功能
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Dec 4, 2023
1 parent 7be1071 commit 9992a03
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/scripts/src/projects/cx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ export const CXProject = Project.create({
['', 'work/getAllWork'],
['', 'work/doHomeWorkNew'],
['', 'exam/test\\?'],
['', 'exam/test/reVersionTestStartNew.*examsystem.*']
['', 'exam/test/reVersionTestStartNew.*examsystem.*'],
['', 'mooc-ans/mycourse/studentstudy']
],
hideInPanel: true,
async oncomplete() {
Expand All @@ -360,12 +361,16 @@ export const CXProject = Project.create({
if (experience) {
experience.click();
} else {
const params = new URLSearchParams(window.location.href);
const newUrl = new URL(window.location.href);
if (window.location.href.includes('mooc-ans/mycourse/studentstudy')) {
newUrl.pathname = '/mycourse/studentstudy';
}
const params = newUrl.searchParams;
params.set('mooc2', '1');
// 兼容考试切换
params.set('newMooc', 'true');
params.delete('examsystem');
window.location.replace(decodeURIComponent(params.toString()));
window.location.replace(newUrl);
}
}
}
Expand Down

0 comments on commit 9992a03

Please sign in to comment.