|
@@ -1,26 +1,5 @@
|
|
|
-<style lang="scss">
|
|
|
- .apply{
|
|
|
- .filter{
|
|
|
- background: #fff;
|
|
|
- padding: 20px 20px 10px;
|
|
|
- border:1px solid #EDEDED;
|
|
|
- border-radius:2px;
|
|
|
- margin-bottom: 10px;
|
|
|
- margin-top: 10px;
|
|
|
- .el-form-item{
|
|
|
- margin-bottom: 10px;
|
|
|
- }
|
|
|
- .el-input,.el-select{
|
|
|
- width: 150px;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- thead{
|
|
|
- th{
|
|
|
- background: #eee;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+<style lang="scss" scoped>
|
|
|
+
|
|
|
</style>
|
|
|
<template>
|
|
|
<section class="apply">
|
|
@@ -36,13 +15,10 @@
|
|
|
|
|
|
<el-form-item>
|
|
|
<el-button @click="getData" type="primary" icon="el-icon-search">搜索</el-button>
|
|
|
- <el-button type="primary">新增</el-button>
|
|
|
<el-button @click="dialogVisible=true" type="primary">导入</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
<el-table
|
|
|
class="table"
|
|
|
:data="list" height="450px"
|
|
@@ -65,36 +41,86 @@
|
|
|
label="满分">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
+ prop="paper_type"
|
|
|
+ label="试卷类型">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag type="success" v-if="scope.row.paper_type=='train'">练习</el-tag>
|
|
|
+ <el-tag type="warning" v-if="scope.row.paper_type=='exam'">考试</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="status"
|
|
|
+ label="状态">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag type="success" v-if="scope.row.status==2">已发布</el-tag>
|
|
|
+ <el-tag type="warning" v-if="scope.row.status==1">编辑中</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
prop="ctime"
|
|
|
label="创建时间">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="zip" width="250"
|
|
|
label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button @click="$router.push({path:'/papers/detail',query:{id:scope.row.id}})" size="mini" type="success">查看</el-button>
|
|
|
- <el-button size="mini" type="warning">编辑</el-button>
|
|
|
- <el-button @click="del(scope.row.id)" size="mini" type="danger">删除</el-button>
|
|
|
- </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button @click="$router.push({path:'/papers/detail',query:{id:scope.row.id}})" size="mini" type="success">查看</el-button>
|
|
|
+ <el-button @click="openAddEdit(scope.row)" size="mini" type="warning">编辑</el-button>
|
|
|
+ <el-button @click="del(scope.row.id)" size="mini" type="danger">删除</el-button>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<Page ref="pageButton" :total='total' @pageChange='gopage'/>
|
|
|
-
|
|
|
+ <!--试卷导入-->
|
|
|
<el-dialog
|
|
|
title="导入试卷" center
|
|
|
:visible.sync="dialogVisible"
|
|
|
width="40%">
|
|
|
- <p style="text-align:center;">请先下载模板,按模板格式填写好试题数据然后上传。
|
|
|
- <a style="color:#409eff;" href="https://www.scxjc.club/paper.xlsx">点击下载模板</a>
|
|
|
- <br> <br>
|
|
|
- <input style="width:160px" id='file' type="file">
|
|
|
- </p>
|
|
|
-
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button size="small" @click="dialogVisible = false">取 消</el-button>
|
|
|
- <el-button size="small" type="primary" @click="upload('file')">确 定</el-button>
|
|
|
- </span>
|
|
|
+ <p style="text-align:center;">请先下载模板,按模板格式填写好试题数据然后上传。
|
|
|
+ <a style="color:#409eff;" href="https://www.scxjc.club/paper.xlsx">点击下载模板</a>
|
|
|
+ <br> <br>
|
|
|
+ <input style="width:160px" id='file' type="file">
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="upload('file')">确 定</el-button>
|
|
|
+ </span>
|
|
|
</el-dialog>
|
|
|
+ <!--新增/编辑试卷-->
|
|
|
+ <el-dialog
|
|
|
+ title="新增/编辑试卷" center
|
|
|
+ :visible.sync="addEditDialogVisible"
|
|
|
+ width="40%">
|
|
|
+ <el-form v-model="addEditForm" label-width="80px" size="small">
|
|
|
+ <el-form-item label="试卷名称">
|
|
|
+ <el-input placeholder="试卷名称" v-model="addEditForm.title"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="考试时间">
|
|
|
+ <el-input placeholder="考试时间" v-model="addEditForm.total_time"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="满分">
|
|
|
+ <el-input placeholder="满分" v-model="addEditForm.total_score"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="试卷类型">
|
|
|
+ <el-select v-model="addEditForm.paper_type">
|
|
|
+ <el-option label="练习" value="train"></el-option>
|
|
|
+ <el-option label="考试" value="exam"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="状态">
|
|
|
+ <el-select v-model="addEditForm.status">
|
|
|
+ <el-option label="编辑中" :value="1"></el-option>
|
|
|
+ <el-option label="已发布" :value="2"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click="addEditDialogVisible=false">取消</el-button>
|
|
|
+ <el-button @click="saveAddEdit" type="primary">保存</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</section>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -111,7 +137,12 @@ export default {
|
|
|
total:1,
|
|
|
list:[],
|
|
|
loading:false,
|
|
|
- dialogVisible:false
|
|
|
+ dialogVisible:false,
|
|
|
+ addEditDialogVisible:false,
|
|
|
+ addEditForm:{
|
|
|
+ paper_type:"train",
|
|
|
+ status:1
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
@@ -124,6 +155,7 @@ export default {
|
|
|
},
|
|
|
subChange(data){
|
|
|
this.form.subject_item=data.join('|')
|
|
|
+ this.getData();
|
|
|
},
|
|
|
getData(){
|
|
|
var parm=this.form;
|
|
@@ -161,6 +193,27 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ openAddEdit(row){
|
|
|
+ this.addEditDialogVisible = true;
|
|
|
+ this.$api.getPaper({id:row.id,type:1}).then(res=>{
|
|
|
+ this.addEditForm = res.data.data;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveAddEdit(){
|
|
|
+ if(this.addEditForm.id){
|
|
|
+ this.$api.updatePaper(this.addEditForm).then(res=>{
|
|
|
+ if(!res.data.code){
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功!',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.addEditDialogVisible = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
created(){
|
|
|
this.getData()
|