|
|
|
|
@ -105,7 +105,22 @@ const getCurrentTeachingClassId = async () => {
|
|
|
|
|
}
|
|
|
|
|
return classId;
|
|
|
|
|
};
|
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
|
|
const updateVisitCountInBackground = (projectName) => {
|
|
|
|
|
getCurrentTeachingClassId()
|
|
|
|
|
.then((currentClassId) => {
|
|
|
|
|
if (!currentClassId) return;
|
|
|
|
|
return indexApi.updateVisitCount({
|
|
|
|
|
classId: currentClassId,
|
|
|
|
|
projectName,
|
|
|
|
|
schoolId: userStore.userInfo.schoolId,
|
|
|
|
|
userId: userStore.userInfo.userId,
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
console.warn("更新模块访问次数失败", error);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
|
|
if (isDemo.value) { next(); return; }
|
|
|
|
|
const disabledTitles = proxy.$cache.session.getJSON("disabledTitles");
|
|
|
|
|
const routess = Array.isArray(disabledTitles) ? disabledTitles : [];
|
|
|
|
|
@ -135,20 +150,8 @@ router.beforeEach(async (to, from, next) => {
|
|
|
|
|
}
|
|
|
|
|
start(toModule);
|
|
|
|
|
if (module.includes(fromModule)) {
|
|
|
|
|
const currentClassId = await getCurrentTeachingClassId();
|
|
|
|
|
if (!currentClassId) {
|
|
|
|
|
next();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 更新访问次数
|
|
|
|
|
indexApi
|
|
|
|
|
.updateVisitCount({
|
|
|
|
|
classId: currentClassId,
|
|
|
|
|
projectName: fromModule,
|
|
|
|
|
schoolId: userStore.userInfo.schoolId,
|
|
|
|
|
userId: userStore.userInfo.userId,
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {});
|
|
|
|
|
// 访问统计不影响页面跳转,避免等待当前教学班接口。
|
|
|
|
|
updateVisitCountInBackground(fromModule);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
next();
|
|
|
|
|
|