From ac62a2270bdbbad9b1f80dc015904d03ebe450aa Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Mon, 4 Nov 2024 14:12:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E7=90=86=E8=AE=BA=E8=80=83?= =?UTF-8?q?=E8=AF=95=EF=BC=88=E7=BB=83=E4=B9=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 5 + src/assets/img/exit.svg | 1 + src/components/ueditorPlus/index.vue | 76 ++ src/const/testPaper.js | 34 + src/pages/product/show/index.vue | 4 +- src/pages/station/preview/index.vue | 164 ++-- src/pages/theoryExam/index.vue | 1079 ++++++++++++++++++++++++++ src/router/routes.js | 104 +-- 8 files changed, 1349 insertions(+), 118 deletions(-) create mode 100644 src/assets/img/exit.svg create mode 100644 src/components/ueditorPlus/index.vue create mode 100644 src/const/testPaper.js create mode 100644 src/pages/theoryExam/index.vue diff --git a/src/api/index.js b/src/api/index.js index a6c34af..b90c39a 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -503,6 +503,11 @@ export default { teacherModelList: `nakadai/nakadai/model/reference/demo/teacherModelList`, saveModel: `nakadai/nakadai/model/reference/demo/save`, + examPaperDetails: `exam/exam/paper/examPaperDetails`, + getExamPaperCache: `exam/exam/paper/getExamPaperCache`, + submitTheExamPaperForPractice: `exam/exam/paper/submitTheExamPaperForPractice`, + examPaperRecordCache: `exam/exam/paper/examPaperRecordCache`, + // 教师评语 addComment: `evaluation/cevaluation/comment/addComment`, queryComment: `evaluation/evaluation/ccomment/queryComment`, diff --git a/src/assets/img/exit.svg b/src/assets/img/exit.svg new file mode 100644 index 0000000..9e3d775 --- /dev/null +++ b/src/assets/img/exit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/ueditorPlus/index.vue b/src/components/ueditorPlus/index.vue new file mode 100644 index 0000000..0d0283b --- /dev/null +++ b/src/components/ueditorPlus/index.vue @@ -0,0 +1,76 @@ + + + + \ No newline at end of file diff --git a/src/const/testPaper.js b/src/const/testPaper.js new file mode 100644 index 0000000..d4a89d7 --- /dev/null +++ b/src/const/testPaper.js @@ -0,0 +1,34 @@ +export default { + difficults: [ + { + id: 1, + name: '简单' + }, + { + id: 2, + name: '普通' + }, + { + id: 3, + name: '较难' + }, + { + id: 4, + name: '难' + }, + ], + paperTypes: [ + { + id: 0, + name: '练习' + }, + { + id: 1, + name: '考核' + }, + { + id: 2, + name: '竞赛' + }, + ], +} diff --git a/src/pages/product/show/index.vue b/src/pages/product/show/index.vue index 70db126..111ee0a 100644 --- a/src/pages/product/show/index.vue +++ b/src/pages/product/show/index.vue @@ -54,7 +54,7 @@ - + @@ -235,7 +235,7 @@ export default { const { isRenew } = await this.$get(this.api.whetherToRenewTheFee, { mallId: this.id }) - // 1正常显示资源,0显示续费 + // 1正常显示资源,0显示续费,-1试用 this.overdue = isRenew }, // tab切换 diff --git a/src/pages/station/preview/index.vue b/src/pages/station/preview/index.vue index 859349f..44371a9 100644 --- a/src/pages/station/preview/index.vue +++ b/src/pages/station/preview/index.vue @@ -52,8 +52,8 @@
续费 - 进入理论 - 进入实训 + 进入理论 + 进入实训

{{ curriculumName || courseName }}

@@ -278,11 +278,20 @@
    -
  • - - {{ i + 1 }}. {{ item.projectName }} -
  • + +
@@ -358,8 +367,11 @@ export default { videoSrc: '', desShrink: false, projectVisible: false, + isTheory: 0, projects: [], + papers: [], loading: false, + curPaper: '', curProject: '', overdue: 0, //是否过期 buyVisible: false, @@ -466,7 +478,7 @@ export default { this.$get(this.api.whetherToRenewTheFee, { mallId: this.mallId }).then(({ isRenew }) => { - // 1正常显示资源,0显示续费 + // 1正常显示资源,0显示续费,-1试用 this.overdue = isRenew this.getChapter() this.getProgress() @@ -698,7 +710,7 @@ export default { }, preview (row, chapterName, showDia = 0) { // 如果没过期,则正常预览,否则显示购买弹框 - if (this.overdue || showDia) { + if (this.overdue === 1 || showDia) { this.curLink = `${chapterName}${row.name}`; // 章节名称+小节名称,小节名称有重复的情况,如果只用小节名称判断,会有同时选中多个的情况 this.playAuth = '' this.coverUrl = '' @@ -795,12 +807,17 @@ export default { fullScreen () { this.pdfVisible = true }, + // 选择试卷 + selectPaper (item) { + this.curPaper = item.paperId + }, // 选择项目 selectProject (item) { this.curProject = item.projectId }, // 展示选择项目弹框 - showProjectDia () { + showProjectDia (isTheory) { + this.isTheory = isTheory this.projectVisible = true }, // 查询项目 @@ -810,8 +827,9 @@ export default { cId: this.courseId, // 课程id mallId: this.mallId, permissions: 0 // 0: 练习,1: 考核 - }).then(({ projects }) => { - this.projects = projects + }).then(res => { + this.projects = res.projects // 实训项目 + this.papers = res.exercisePaperList // 理论试卷 }).catch(res => { }) }, // 进入实验 @@ -829,41 +847,47 @@ export default { }) }, // 进入实验 - entry () { - // 查询上次做的项目(python跟沙盘接口不一样) - if (this.systemIds.split(',').includes('19')) { // 沙盘 - this.$post(`${this.api.getSandTableLastCache}?cid=${this.courseId}`).then(res => { - // 返回了data则提示是否继续,否则,显示选择项目的弹框 - if (res.getLastCache) { - this.entryProject(+res.getLastCache) - } else { + entry (isTheory) { + if (isTheory) { + // 理论试卷 + this.showProjectDia(1) + } else { + // 实训系统 + // 查询上次做的项目(python跟沙盘接口不一样) + if (this.systemIds.split(',').includes('19')) { // 沙盘 + this.$post(`${this.api.getSandTableLastCache}?cid=${this.courseId}`).then(res => { + // 返回了data则提示是否继续,否则,显示选择项目的弹框 + if (res.getLastCache) { + this.entryProject(+res.getLastCache) + } else { + this.showProjectDia() + } + }).catch(res => { this.showProjectDia() - } - }).catch(res => { - this.showProjectDia() - }) - } else { // python - // python只能存在一个打开的窗口 - // const opened = +localStorage.getItem('opened') - // if (opened) { - // Util.errorMsg('Python系统限单页活跃,请切换至当前已有的活跃实验页面。', 5000) - // return false - // } else { - // localStorage.setItem('opened', 1) - // } - - this.$get(this.api.getTheMostRecentlyRunProject, { - cid: this.courseId - }).then(({ data }) => { - // 返回了data则提示是否继续,否则,显示选择项目的弹框 - if (data && data.length) { - this.entryProject(data[0].projectId) - } else { + }) + } else { // python + // python只能存在一个打开的窗口 + // const opened = +localStorage.getItem('opened') + // if (opened) { + // Util.errorMsg('Python系统限单页活跃,请切换至当前已有的活跃实验页面。', 5000) + // return false + // } else { + // localStorage.setItem('opened', 1) + // } + + this.$get(this.api.getTheMostRecentlyRunProject, { + cid: this.courseId + }).then(({ data }) => { + // 返回了data则提示是否继续,否则,显示选择项目的弹框 + if (data && data.length) { + this.entryProject(data[0].projectId) + } else { + this.showProjectDia() + } + }).catch(res => { this.showProjectDia() - } - }).catch(res => { - this.showProjectDia() - }) + }) + } } }, // 进入python系统 @@ -895,29 +919,35 @@ export default { }, // 进入子系统 async toSub () { - let curProject = this.projects.find(e => e.projectId == this.curProject) - if (!curProject && this.projects.length) { - curProject = this.projects[0] - this.curProject = curProject.projectId - } - const { systemId } = curProject - - let token = Util.local.get(Setting.tokenKey); - this.third = curProject.type === 2 ? (curProject.systemId === 28 ? 'low' : 'ai') : '' - if (systemId == 11) { - // 银行系统 - sessionStorage.removeItem('projectId') - sessionStorage.removeItem('submited') - location.href = `${Setting.bankPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${this.courseId}&mallId=${this.mallId}&systemId=${this.systemIds}&projectId=${this.curProject}&assessmentId=&classId=&stopTime=&test=true&manager=1` - } else if (systemId == 12) { - // 众筹系统 - window.open(`http://${Setting.zcPath}?systemId=${systemId}&courseId=${this.courseId}&projectId=${this.curProject}&token=${token}&userId=${this.userId}&classId=1&mallId=${this.mallId}${Setting.isTest ? '&beta=1' : ''}`); - } else if (systemId == 19) { - // 沙盘 - location.href = `${Setting.sandPath}/#/?curriculumName=${this.curriculumName}&token=${token}&cid=${this.courseId}&mallId=${this.mallId}&systemId=${this.systemIds}&projectId=${this.curProject}&assessmentId=&classId=&stopTime=&manager=1&referrer=${encodeURIComponent(location.href)}` + // 理论试卷 + if (this.isTheory) { + window.open(this.$router.resolve(`/theoryExam?paperId=${this.curPaper}&cid=${this.courseId}&mallId=${this.mallId}&curriculumName=${this.curriculumName}`).href) } else { - // python系统 - this.toPython(this.curProject) + // 实训 + let curProject = this.projects.find(e => e.projectId == this.curProject) + if (!curProject && this.projects.length) { + curProject = this.projects[0] + this.curProject = curProject.projectId + } + const { systemId } = curProject + + let token = Util.local.get(Setting.tokenKey); + this.third = curProject.type === 2 ? (curProject.systemId === 28 ? 'low' : 'ai') : '' + if (systemId == 11) { + // 银行系统 + sessionStorage.removeItem('projectId') + sessionStorage.removeItem('submited') + location.href = `${Setting.bankPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${this.courseId}&mallId=${this.mallId}&systemId=${this.systemIds}&projectId=${this.curProject}&assessmentId=&classId=&stopTime=&test=true&manager=1` + } else if (systemId == 12) { + // 众筹系统 + window.open(`http://${Setting.zcPath}?systemId=${systemId}&courseId=${this.courseId}&projectId=${this.curProject}&token=${token}&userId=${this.userId}&classId=1&mallId=${this.mallId}${Setting.isTest ? '&beta=1' : ''}`); + } else if (systemId == 19) { + // 沙盘 + location.href = `${Setting.sandPath}/#/?curriculumName=${this.curriculumName}&token=${token}&cid=${this.courseId}&mallId=${this.mallId}&systemId=${this.systemIds}&projectId=${this.curProject}&assessmentId=&classId=&stopTime=&manager=1&referrer=${encodeURIComponent(location.href)}` + } else { + // python系统 + this.toPython(this.curProject) + } } } } diff --git a/src/pages/theoryExam/index.vue b/src/pages/theoryExam/index.vue new file mode 100644 index 0000000..a990096 --- /dev/null +++ b/src/pages/theoryExam/index.vue @@ -0,0 +1,1079 @@ + + + + + \ No newline at end of file diff --git a/src/router/routes.js b/src/router/routes.js index 8661945..ea7653e 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -9,18 +9,18 @@ requireModule.keys().forEach(fileName => { modules.push(requireModule(fileName).default) }) const frameIn = [ - // 默认路由配置 - { - path: "/", - redirect: "/login" - }, - { - path: "/", - component: () => BasicLayout, - meta: { title: "首页" }, - children: [] - }, - ...modules + // 默认路由配置 + { + path: "/", + redirect: "/login" + }, + { + path: "/", + component: () => BasicLayout, + meta: { title: "首页" }, + children: [] + }, + ...modules ]; /** @@ -28,53 +28,59 @@ const frameIn = [ */ const frameOut = [ - // 登录 - { - path: "/login", - name: "login", - meta: { - title: "登录" - }, - component: () => import("@/pages/account/login") + // 登录 + { + path: "/login", + name: "login", + meta: { + title: "登录" }, - { - path: "/redirect", - name: "redirect", - component: () => import("@/pages/account/redirect") - }, - { - name: `matchPreview`, - path: `/match/preview`, - component: () => import("@/pages/match/preview"), - meta: { title: "赛事预览" } - } + component: () => import("@/pages/account/login") + }, + { + path: "/redirect", + name: "redirect", + component: () => import("@/pages/account/redirect") + }, + { + name: `matchPreview`, + path: `/match/preview`, + component: () => import("@/pages/match/preview"), + meta: { title: "赛事预览" } + }, + { + name: `theoryExam`, + path: `/theoryExam`, + component: () => import("@/pages/theoryExam"), + meta: { title: "理论考试" } + } ]; /** * 错误页面 */ const errorPage = [ - { - path: '/403', - name: '403', - meta: { - title: '403' - }, - component: () => import('@/pages/exception/error/403') + { + path: '/403', + name: '403', + meta: { + title: '403' + }, + component: () => import('@/pages/exception/error/403') + }, + { + path: '*', + name: '404', + meta: { + title: '404' }, - { - path: '*', - name: '404', - meta: { - title: '404' - }, - component: () => import('@/pages/exception/error/404') - } + component: () => import('@/pages/exception/error/404') + } ] // 重新组织后导出 export default [ - ...frameIn, - ...frameOut, - ...errorPage + ...frameIn, + ...frameOut, + ...errorPage ]; \ No newline at end of file