From 13b58a42000676c072cf9711491b5e6230dcb345 Mon Sep 17 00:00:00 2001 From: 梁保满 Date: Tue, 6 Dec 2022 17:52:38 +0800 Subject: [PATCH] 备题组卷部分前端页面基本完成 --- router | 8 ++++---- src/api/apis/answerSheet.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- src/api/apis/login.js | 10 +++++++--- src/api/axios.js | 72 +++++++++++++++++++++++++++++++++++++++++++++++++----------------------- src/api/urls/answerSheet.js | 14 +++++++++++++- src/assets/css/base.css | 17 ++++++++++++----- src/assets/css/index.scss | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.js | 1 + src/router/index.js | 282 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/router/permission.js | 287 ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/store/index.js | 310 ++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/utils/index.js | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------- src/views/examinationPaper/add.vue | 1028 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- src/views/examinationPaper/edit.vue | 341 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/views/examinationPaper/index.vue | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------ src/views/examinationPaper/recycle.vue | 327 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ src/views/layout/header/header.vue | 1 - src/views/layout/layout.vue | 36 +++++++++++++++++++++++++++++++++++- src/views/login/index.vue | 7 +++++-- 19 files changed, 2390 insertions(+), 738 deletions(-) create mode 100644 src/assets/css/index.scss diff --git a/router b/router index 592aad7..24f40e7 100644 --- a/router +++ b/router @@ -136,13 +136,13 @@ { path: "/", iconCls: "fa fa-cog", - name: '学校管理', + name: '学校设置', component: Layout, children: [ { path: "/setUpSchool", iconCls: "fa fa-calculator", - name: '学校管理', + name: '学校设置', component: SetUpSchool, children: [] }, @@ -220,14 +220,14 @@ { path: "/down", iconCls: "fa fa-download", // 图标样式class - name: "", + name: "发卡软件", component: Down, children: [] }, { path: "/downClient", iconCls: "", // 图标样式class - name: "", + name: "授课端软件", component: DownClient, children: [] } diff --git a/src/api/apis/answerSheet.js b/src/api/apis/answerSheet.js index 9ae8d29..698f09b 100644 --- a/src/api/apis/answerSheet.js +++ b/src/api/apis/answerSheet.js @@ -11,7 +11,7 @@ export default { data }) }, - // 答题卡列表 + // 测验类型 fetchTypeNames(data) { return axios({ url: answerSheet.typeNames, @@ -19,7 +19,7 @@ export default { data }) }, - // 答题卡列表 + // 班级列表 fetchClassList(data) { return axios({ url: answerSheet.classList, @@ -27,7 +27,7 @@ export default { data }) }, - // 答题卡列表 + // 科目列表 fetchSubjectList(data) { return axios({ url: answerSheet.subjectList, @@ -35,5 +35,53 @@ export default { data }) }, + // 年级列表 + fetchGradeList(data) { + return axios({ + url: answerSheet.gradeList, + method: 'POST', + data + }) + }, + // 添加测验类型 + addAnswerTypeName(data) { + return axios({ + url: answerSheet.addAnswerTypeName, + method: 'POST', + data + }) + }, + // 保存答题卡 + saveAnswerSheet(data) { + return axios({ + url: answerSheet.saveAnswerSheet, + method: 'POST', + data + }) + }, + // 删除答题卡 + removeAnswerSheet(data) { + return axios({ + url: answerSheet.removeAnswerSheet, + method: 'POST', + data + }) + }, + // 恢复答题卡 + useAnswerSheet(data) { + return axios({ + url: answerSheet.useAnswerSheet, + method: 'POST', + data + }) + }, + // 恢复答题卡 + updateAnswerSheet(data) { + return axios({ + url: answerSheet.updateAnswerSheet, + method: 'POST', + data + }) + }, } diff --git a/src/api/apis/login.js b/src/api/apis/login.js index 930141b..5d3eb16 100644 --- a/src/api/apis/login.js +++ b/src/api/apis/login.js @@ -4,7 +4,11 @@ import loginUrls from "../urls/login" export default { // 账号密码登陆 - fetchLogin (data) { - return axios.post(loginUrls.login, data) - } + fetchLogin(data) { + return axios({ + url: loginUrls.login, + method: 'POST', + data + }) + }, } diff --git a/src/api/axios.js b/src/api/axios.js index 86804dc..c322633 100644 --- a/src/api/axios.js +++ b/src/api/axios.js @@ -2,10 +2,12 @@ import axios from "axios" import Cookies from "js-cookie" import NProgress from "nprogress" import { Message } from "element-ui" -import config from "../config/index"; // 路径配置 +import router from "@/router/index" +import store from "@/store" +import conf from "../config/index"; // 路径配置 // axios默认配置 axios.defaults.timeout = 1000000000 // 超时时间 -axios.defaults.baseURL = config.baseURL +axios.defaults.baseURL = conf.baseURL // http request 拦截器 axios.interceptors.request.use(config => { @@ -27,38 +29,62 @@ axios.interceptors.request.use(config => { // http response 拦截器 axios.interceptors.response.use( response => { + const res = respones.data; NProgress.done() if (respones.config.cancelToken) { store.commit('delTokenSources', respones.config.cancelToken) } - if (response.data.code === 11000) { + if (respones.status == 200) { Cookies.set("access_token", response.data.message, { expires: 1 / 12 }) - return Promise.resolve() - } else if (response.data.code === 10000) { // 约定报错信息 - Message({ - message: response.data.message, - type: "warning" - }) - return Promise.reject(response) - } else { - return Promise.resolve(response) + // console.log(respones.status) + if (res.code == 999) { + if (!location.href.includes('localhost')) { + if (res.data) { + window.location.href = res.data + } else { + router.push({ path: '/login' }) + if (res.message.includes('不存在')) { + Message({ + message: res.message, + type: 'error', + duration: 3 * 1000 + }) + } + } + } + return + } else { + Cookies.set("access_token", response.data.message, { expires: 1 / 12 }) + } } + return Promise.resolve(response) }, error => { - if (error.response.status === 404) { + Message({ + message: error.message, + type: 'error', + duration: 3 * 1000 + }) + if (error.response == undefined) { + return Promise.reject(error); + } + Message.closeAll() + const { + status + } = error.response + if (status === 403 || status === 401) { Message({ - message: "请求地址出错", - type: "warning" + message: "未登录或登录超时,即将跳转到登录页面", + type: 'error', + duration: 3 * 1000 }) - } else if (error.response.status === 401) { - Message({ - message: error.response.data.message, - type: "warning" + router.push({ + path: '/login', + query: { + url: window.location.href + } }) - Cookies.remove("access_token") - setTimeout(() => { - location.reload() - }, 3000) + return } return Promise.reject(error.response) // 返回接口返回的错误信息 }) diff --git a/src/api/urls/answerSheet.js b/src/api/urls/answerSheet.js index cf3806d..62c18b2 100644 --- a/src/api/urls/answerSheet.js +++ b/src/api/urls/answerSheet.js @@ -1,10 +1,22 @@ export default { // 答题卡列表 answerList: "/apis/answerList", - // 答题卡类型 + // 测验类型 typeNames: "/apis/typeNames", + // 查找年级 + gradeList: "/apis/gradeList", // 查找班级 classList: "/apis/classList", // 查找科目 subjectList: "/apis/subjectList", + // 天假答题卡测验类型 + addAnswerTypeName: "/apis/addAnswerTypeName", + // 保存答题卡 + saveAnswerSheet: "/apis/saveAnswerSheet", + // 删除答题卡 + removeAnswerSheet: "/apis/removeAnswerSheet", + // 恢复使用答题卡 + useAnswerSheet: "/apis/useAnswerSheet", + // 更新答题卡 + updateAnswerSheet: "/apis/updateAnswerSheet", } \ No newline at end of file diff --git a/src/assets/css/base.css b/src/assets/css/base.css index 965708b..5c24e48 100644 --- a/src/assets/css/base.css +++ b/src/assets/css/base.css @@ -21,18 +21,25 @@ a { } /* element-style */ -.el-button--default{ +.el-button--default { color: #667ffd; border-color: #667ffd; } + .el-button--primary { background-color: #667ffd; border-color: #667ffd; } -.el-radio__input.is-checked+.el-radio__label{ + +.el-radio__input.is-checked+.el-radio__label { color: #667ffd; } -.el-radio__input.is-checked .el-radio__inner{ + +.el-radio__input.is-checked .el-radio__inner { border-color: #667ffd; - background: #667ffd; -} \ No newline at end of file + background: #667ffd; +} + +.el-message-box .el-button--default { + color: #fff +} diff --git a/src/assets/css/index.scss b/src/assets/css/index.scss new file mode 100644 index 0000000..39663b3 --- /dev/null +++ b/src/assets/css/index.scss @@ -0,0 +1,67 @@ +.answer-header { + padding: 16px 40px 12px 20px; + display: flex; + justify-content: space-between; + align-items: center; + .btn-box { + display: flex; + } + .sel-box { + display: flex; + align-items: center; + flex-wrap: nowrap; + .sel { + width: 8%; + min-width: 90px; + margin-right: 20px; + } + .el-input__inner{ + border-radius: 20px; + border: 1px solid #e2e2e2; + height: 36px; + line-height: 34px; + } + .el-input__icon { + line-height: 34px; + } + .el-date-editor.el-input, + .el-date-editor.el-input__inner { + width: 200px; + } + .input-with-select { + width: 200px; + height: 36px; + margin-right: 50px; + border-radius: 20px; + border: 1px solid #e2e2e2; + box-sizing: border-box; + .el-input__inner { + border-radius: 20px; + border: none; + height: 34px; + line-height: 34px; + } + .el-input-group__append, .el-input-group__prepend { + border: none; + background: transparent; + } + } + .d1 { + margin-left: 30px; + } + .p1 { + flex: 1; + .s1 { + margin-left: 36px; + cursor: pointer; + color: #7f7f7f; + &:hover { + color: #409eff; + } + &.active { + color: #667ffd; + } + } + } +} +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index fb0c9bc..fc8e568 100755 --- a/src/main.js +++ b/src/main.js @@ -18,6 +18,7 @@ import "element-ui/lib/theme-chalk/index.css" import "font-awesome/css/font-awesome.css" import "@/router/permission" import "@/assets/css/base.css" +import "@/assets/css/index.scss" Vue.config.productionTip = false Vue.use(ElementUI) diff --git a/src/router/index.js b/src/router/index.js index 5eaa2fe..5386c20 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,8 +5,29 @@ import Login from "@/views/login/index" import Layout from "@/views/layout/layout" import HomeMain from "@/views/index/mainIndex" + // 不是必须加载的组件使用懒加载 const NotFound = () => import("@/views/page404") +const ExaminationPaper = () => import("@/views/examinationPaper/index") +const ExaminationPaperAdd = () => import("@/views/examinationPaper/add") +const ExaminationPaperEdit = () => import("@/views/examinationPaper/edit") +const ExaminationPaperRecycle = () => import("@/views/examinationPaper/recycle") +const Ask = () => import("@/views/ask/index") +const AskAnalysis = () => import("@/views/ask/analysis") +const Test = () => import("@/views/test/index") +const TestAnalysis = () => import("@/views/test/analysis") +const DataSync = () => import("@/views/dataSync/index") +const Portrait = () => import("@/views/portrait/index") +const Card = () => import("@/views/card/index") +const Analysis = () => import("@/views/analysis/index") +const Device = () => import("@/views/device/index") +const Down = () => import("@/views/down/index") +const DownClient = () => import("@/views/down/client") +const SetUpAccount = () => import("@/views/setUp/account") +const SetUpConglomerate = () => import("@/views/setUp/conglomerate") +const SetUpSchool = () => import("@/views/setUp/school") +const SetUpStudent = () => import("@/views/setUp/student") +const SetUpTeacher = () => import("@/views/setUp/teacher") /** * 重写路由的push方法 @@ -55,7 +76,266 @@ let defaultRouter = [ } ] +let addrouters = [ //测试用,后续后端获取 + { + path: "/examinationPaper", + iconCls: "fa fa-file-text", // 图标样式class + name: "备题组卷", + component: Layout, + alone: true, + children: [ + { + path: "/examinationPaper", + iconCls: "fa fa-file-text", // 图标样式class + name: "", + component: ExaminationPaper, + children: [] + }, + { + path: "/examinationPaperAdd", + iconCls: "", // 图标样式class + name: "添加答题卡", + component: ExaminationPaperAdd, + children: [] + }, + { + path: "/examinationPaperEdit", + iconCls: "", // 图标样式class + name: "修改答题卡", + component: ExaminationPaperEdit, + children: [] + }, + { + path: "/examinationPaperRecycle", + iconCls: "", // 图标样式class + name: "已归档答题卡", + component: ExaminationPaperRecycle, + children: [] + }, + ] + }, + { + path: "/ask", + iconCls: "fa fa-bar-chart", // 图标样式class + name: "随堂问报表", + component: Layout, + alone: true, + children: [ + { + path: "/ask", + iconCls: "fa fa-bar-chart", // 图标样式class + name: "", + component: Ask, + children: [] + + }, + { + path: "/askAnalysis", + iconCls: "", // 图标样式class + name: "随堂问报表分析", + component: AskAnalysis, + children: [] + } + ] + }, + { + path: "/test", + iconCls: "fa fa-pie-chart", // 图标样式class + name: "即时测报表", + component: Layout, + alone: true, + children: [ + { + path: "/test", + iconCls: "fa fa-pie-chart", // 图标样式class + name: "", + component: Test, + children: [] + }, + { + path: "/testAnalysis", + iconCls: "", // 图标样式class + name: "即时测报表分析", + component: TestAnalysis, + children: [] + } + + ] + }, + { + path: "/portrait", + iconCls: "fa fa-users", // 图标样式class + name: "学生画像", + component: Layout, + alone: true, + children: [ + { + path: "/portrait", + iconCls: "fa fa-users", // 图标样式class + name: "", + component: Portrait, + children: [] + } + ] + }, + + { + path: "/setUpConglomerate", + iconCls: "fa fa-building", // 图标样式class + name: "学校管理", + component: Layout, + alone: true, + children: [ + { + path: "/setUpConglomerate", + iconCls: "fa fa-building", + name: '集团管理', + component: SetUpConglomerate, + children: [] + }, + ] + }, + { + path: "/setUpAccount", + iconCls: "fa fa-id-card-o", // 图标样式class + name: "账号管理", + component: Layout, + alone: true, + children: [ + { + path: "/setUpAccount", + iconCls: "fa fa-id-card-o", + name: '', + component: SetUpAccount, + children: [] + }, + ] + }, + { + path: "/", + iconCls: "fa fa-cog", + name: '学校设置', + component: Layout, + children: [ + { + path: "/setUpSchool", + iconCls: "fa fa-calculator", + name: '学校设置', + component: SetUpSchool, + children: [] + }, + { + path: "/setUpTeacher", + iconCls: "fa fa-male", + name: '教师管理', + component: SetUpTeacher, + children: [] + }, + { + path: "/setUpStudent", + iconCls: "fa fa-mortar-board", + name: '学生管理', + component: SetUpStudent, + children: [] + }, + ] + }, + { + path: "/card", + iconCls: "fa fa-id-card", // 图标样式class + name: "发卡记录", + component: Layout, + alone: true, + children: [ + { + path: "/card", + iconCls: "fa fa-id-card", // 图标样式class + name: "", + component: Card, + children: [] + } + ] + }, + { + path: "/device", + iconCls: "fa fa-dashboard", // 图标样式class + name: "设备状态", + component: Layout, + alone: true, + children: [ + { + path: "/device", + iconCls: "fa fa-dashboard", // 图标样式class + name: "", + component: Device, + children: [] + } + ] + }, + { + path: "/analysis", + iconCls: "fa fa-area-chart", // 图标样式class + name: "使用分析", + component: Layout, + alone: true, + children: [ + { + path: "/analysis", + iconCls: "fa fa-area-chart", // 图标样式class + name: "", + component: Analysis, + children: [] + } + ] + }, + { + path: "/down", + iconCls: "fa fa-download", // 图标样式class + name: "软件下载", + component: Layout, + alone: true, + children: [ + { + path: "/down", + iconCls: "fa fa-download", // 图标样式class + name: "发卡软件", + component: Down, + children: [] + }, + { + path: "/downClient", + iconCls: "", // 图标样式class + name: "授课端软件", + component: DownClient, + children: [] + } + ] + }, + { + path: "/dataSync", + iconCls: "fa fa-random", // 图标样式class + name: "数据同步", + component: Layout, + alone: true, + children: [ + { + path: "/dataSync", + iconCls: "fa fa-random", // 图标样式class + name: "", + component: DataSync, + children: [] + } + ] + }, + { + path: "*", + redirect: "/404", + hidden: true, + children: [] + } +] + export default new Router({ routes: defaultRouter }) -export {defaultRouter} +export {defaultRouter,addrouters} diff --git a/src/router/permission.js b/src/router/permission.js index 4b82f18..9c6b56e 100644 --- a/src/router/permission.js +++ b/src/router/permission.js @@ -1,290 +1,7 @@ import NProgress from "nprogress" -import en from "../i18n/lang/en" -import Layout from "@/views/layout/layout" -import CommerViews from "@/views/commerViews" import router from "./index" import store from "../store" -// let routeName = en.routeName - -const ExaminationPaper = () => import("@/views/examinationPaper/index") -const ExaminationPaperAdd = () => import("@/views/examinationPaper/add") -const ExaminationPaperEdit = () => import("@/views/examinationPaper/edit") -const ExaminationPaperRecycle = () => import("@/views/examinationPaper/recycle") -const Ask = () => import("@/views/ask/index") -const AskAnalysis = () => import("@/views/ask/analysis") -const Test = () => import("@/views/test/index") -const TestAnalysis = () => import("@/views/test/analysis") -const DataSync = () => import("@/views/dataSync/index") -const Portrait = () => import("@/views/portrait/index") -const Card = () => import("@/views/card/index") -const Analysis = () => import("@/views/analysis/index") -const Device = () => import("@/views/device/index") -const Down = () => import("@/views/down/index") -const DownClient = () => import("@/views/down/client") -const SetUpAccount = () => import("@/views/setUp/account") -const SetUpConglomerate = () => import("@/views/setUp/conglomerate") -const SetUpSchool = () => import("@/views/setUp/school") -const SetUpStudent = () => import("@/views/setUp/student") -const SetUpTeacher = () => import("@/views/setUp/teacher") -let addrouters = [ //测试用,后续后端获取 - { - path: "/examinationPaper", - iconCls: "fa fa-file-text", // 图标样式class - name: "备题组卷", - component: Layout, - alone: true, - children: [ - { - path: "/examinationPaper", - iconCls: "fa fa-file-text", // 图标样式class - name: "", - component: ExaminationPaper, - children: [] - }, - { - path: "/examinationPaperAdd", - iconCls: "", // 图标样式class - name: "添加答题卡", - component: ExaminationPaperAdd, - children: [] - }, - { - path: "/examinationPaperEdit", - iconCls: "", // 图标样式class - name: "修改答题卡", - component: ExaminationPaperEdit, - children: [] - }, - { - path: "/examinationPaperRecycle", - iconCls: "", // 图标样式class - name: "已归档答题卡", - component: ExaminationPaperRecycle, - children: [] - }, - ] - }, - { - path: "/ask", - iconCls: "fa fa-bar-chart", // 图标样式class - name: "随堂问报表", - component: Layout, - alone: true, - children: [ - { - path: "/ask", - iconCls: "fa fa-bar-chart", // 图标样式class - name: "", - component: Ask, - children: [] - - }, - { - path: "/askAnalysis", - iconCls: "", // 图标样式class - name: "随堂问报表分析", - component: AskAnalysis, - children: [] - } - ] - }, - { - path: "/test", - iconCls: "fa fa-pie-chart", // 图标样式class - name: "即时测报表", - component: Layout, - alone: true, - children: [ - { - path: "/test", - iconCls: "fa fa-pie-chart", // 图标样式class - name: "", - component: Test, - children: [] - }, - { - path: "/testAnalysis", - iconCls: "", // 图标样式class - name: "即时测报表分析", - component: TestAnalysis, - children: [] - } - - ] - }, - { - path: "/portrait", - iconCls: "fa fa-users", // 图标样式class - name: "学生画像", - component: Layout, - alone: true, - children: [ - { - path: "/portrait", - iconCls: "fa fa-users", // 图标样式class - name: "", - component: Portrait, - children: [] - } - ] - }, - - { - path: "/setUpConglomerate", - iconCls: "fa fa-building", // 图标样式class - name: "学校管理", - component: Layout, - alone: true, - children: [ - { - path: "/setUpConglomerate", - iconCls: "fa fa-building", - name: '集团管理', - component: SetUpConglomerate, - children: [] - }, - ] - }, - { - path: "/setUpAccount", - iconCls: "fa fa-id-card-o", // 图标样式class - name: "账号管理", - component: Layout, - alone: true, - children: [ - { - path: "/setUpAccount", - iconCls: "fa fa-id-card-o", - name: '', - component: SetUpAccount, - children: [] - }, - ] - }, - { - path: "/", - iconCls: "fa fa-cog", - name: '学校管理', - component: Layout, - children: [ - { - path: "/setUpSchool", - iconCls: "fa fa-calculator", - name: '学校管理', - component: SetUpSchool, - children: [] - }, - { - path: "/setUpTeacher", - iconCls: "fa fa-male", - name: '教师管理', - component: SetUpTeacher, - children: [] - }, - { - path: "/setUpStudent", - iconCls: "fa fa-mortar-board", - name: '学生管理', - component: SetUpStudent, - children: [] - }, - ] - }, - { - path: "/card", - iconCls: "fa fa-id-card", // 图标样式class - name: "发卡记录", - component: Layout, - alone: true, - children: [ - { - path: "/card", - iconCls: "fa fa-id-card", // 图标样式class - name: "", - component: Card, - children: [] - } - ] - }, - { - path: "/device", - iconCls: "fa fa-dashboard", // 图标样式class - name: "设备状态", - component: Layout, - alone: true, - children: [ - { - path: "/device", - iconCls: "fa fa-dashboard", // 图标样式class - name: "", - component: Device, - children: [] - } - ] - }, - { - path: "/analysis", - iconCls: "fa fa-area-chart", // 图标样式class - name: "使用分析", - component: Layout, - alone: true, - children: [ - { - path: "/analysis", - iconCls: "fa fa-area-chart", // 图标样式class - name: "", - component: Analysis, - children: [] - } - ] - }, - { - path: "/down", - iconCls: "fa fa-download", // 图标样式class - name: "软件下载", - component: Layout, - alone: true, - children: [ - { - path: "/down", - iconCls: "fa fa-download", // 图标样式class - name: "", - component: Down, - children: [] - }, - { - path: "/downClient", - iconCls: "", // 图标样式class - name: "", - component: DownClient, - children: [] - } - ] - }, - { - path: "/dataSync", - iconCls: "fa fa-random", // 图标样式class - name: "数据同步", - component: Layout, - alone: true, - children: [ - { - path: "/dataSync", - iconCls: "fa fa-random", // 图标样式class - name: "", - component: DataSync, - children: [] - } - ] - }, - { - path: "*", - redirect: "/404", - hidden: true, - children: [] - } -] - +import {addrouters} from "./index" // 获取角色信息,根据用户权限动态加载路由 router.beforeEach((to, from, next) => { @@ -314,7 +31,7 @@ router.beforeEach((to, from, next) => { newAddRouters.forEach(res => { router.addRoute(res) }) - next({ path: to.path }) + next({path: to.fullPath}) }()) } else { next() diff --git a/src/store/index.js b/src/store/index.js index 15bc790..cdea525 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -3,291 +3,12 @@ import Vuex from "vuex" import Cookies from "js-cookie" import layoutStore from "./modules/layout/index" import { defaultRouter } from "@/router/index" +import { encryptLoginPassword } from "@/utils"; +import { b64DecodeUnicode } from "@/utils"; import request from "@/api/index" import router from "@/router/index" - -import Layout from "@/views/layout/layout" -import CommerViews from "@/views/commerViews" -const ExaminationPaper = () => import("@/views/examinationPaper/index") -const ExaminationPaperAdd = () => import("@/views/examinationPaper/add") -const ExaminationPaperEdit = () => import("@/views/examinationPaper/edit") -const ExaminationPaperRecycle = () => import("@/views/examinationPaper/recycle") -const Ask = () => import("@/views/ask/index") -const AskAnalysis = () => import("@/views/ask/analysis") -const Test = () => import("@/views/test/index") -const TestAnalysis = () => import("@/views/test/analysis") -const DataSync = () => import("@/views/dataSync/index") -const Portrait = () => import("@/views/portrait/index") -const Card = () => import("@/views/card/index") -const Analysis = () => import("@/views/analysis/index") -const Device = () => import("@/views/device/index") -const Down = () => import("@/views/down/index") -const DownClient = () => import("@/views/down/client") -const SetUpAccount = () => import("@/views/setUp/account") -const SetUpConglomerate = () => import("@/views/setUp/conglomerate") -const SetUpSchool = () => import("@/views/setUp/school") -const SetUpStudent = () => import("@/views/setUp/student") -const SetUpTeacher = () => import("@/views/setUp/teacher") -let addrouters = [ //测试用,后续后端获取 - { - path: "/examinationPaper", - iconCls: "fa fa-file-text", // 图标样式class - name: "备题组卷", - component: Layout, - alone: true, - children: [ - { - path: "/examinationPaper", - iconCls: "fa fa-file-text", // 图标样式class - name: "", - component: ExaminationPaper, - children: [] - }, - { - path: "/examinationPaperAdd", - iconCls: "", // 图标样式class - name: "添加答题卡", - component: ExaminationPaperAdd, - children: [] - }, - { - path: "/examinationPaperEdit", - iconCls: "", // 图标样式class - name: "修改答题卡", - component: ExaminationPaperEdit, - children: [] - }, - { - path: "/examinationPaperRecycle", - iconCls: "", // 图标样式class - name: "已归档答题卡", - component: ExaminationPaperRecycle, - children: [] - }, - ] - }, - { - path: "/ask", - iconCls: "fa fa-bar-chart", // 图标样式class - name: "随堂问报表", - component: Layout, - alone: true, - children: [ - { - path: "/ask", - iconCls: "fa fa-bar-chart", // 图标样式class - name: "", - component: Ask, - children: [] - - }, - { - path: "/askAnalysis", - iconCls: "", // 图标样式class - name: "随堂问报表分析", - component: AskAnalysis, - children: [] - } - ] - }, - { - path: "/test", - iconCls: "fa fa-pie-chart", // 图标样式class - name: "即时测报表", - component: Layout, - alone: true, - children: [ - { - path: "/test", - iconCls: "fa fa-pie-chart", // 图标样式class - name: "", - component: Test, - children: [] - }, - { - path: "/testAnalysis", - iconCls: "", // 图标样式class - name: "即时测报表分析", - component: TestAnalysis, - children: [] - } - - ] - }, - { - path: "/portrait", - iconCls: "fa fa-users", // 图标样式class - name: "学生画像", - component: Layout, - alone: true, - children: [ - { - path: "/portrait", - iconCls: "fa fa-users", // 图标样式class - name: "", - component: Portrait, - children: [] - } - ] - }, - - { - path: "/setUpConglomerate", - iconCls: "fa fa-building", // 图标样式class - name: "学校管理", - component: Layout, - alone: true, - children: [ - { - path: "/setUpConglomerate", - iconCls: "fa fa-building", - name: '集团管理', - component: SetUpConglomerate, - children: [] - }, - ] - }, - { - path: "/setUpAccount", - iconCls: "fa fa-id-card-o", // 图标样式class - name: "账号管理", - component: Layout, - alone: true, - children: [ - { - path: "/setUpAccount", - iconCls: "fa fa-id-card-o", - name: '', - component: SetUpAccount, - children: [] - }, - ] - }, - { - path: "/", - iconCls: "fa fa-cog", - name: '学校设置', - component: Layout, - children: [ - { - path: "/setUpSchool", - iconCls: "fa fa-calculator", - name: '学校设置', - component: SetUpSchool, - children: [] - }, - { - path: "/setUpTeacher", - iconCls: "fa fa-male", - name: '教师管理', - component: SetUpTeacher, - children: [] - }, - { - path: "/setUpStudent", - iconCls: "fa fa-mortar-board", - name: '学生管理', - component: SetUpStudent, - children: [] - }, - ] - }, - { - path: "/card", - iconCls: "fa fa-id-card", // 图标样式class - name: "发卡记录", - component: Layout, - alone: true, - children: [ - { - path: "/card", - iconCls: "fa fa-id-card", // 图标样式class - name: "", - component: Card, - children: [] - } - ] - }, - { - path: "/device", - iconCls: "fa fa-dashboard", // 图标样式class - name: "设备状态", - component: Layout, - alone: true, - children: [ - { - path: "/device", - iconCls: "fa fa-dashboard", // 图标样式class - name: "", - component: Device, - children: [] - } - ] - }, - { - path: "/analysis", - iconCls: "fa fa-area-chart", // 图标样式class - name: "使用分析", - component: Layout, - alone: true, - children: [ - { - path: "/analysis", - iconCls: "fa fa-area-chart", // 图标样式class - name: "", - component: Analysis, - children: [] - } - ] - }, - { - path: "/down", - iconCls: "fa fa-download", // 图标样式class - name: "软件下载", - component: Layout, - alone: true, - children: [ - { - path: "/down", - iconCls: "fa fa-download", // 图标样式class - name: "发卡软件", - component: Down, - children: [] - }, - { - path: "/downClient", - iconCls: "", // 图标样式class - name: "授课端软件", - component: DownClient, - children: [] - } - ] - }, - { - path: "/dataSync", - iconCls: "fa fa-random", // 图标样式class - name: "数据同步", - component: Layout, - alone: true, - children: [ - { - path: "/dataSync", - iconCls: "fa fa-random", // 图标样式class - name: "", - component: DataSync, - children: [] - } - ] - }, - { - path: "*", - redirect: "/404", - hidden: true, - children: [] - } -] - +import {addrouters} from "@/router/index" Vue.use(Vuex) const store = new Vuex.Store({ @@ -310,7 +31,7 @@ const store = new Vuex.Store({ name: data.name, authorityRouter: data.authorityRouter, avatar: data.avatar ? data.avatar : "", - uid: data.id + uid: data.uid } localStorage.setItem("info", JSON.stringify(store.getters.info)) }, @@ -330,9 +51,13 @@ const store = new Vuex.Store({ }, }, actions: { - Login({ commit }, that) { - // request.fetchLogin(that.loginForm).then(res => { + Login({ state,commit }, params) { + let loginForm={} + loginForm.username = params.username; + loginForm.password = encryptLoginPassword(params.password); + // request.fetchLogin(loginForm).then(res => { // if (res.status == 200) { + // const dataJSON = JSON.parse(b64DecodeUnicode(res.data)); commit("setToken", "xxxx") commit("setInfo", { permissions: [ @@ -347,14 +72,19 @@ const store = new Vuex.Store({ // authorityRouter:[], }); commit("setRouters", addrouters) - addrouters.forEach((res) => { - that.$router.addRoute(res); + state.addRouters.forEach((res) => { + router.addRoute(res); }); - that.$router.push({ path: "/" }) + console.log() + if (params.url) { + window.location.href = params.url; + } else { + router.push({ path: "/" }) + } // } // }) }, - permissions({ commit }, that) { + permissions({ state,commit }, that) { // request.fetchLogin(that.loginForm).then(res => { // if (res.status == 200) { commit("setToken", "xxxx") @@ -371,7 +101,7 @@ const store = new Vuex.Store({ // authorityRouter:[], }); commit("setRouters", addrouters) - addrouters.forEach((res) => { + state.addRouters.forEach((res) => { that.$router.addRoute(res); }); that.$router.push({ path: "/" }) diff --git a/src/utils/index.js b/src/utils/index.js index 9cab787..20688b9 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,8 +1,38 @@ -import CryptoJS from "crypto-js" +// import CryptoJS from "crypto-js" +import { JSEncrypt } from 'jsencrypt' const encryptKey = "WfJTKO9S4eLkrPz2JKrAnzdb" const encryptIV = "D076D35C" +/** + * 登录密码加密,公钥直接写死在方法里 + * @param data: 待加密数据 + * @returns 加密结果 + */ +export function encryptLoginPassword(data){ + const secret = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjh2ei17z5k2r4VzbqoSCE6RmYzWySJTgVQYulgfVM+vqcDoUE4cFB4XCFA2lHWjjpsuJP1EtwKlvUgxo5okr3x/a88o8eERxBynnVQZbEYpKteW5aqSEb/g1yPLWnKV88b/ED445ITYbZZuInRo5lkCvd6QEjL6d2Fch6mEo5awYXC4/S4BJf9YlYRhGzR7wpiXCLvyBHQ4iSIIDNpmrPBPQzGP0rx09aDu54kz/42CR6SX2OqXSi4ZoieqkPFl/iuX4RoD/NKKR+haDn1UzoD3k1WzHSTBFFs27rxRpxfBUZzfXQeskgKyw/Slcl3jUFizczsY4CLgTRrfey48Q6QIDAQAB'; + // 新建JSEncrypt对象 + let encryptor = new JSEncrypt(); + // 设置公钥 + encryptor.setPublicKey(secret); + // 加密数据 + return encryptor.encrypt(data); +} + +/** +* 对称加密 +* @param secret:加密公钥 +* @param data: 待加密数据 +* @returns 加密结果 +*/ +export function encryptData(secret, data){ + // 新建JSEncrypt对象 + let encryptor = new JSEncrypt(); + // 设置公钥 + encryptor.setPublicKey(secret); + // 加密数据 + return encryptor.encrypt(data); +} // 深度复制 export function deepClone (obj) { @@ -19,29 +49,29 @@ export function deepClone (obj) { return result } -// 3DES加密 -export function desEncrypt (str, key = encryptKey, iv = encryptIV) { - var cryptoKey = CryptoJS.enc.Utf8.parse(key) - var cryptoIv = CryptoJS.enc.Utf8.parse(iv.substr(0, 8)) - var encodeStr = CryptoJS.TripleDES.encrypt(str, cryptoKey, { - iv: cryptoIv, - mode: CryptoJS.mode.CBC, - padding: CryptoJS.pad.Pkcs7 - }) - return encodeStr.toString() -} +// // 3DES加密 +// export function desEncrypt (str, key = encryptKey, iv = encryptIV) { +// var cryptoKey = CryptoJS.enc.Utf8.parse(key) +// var cryptoIv = CryptoJS.enc.Utf8.parse(iv.substr(0, 8)) +// var encodeStr = CryptoJS.TripleDES.encrypt(str, cryptoKey, { +// iv: cryptoIv, +// mode: CryptoJS.mode.CBC, +// padding: CryptoJS.pad.Pkcs7 +// }) +// return encodeStr.toString() +// } -// 3DES解密 -export function desDecrypt (str, key = encryptKey, iv = encryptIV) { - var cryptoKey = CryptoJS.enc.Utf8.parse(key) - var cryptoIv = CryptoJS.enc.Utf8.parse(iv.substr(0, 8)) - var decryptStr = CryptoJS.TripleDES.decrypt(str, cryptoKey, { - iv: cryptoIv, - mode: CryptoJS.mode.CBC, - padding: CryptoJS.pad.Pkcs7 - }) - return decryptStr.toString(CryptoJS.enc.Utf8) -} +// // 3DES解密 +// export function desDecrypt (str, key = encryptKey, iv = encryptIV) { +// var cryptoKey = CryptoJS.enc.Utf8.parse(key) +// var cryptoIv = CryptoJS.enc.Utf8.parse(iv.substr(0, 8)) +// var decryptStr = CryptoJS.TripleDES.decrypt(str, cryptoKey, { +// iv: cryptoIv, +// mode: CryptoJS.mode.CBC, +// padding: CryptoJS.pad.Pkcs7 +// }) +// return decryptStr.toString(CryptoJS.enc.Utf8) +// } // 随机生成由字母+数字的字符串 export function randomWord (randomFlag, min, max) { @@ -86,6 +116,21 @@ export function getCookie (name, defaultValue) { return result[0] === document.cookie.match(result[1]) ? unescape(result[0][2]) : defaultValue } + +/** + * base64转化unicode + */ + export function b64DecodeUnicode(str) { + let uni; + try { + // atob 经过 base-64 编码的字符串进行解码 + uni = decodeURIComponent(atob(str).split('').map(function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + }).join('')); + } catch (e) {} + return uni; +} + // base64ToFile export function base64ToFile (base64Data, tempfilename, contentType) { contentType = contentType || "" @@ -228,3 +273,28 @@ export function getNewTime (dayNum) { var time = date.getTime() return time } + +/* + * 获取URL参数 + * + * */ +export function getURLParams(variable) { + let str = window.location.href.split("?")[1]; + if (!str) return null; + let ar = str.split("&"); + let obj = {}; + let data; + for (var i = 0; i < ar.length; i++) { + var pair = ar[i].split("="); + pair[1] = decodeURIComponent(pair[1]) + + if (pair[0] == variable) { + data = pair[1] + return pair[1] + } + if (pair[0]) { + obj[pair[0]] = pair[1] + } + } + return variable ? data : obj +} \ No newline at end of file diff --git a/src/views/examinationPaper/add.vue b/src/views/examinationPaper/add.vue index abfb84c..ae24573 100644 --- a/src/views/examinationPaper/add.vue +++ b/src/views/examinationPaper/add.vue @@ -1,13 +1,1033 @@ + return txt; + }, + setAddIndex(index) {}, + setStep1() { + this.$refs["forms"].validate((valid) => { + // 验证通过:保存 + if (valid) { + this.step = 1; + } else { + this.$message.error("数据有误,请检查!"); + return false; + } + }); + }, + setStep2() { + let valid = true; + this.form.questionList.map((item) => { + if (!item.questionTitle) { + valid = false; + } + }); + if (valid) { + this.step = 2; + } else { + this.$message.error("大题名称不能为空,请检查!"); + } + }, + openQuestion() { + this.questionForm = { ...questionForm }; + this.addQuestionVisible = true; + }, + addQuestion() { + let subQuestions = []; + let questionsOptions = { + ...subQuesOptions, + questionType: this.questionForm.questionType, + }; + switch (questionsOptions.questionType) { + case 2: + questionsOptions.answerOptions = this.rightOptions.slice( + 0, + questionsOptions.selectNum + ); + break; + case 3: + questionsOptions.answerOptions = this.rightOptions.slice( + 0, + questionsOptions.selectNum + ); + questionsOptions.partScore = 0.5; + break; + case 4: + case 5: + questionsOptions.selectNum = 0; + break; + } + for (let i = 0; i < this.questionForm.number; i++) { + subQuestions.push({ ...questionsOptions }); + } + this.form.questionList.push({ + questionTitle: this.questionForm.questionTitle, + number: this.questionForm.number, + source: 10, + subQuestions: [...subQuestions], + }); + this.addQuestionVisible = false; + }, + delTabData(subIndex, index) { + //删除小题 + console.log(subIndex); + console.log(index); + this.form.questionList[index].subQuestions.splice(subIndex, 1); + }, + setScore(question) { + let score = question.subQuestions.reduce((a, b) => { + return a + b.score; + }, 0); + return score; + }, + changeAddSubQuestions(val, question) { + if (val) { + let questionsOptions = { + ...subQuesOptions, + questionType: val, + }; + switch (questionsOptions.questionType) { + case 2: + questionsOptions.answerOptions = this.rightOptions.slice( + 0, + questionsOptions.selectNum + ); + break; + case 3: + questionsOptions.answerOptions = this.rightOptions.slice( + 0, + questionsOptions.selectNum + ); + questionsOptions.partScore = 0.5; + break; + case 4: + case 5: + questionsOptions.selectNum = 0; + break; + } + question.subQuestions.push(questionsOptions); + this.addSubQuestionsType = ""; + } + }, + changeSubQuestions(val, subQuestions) { + //切换多题型-小题题型 + const that = this; + subQuestions.score = 1; + subQuestions.partScore = 0; + subQuestions.correctAnswer = ""; + subQuestions.selectNum = 4; + switch (val) { + case 2: + subQuestions.answerOptions = that.rightOptions.slice( + 0, + subQuestions.selectNum + ); + break; + case 3: + subQuestions.answerOptions = that.rightOptions.slice( + 0, + subQuestions.selectNum + ); + subQuestions.partScore = 0.5; + break; + case 4: + case 5: + subQuestions.selectNum = 0; + break; + } + }, + addOptions(subQuestions) { + //添加选项 + let length = subQuestions.answerOptions.length; + if (length > 6) return; + subQuestions.selectNum = length + 1; + subQuestions.answerOptions = this.rightOptions.slice( + 0, + subQuestions.selectNum + ); + }, + removeOptions(subQuestions) { + //删除选项 + let length = subQuestions.answerOptions.length; + if (length < 2) return; + subQuestions.selectNum = length - 1; + subQuestions.answerOptions = this.rightOptions.slice( + 0, + subQuestions.selectNum + ); + }, + changAnswer(sub, option) { + //设置多选答案 + let str = new RegExp(option, "g"); + if (sub.correctAnswer?.includes(option)) { + sub.correctAnswer = sub.correctAnswer.replace(str, ""); + } else { + let arrs = (sub.correctAnswer && sub.correctAnswer.split("")) || []; + arrs.push(option); + sub.correctAnswer = arrs.sort().join(""); + } + }, + async addAnswerTypeName() { + //保存测验类型 + if (!this.answerTypeName) { + this.$message.error("请填写测验名称!"); + return; + } + //添加测验类型 + const { data, code, message } = await this.$request.addAnswerTypeName({ + typeName: this.answerTypeName, + }); + if (code == 0) { + this._CreatedTypeList(); + this.dialogVisible = false; + this.answerTypeName = ""; + this.$message.success("添加成功"); + } else { + this.$message.error(message); + } + }, + async save() { + if (this.saceLoading) return; + this.saceLoading = true; + const { data, code, message } = await this.$request.saveAnswerSheet({ + ...this.form, + }); + this.saceLoading = false; + if (code == 0) { + this.$router.push({ + path:"/examinationPaper" + }) + } else { + this.$message.error(message); + } + }, + async changeGrade() { + //切换年级查询科目 + this._QuerySubjectList(this.form.gradeName); + }, + async _CreatedTypeList() { + //测验类型查询 + const { data, code, message } = await this.$request.fetchTypeNames(); + if (code == 0) { + this.answerTypeList = [...data.list] || []; + this.answerTypeList.unshift({ + typeName: "--", + id: "", + }); + if (this.type != 2) { + this.form.tag = this.answerTypeList[0].id || ""; + } + } else { + this.$message.error(message); + } + }, + async _GradeList() { + //查询年级列表 + const { data, code, message } = await this.$request.fetchGradeList(); + if (code == 0) { + this.gradeList = [...data.gradeNames] || []; + if (this.type != 2) { + this.form.gradeName = this.gradeList[0]; + } + this._QuerySubjectList(this.gradeList[0]); + } else { + this.$message.error(message); + } + }, + async _QuerySubjectList(grade, dont) { + //查询科目列表 + let param = {}; + if (grade) { + param.gradeName = grade; + } + const { data, code, message } = await this.$request.fetchSubjectList( + param + ); + if (code === 0) { + this.subjectList = data.list.map((item) => { + return { + value: item.subjectId, + label: item.subjectName, + }; + }); + if (this.subjectList.length > 1) { + let isTeachingCourse = false; + this.subjectList.map((item) => { + if (item.isTeachingCourse) { + isTeachingCourse = true; + } + }); + if (this.type != 2) { + !isTeachingCourse && !dont + ? (this.form.subjectId = this.subjectList[0].value) + : ""; + } + } + if (this.subjectList.length > 0 && !dont) { + this.form.subjectId = this.subjectList[0].value; + } + } else { + this.$message.error(message); + } + }, - \ No newline at end of file diff --git a/src/views/examinationPaper/edit.vue b/src/views/examinationPaper/edit.vue index c665978..a01cebf 100644 --- a/src/views/examinationPaper/edit.vue +++ b/src/views/examinationPaper/edit.vue @@ -5,12 +5,349 @@ 修改答案 +
+

+ 2022-11-24 14:30张老师修改了答案。 +

+
+

{{ form.title }}

+

卷面总分:{{ allScore }}分

+
+
+

+ {{ setBigNum(index) }}、 + + 共 {{ setScore(question) }} 分 +

+
    +
  • +
    题号
    +
    分数
    +
    选项设置
    +
  • +
  • +
    {{ subQuestions.questionIndex }}
    +
    + {{ setSubPro(subQuestions.questionType) }} +
    +
    + +
    +
    +

    --

    +

    + + +

    +

    + {{ option }} +

    +

    + {{ option }} +

    +
    +
  • +
+
+
+ 取消 + 保存 +
+
- \ No newline at end of file diff --git a/src/views/examinationPaper/index.vue b/src/views/examinationPaper/index.vue index a3ba71e..79dfdf3 100644 --- a/src/views/examinationPaper/index.vue +++ b/src/views/examinationPaper/index.vue @@ -11,7 +11,7 @@ icon="el-icon-plus" plain circle - @click="toAdd" + @click="toAdd({})" > @@ -201,6 +201,27 @@ export default { teacher: "张老师", date: "2022-11-04 18:09:49", share: 1, + score: 100, + gradeName:"二年级", + subjectId:1, + examsDuration:4800, + questionList: [ + { + questionTitle: "f", + score: 1, + subQuestions: [ + { + questionIndex: 1, + questionType: 2, + score: 1, + partScore: 0, + selectNum: 4, + answerOptions: ["A", "B", "C", "D"], + correctAnswer: "B", + }, + ], + }, + ], }, { title: "数学样例试卷202211-4180949", @@ -212,6 +233,27 @@ export default { teacher: "张老师", date: "2022-11-04 18:09:49", share: 1, + score: 100, + gradeName:"二年级", + subjectId:1, + examsDuration:3000, + questionList: [ + { + questionTitle: "f", + score: 1, + subQuestions: [ + { + questionIndex: 2, + questionType: 3, + score: 1, + partScore: 0, + selectNum: 4, + answerOptions: ["A", "B", "C", "D"], + correctAnswer: "A,C", + }, + ], + }, + ], }, ], shareForm: { @@ -226,25 +268,27 @@ export default { }, methods: { toAdd(query) { - this.$router.push({ + let routerItem = { path: "/examinationPaperAdd", - query:query&&{...query} - }); + }; + query ? (routerItem["query"] = { ...query }) : ""; + this.$router.push(routerItem); }, toEdit(item) { this.$router.push({ path: "/examinationPaperEdit", query: { - id: item.id, + form: JSON.stringify(item), }, }); }, - handleDropdownClick(value, item) {//更多 + handleDropdownClick(value, item) { + //更多 const that = this; switch (value) { case 1: //授课端同步 - that.syncMeg(item) + that.syncMeg(item); break; case 2: //修改分享范围 @@ -255,15 +299,16 @@ export default { break; case 3: //复制 - that.toAdd() + that.toAdd({ type: 2, form: JSON.stringify(item), }); break; case 4: //归档 - that.recovery(item) + that.recovery(item); break; } }, - async syncMeg() {//同步 + async syncMeg() { + //同步 // const { data, code, message } = await this.$request.fetchAnswerList({ // ...this.shareForm, // }); @@ -274,7 +319,8 @@ export default { // this.$message.error(message); // } }, - async saveShare() {//修改分享范围 + async saveShare() { + //修改分享范围 // const { data, code, message } = await this.$request.fetchAnswerList({ // ...this.shareForm, // }); @@ -288,20 +334,22 @@ export default { // this.$message.error(message); // } }, - async recovery(item) {//归档 + async recovery(item) { + //归档 // const { data, code, message } = await this.$request.fetchAnswerList({ // ...this.shareForm, // }); // if (code === 0) { - this.tableData = this.tableData.filter(items=>{ - return items.id != item.id - }) + this.tableData = this.tableData.filter((items) => { + return items.id != item.id; + }); // } else { // this.$message.error(message); // } }, - async changClazz() {//切换班级 + async changClazz() { + //切换班级 await this._QuerySubjectList(); this._QueryData(); }, @@ -348,7 +396,8 @@ export default { this.$message.error(message); } }, - async _QueryData(type) {//获取答题卡列表 + async _QueryData(type) { + //获取答题卡列表 let query = {}; if (!type) { this.query.title = ""; @@ -387,73 +436,6 @@ export default { \ No newline at end of file diff --git a/src/views/layout/header/header.vue b/src/views/layout/header/header.vue index e4770f6..40c1168 100644 --- a/src/views/layout/header/header.vue +++ b/src/views/layout/header/header.vue @@ -126,7 +126,6 @@ export default { }, handleCommand(command) { //刷新权限跳转首页 - this.$message("click on item " + command); this.$store.dispatch("permissions", this); }, logOut() { diff --git a/src/views/layout/layout.vue b/src/views/layout/layout.vue index a45838d..b9395a0 100644 --- a/src/views/layout/layout.vue +++ b/src/views/layout/layout.vue @@ -22,6 +22,7 @@ import layoutAside from "./aside/aside"; import layoutHeader from "./header/header"; import Bottom from "./Footer/bottom"; import langSelect from "../../components/lang/langSelect"; +import { getURLParams } from "@/utils"; export default { name: "layout", @@ -31,6 +32,39 @@ export default { langSelect, layoutAside, }, + data() { + return { + code: "", + }; + }, + created() { + this.code = getURLParams("code") || ""; + if (this.code) { + localStorage.setItem("code",this.code) + this._LoginCheck(); + } + }, + methods: { + async _LoginCheck() { + let params = {}; + if (this.code) { + params = { + code: this.code, + }; + } + const { data = {}, message, code } = await loginCheck(params); + if (code === 0) { + if (data) { + this.school = data.schoolName; + this.user.name = data.realName; + this.user.id = data.id; + this.user.tx = data.smallHeaderImgPath; + } + } else { + this.$message.error(message); + } + }, + }, }; @@ -81,7 +115,7 @@ ul.el-menu { #elmain { background-color: #fff; - padding:0; + padding: 0; } .avatar-uploader .el-upload { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index f88c757..8c0df5a 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -101,8 +101,12 @@ export default { { required: true, message: "请输入账号密码",trigger: "blur" } ] }, + url: "", }; }, + created() { + this.url = this.$route.query?.url || ""; + }, methods: { showPwd() { if (this.passwordType === "password") { @@ -115,7 +119,6 @@ export default { }); }, submitForm() { - let that = this; if (this.loginForm.username === "" || this.loginForm.password === "") { this.$message({ showClose: true, @@ -124,7 +127,7 @@ export default { }); return false; } else { - this.$store.dispatch("Login",this) + this.$store.dispatch("Login",{...this.loginForm,url:this.url}) } }, }, -- libgit2 0.21.4