新增404

This commit is contained in:
ember 2025-12-04 19:28:17 +08:00
parent 11be3b5e3a
commit 67ed03635b
8 changed files with 112 additions and 7 deletions

File diff suppressed because one or more lines are too long

2
dist/index.html vendored
View File

@ -1 +1 @@
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>NEU小站课程评分系统</title><script defer="defer" src="/js/chunk-vendors.3aa9144b.js"></script><script defer="defer" src="/js/app.2c83ed37.js"></script><link href="/css/chunk-vendors.f2db5e15.css" rel="stylesheet"><link href="/css/app.387e87f6.css" rel="stylesheet"></head><body><noscript><strong>本系统需要JavaScript支持请启用JavaScript后继续。</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>NEU小站课程评分系统</title><script defer="defer" src="/js/chunk-vendors.3aa9144b.js"></script><script defer="defer" src="/js/app.87b57846.js"></script><link href="/css/chunk-vendors.f2db5e15.css" rel="stylesheet"><link href="/css/app.6ab343bc.css" rel="stylesheet"></head><body><noscript><strong>本系统需要JavaScript支持请启用JavaScript后继续。</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

2
dist/js/app.87b57846.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,7 @@ import RatingPageforComp from '../views/RatingPageforComp.vue'
import ChatList from '../views/ChatList.vue'
import AboutPage from '../views/AboutPage.vue'
import CourseDetail from '../views/CourseDetail.vue'
import NotFound from '../views/404.vue'
const routes = [
{
@ -63,6 +64,18 @@ const routes = [
title: '课程详情 - NEU小站课程评分系统',
},
component: CourseDetail
},
{
path: '/404',
name: 'NotFound',
meta: {
title: '404 - 未知页面 - NEU小站课程评分系统',
},
component: NotFound
},
{
path: '/:pathMatch(.*)*',
redirect: '/404'
}
]

82
src/views/404.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -270,10 +270,13 @@ export default {
this.courseId = this.$route.params.course_id;
if (this.courseId) {
await this.loadCourseData();
if (this.course && this.course.course_name) {
document.title = this.course.course_name + " (" + this.course.teachers + ") " + " - NEU小站课程评分系统";
}
} else {
this.loading = false;
// ID
this.$router.push('/rating');
// ID 404
this.$router.replace('/404');
}
},
beforeUnmount() {
@ -291,6 +294,12 @@ export default {
try {
// 1.
const response = await fetch(`https://coursesystem.xn--xhq44jb2fzpc.com/course-detail?course_id=${this.courseId}`);
if (response.status === 404) {
this.$router.replace('/404');
return;
}
if (!response.ok) throw new Error('Failed to fetch course detail');
this.course = await response.json();

View File

@ -318,7 +318,8 @@ export default {
},
showCourseDetail(course) {
this.$router.push(`/detail/${course.course_id}`);
//
window.open(`/detail/${course.course_id}`, '_blank');
},
formatTopComment(comment) {