New file |
| | |
| | | import axios from "./request"; |
| | | |
| | | // 获取考试分页 |
| | | export const getExams = (params) => { |
| | | return axios({ |
| | | url: "/api/exam/page", |
| | | method: "GET", |
| | | params: params |
| | | }) |
| | | } |
| | | |
| | | // 获取考试列表 |
| | | export const getExamList = () => { |
| | | return axios({ |
| | | url: "/api/exam/list", |
| | | method: "GET" |
| | | }) |
| | | } |
| | | |
| | | // 通过id获取考试 |
| | | export const getExamById = (params) => { |
| | | return axios({ |
| | | url: "/api/exam/" + params, |
| | | method: "GET" |
| | | }) |
| | | } |
| | | |
| | | // 通过id删除考试 |
| | | export const deleteExamById = (params) => { |
| | | return axios({ |
| | | url: "/api/exam/" + params, |
| | | method: "DELETE" |
| | | }) |
| | | } |
| | | |
| | | // 批量删除考试 |
| | | export const deleteExamByIds = (params) => { |
| | | return axios({ |
| | | url: "/api/exam/batch", |
| | | method: "DELETE", |
| | | data: params |
| | | }) |
| | | } |
| | | |
| | | // 修改考试 |
| | | export const editExam = (params) => { |
| | | return axios({ |
| | | url: "/api/exam/", |
| | | method: "PUT", |
| | | data: params |
| | | }) |
| | | } |
| | | |
| | | // 添加考试 |
| | | export const addExam = (params) => { |
| | | return axios({ |
| | | url: "/api/exam/", |
| | | method: "POST", |
| | | data: params |
| | | }) |
| | | } |
| | |
| | | ] |
| | | }, |
| | | { |
| | | path: '/exam', |
| | | component: Layout, |
| | | children: [ |
| | | { |
| | | path: '/manage', |
| | | component: () => import('@/views/exam/exam/ExamManage'), |
| | | name: 'Exam', |
| | | meta: { title: '考试管理', icon: 'exam', affix: true } |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | path: '/user', |
| | | component: Layout, |
| | | name: 'UserPage', |
| | |
| | | <template> |
| | | <div class="c"> |
| | | <div class="bg"> |
| | | <div class="main"> |
| | | <div class="main-1"> |
| | | <div class="main-btn"> |
| | | <el-button |
| | | type="primary" |
| | | @click="openAdd" |
| | | >安排考试 |
| | | </el-button> |
| | | <div class="app-container"> |
| | | <div style="display: flex; flex-direction: row"> |
| | | <div> |
| | | <el-button type="primary" size="small" style="margin-right: 10px" @click="openAdd">安排考试</el-button> |
| | | </div> |
| | | <div> |
| | | <el-form :inline="true" :model="searchForm" class="demo-form-inline"> |
| | | <el-form-item label="考试名称"> |
| | | <el-input v-model="searchForm.examName" @input="page" clearable size="small" clearable @clear="page" placeholder="班级名称"></el-input> |
| | | <el-input v-model="searchForm.examName" @input="page" clearable size="small" clearable @clear="page" |
| | | placeholder="班级名称"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="参考班级"> |
| | | <el-select v-model="searchForm.classesId" @change="page" clearable @clear="page"> |
| | | <el-option v-for="classes in classesList" :key="classes.id" :value="classes.id" :label="classes.className"/> |
| | | <el-option v-for="classes in classesList" :key="classes.id" :value="classes.id" |
| | | :label="classes.className"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="page" size="small">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div> |
| | | <el-table :data="tableData"> |
| | | </div> |
| | | </div> |
| | | <el-table :data="tableData" border> |
| | | <el-table-column |
| | | label="考试名称" |
| | | prop="examName" |
| | |
| | | :formatter="statusFormatter" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | label="创建时间" |
| | | width="150px" |
| | | prop="createTime" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | label="考试时间" |
| | | width="200px" |
| | | width="180px" |
| | | algin="center" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | <div>{{scope.row.endTime}}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" fiexd="right" width="150px"> |
| | | <el-table-column |
| | | label="创建时间" |
| | | width="150px" |
| | | prop="createTime" |
| | | ></el-table-column> |
| | | <el-table-column label="操作" fiexd="right" width="210px"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | type="primary" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <div |
| | | class="flex" |
| | | style="justify-content:center;margin-top:20px;" |
| | |
| | | <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageIndex" :limit.sync="searchForm.pageSize" |
| | | @pagination="page"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <el-dialog width="500px" :title="title" @close="closeHandler" :visible.sync="open" :destroy-on-close="true" |
| | | :append-to-body="true" :close-on-click-modal="false"> |
| | | <el-form :model="examForm" :rules="examRules" ref="examForm"> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="考试试卷" :label-width="formLabelWidth" prop="examPaperId"> |
| | | <el-select v-model="examForm.examPaperId" :disabled="!examForm.examPaperType" placeholder="请先选择试卷类型"> |
| | | <el-option v-for="examPaper in examPaperList" :key="examPaper.id" :value="examPaper.id" :label="examPaper.name"/> |
| | | <el-option v-for="examPaper in examPaperList" :key="examPaper.id" :value="examPaper.id" |
| | | :label="examPaper.name"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="开始时间" :label-width="formLabelWidth" prop="time"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import Pagination from "@/components/Pagination" |
| | | import { getExams, addExam, editExam, deleteExamById } from "@/api/exam" |
| | | import { myClasses } from "@/api/classes" |
| | | import examPaperAPI from "@/api/examPaper" |
| | | import Pagination from '@/components/Pagination' |
| | | import { getExams, addExam, editExam, deleteExamById } from '@/api/exam' |
| | | import { myClasses } from '@/api/classes' |
| | | import examPaperAPI from '@/api/examPaper' |
| | | |
| | | export default { |
| | | components: { Pagination }, |
| | | data() { |
| | | return { |
| | | formLabelWidth: "80px", |
| | | formLabelWidth: '80px', |
| | | classesList: [], |
| | | examPaperList: [], |
| | | examForm: { |
| | | id: null, |
| | | examName: "", |
| | | examPaperId: "", |
| | | classesId: "", |
| | | examName: '', |
| | | examPaperId: '', |
| | | classesId: '', |
| | | examPaperType: null, |
| | | examPlace: "", |
| | | status: "", |
| | | startTime: "", |
| | | endTime: "", |
| | | examPlace: '', |
| | | status: '', |
| | | startTime: '', |
| | | endTime: '', |
| | | time: [], |
| | | }, |
| | | examRules: { |
| | |
| | | ], |
| | | }, |
| | | total: 0, |
| | | title: "安排考试", |
| | | title: '安排考试', |
| | | open: false, |
| | | searchForm: { |
| | | examName: "", |
| | | examName: '', |
| | | subject: null, |
| | | pageIndex: 1, |
| | | pageSize: 10 |
| | | }, |
| | | tableData: [ |
| | | ], |
| | | }; |
| | | tableData: [], |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.page(); |
| | | this.page() |
| | | this.getMyClasses() |
| | | this.MyExamPaperList() |
| | | }, |
| | | methods: { |
| | | markPaper(row) { |
| | | // 跳转阅卷页面 |
| | | this.$router.push({path: "/exam/mark/paper", query: {examName: row.examName, examId: row.id}}) |
| | | this.$router.push({ path: '/exam/mark/paper', query: { examName: row.examName, examId: row.id } }) |
| | | }, |
| | | timeFormatter(row) { |
| | | return row.startTime + "至" + row.endTime |
| | | return row.startTime + '至' + row.endTime |
| | | }, |
| | | statusFormatter(row) { |
| | | if (row.status === "ing") { |
| | | return "进行中" |
| | | } else if (row.status === "not_start") { |
| | | return "未开始" |
| | | } else if (row.status === "finished") { |
| | | return "已结束" |
| | | if (row.status === 'ing') { |
| | | return '进行中' |
| | | } else if (row.status === 'not_start') { |
| | | return '未开始' |
| | | } else if (row.status === 'finished') { |
| | | return '已结束' |
| | | } |
| | | }, |
| | | MyExamPaperList() { |
| | | let param = { |
| | | "paperType": this.examForm.examPaperType |
| | | 'paperType': this.examForm.examPaperType |
| | | } |
| | | examPaperAPI.myExamPaperList(param).then(res => { |
| | | this.examForm.examPaperId = null |
| | |
| | | }, |
| | | deleteExam(id) { |
| | | deleteExamById(id).then(res => { |
| | | this.$message.success("删除成功") |
| | | this.$message.success('删除成功') |
| | | this.page() |
| | | }) |
| | | }, |
| | | handlerEdit(row) { |
| | | this.examForm = row |
| | | this.examForm.time = [row.startTime, row.endTime] |
| | | this.title = "修改考试" |
| | | this.title = '修改考试' |
| | | this.open = true |
| | | }, |
| | | addOrEditExam() { |
| | |
| | | editExam(this.examForm).then(res => { |
| | | this.open = false |
| | | this.clearForm() |
| | | this.$message.success("操作成功") |
| | | this.$message.success('操作成功') |
| | | this.page() |
| | | }) |
| | | } else { |
| | | addExam(this.examForm).then(res => { |
| | | this.open = false |
| | | this.clearForm() |
| | | this.$message.success("操作成功") |
| | | this.$message.success('操作成功') |
| | | this.page() |
| | | }) |
| | | } |
| | |
| | | clearForm() { |
| | | this.examForm = { |
| | | id: null, |
| | | examName: "", |
| | | examPaperId: "", |
| | | classesId: "", |
| | | examPaperType: "", |
| | | examPlace: "", |
| | | status: "", |
| | | startTime: "", |
| | | endTime: "", |
| | | examName: '', |
| | | examPaperId: '', |
| | | classesId: '', |
| | | examPaperType: '', |
| | | examPlace: '', |
| | | status: '', |
| | | startTime: '', |
| | | endTime: '', |
| | | } |
| | | }, |
| | | closeHandler() { |
| | |
| | | this.clearForm() |
| | | }, |
| | | openAdd() { |
| | | this.title = this.examForm.id ? "修改考试" : "安排考试" |
| | | this.title = this.examForm.id ? '修改考试' : '安排考试' |
| | | this.open = true |
| | | }, |
| | | formatterType(row) { |
| | |
| | | }) |
| | | }, |
| | | routerTo(url) { |
| | | this.$router.push(url); |
| | | this.$router.push(url) |
| | | }, |
| | | }, |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .flex { |
| | | display: flex; |
| | | } |
| | | |
| | | .mian-1-top { |
| | | margin: 10px 0; |
| | | align-items: center; |
| | | |
| | | & input { |
| | | height: 30px; |
| | | width: 200px; |
| | | margin-right: 20px; |
| | | } |
| | | } |
| | | |
| | | // .c{ |
| | | // background-image:url('../../assets/img/loginBackground.jpg'); |
| | | // width:100vw; |
| | | // height:calc(100vh - 75px); |
| | | // background-size: cover; |
| | | // } |
| | | // .bg{ |
| | | // width:100%; |
| | | // height:100%; |
| | | // background: rgba(255,255,255,0.2); |
| | | // display: flex; |
| | | // justify-content: center; |
| | | |
| | | // } |
| | | .main { |
| | | &-title { |
| | | border-left: 5px solid rgb(16, 71, 247); |
| | | padding-left: 10px; |
| | | margin: 50px 0; |
| | | |
| | | & p { |
| | | font-weight: 700; |
| | | } |
| | | } |
| | | |
| | | &-1 { |
| | | width: 1227px; |
| | | height: 784px; |
| | | background: white; |
| | | box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.1); |
| | | border-radius: 10px; |
| | | padding: 32px 40px; |
| | | } |
| | | |
| | | &-btn { |
| | | padding-bottom: 32px; |
| | | border-bottom: 3px solid rgb(16, 71, 247); |
| | | } |
| | | } |
| | | |
| | | .deepBlue { |
| | | background: rgb(16, 71, 247); |
| | | color: white; |
| | | border: none; |
| | | |
| | | &:hover { |
| | | background-color: rgb(45, 92, 248); |
| | | } |
| | | } |
| | | </style> |