forked from qiushanhe/dm-manage-web
dev-qsh
parent
ca533e85e3
commit
15622a2e5a
@ -0,0 +1,26 @@ |
||||
/* |
||||
* @Author: riverQiu |
||||
* @Date: 2023-08-17 20:30:56 |
||||
* @LastEditors: riverQiu |
||||
* @LastEditTime: 2023-08-19 00:26:04 |
||||
* @Description: |
||||
*/ |
||||
import request from '@/utils/request'; |
||||
|
||||
// 获取首页统计信息
|
||||
export function searchQuestion(param) { |
||||
return request({ |
||||
url: '/driver-api/tdQuestion/duima/list', |
||||
method: 'get', |
||||
params: param |
||||
}); |
||||
} |
||||
|
||||
export function updateQuestion(data) { |
||||
return request({ |
||||
url: '/driver-api/tdQuestion/duima/update', |
||||
method: 'put', |
||||
data: data |
||||
}); |
||||
} |
||||
|
@ -0,0 +1,174 @@ |
||||
<template> |
||||
<el-dialog title="试题" :close-on-click-modal="false" append-to-body :visible.sync="visible" width="800px" @close="closeDialog"> |
||||
<div> |
||||
<el-form ref="dialogForm" :model="dialogForm" :rules="dataRule" label-position="left" @keyup.enter.native="dialogFormSubmit()"> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="题库" prop="question"> |
||||
<span>{{ dialogForm.question }}</span> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="选项" prop="question"> |
||||
<span v-if="dialogForm.chooseA">a:{{ dialogForm.chooseA }}<span> |
||||
<span v-if="dialogForm.chooseB">b:{{ dialogForm.chooseB }} </span> |
||||
<span v-if="dialogForm.chooseC">c:{{ dialogForm.chooseC }} </span> |
||||
<span v-if="dialogForm.chooseD">d:{{ dialogForm.chooseD }}</span> |
||||
<span v-if="dialogForm.chooseE">e:{{ dialogForm.chooseE }}</span> |
||||
<span v-if="dialogForm.chooseF">f:{{ dialogForm.chooseF }}</span> |
||||
<span v-if="dialogForm.chooseG">g:{{ dialogForm.chooseG }}</span> |
||||
</span></span></el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="答案" prop="trueAnswer"> |
||||
<span>{{ dialogForm.trueAnswer }}</span> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="科目" prop="subject"> |
||||
<span v-if="dialogForm.subject == 1">科一</span> |
||||
<span v-if="dialogForm.subject == 4">科四</span> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="8"> |
||||
<el-form-item label="精选500题" prop="isVip"> |
||||
<el-radio-group v-model="dialogForm.isVip" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="精选600题" prop="isVip2"> |
||||
<el-radio-group v-model="dialogForm.isVip2" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="是否易错题" prop="isError"> |
||||
<el-radio-group v-model="dialogForm.isError" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="是否新规" prop="isNew"> |
||||
<el-radio-group v-model="dialogForm.isNew" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="是否密卷1" prop="isExam1"> |
||||
<el-radio-group v-model="dialogForm.isExam1" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="是否密卷2" prop="isExam2"> |
||||
<el-radio-group v-model="dialogForm.isExam2" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="考点" prop="examKeys"> |
||||
<el-input v-model="dialogForm.examKeys" maxlength="200" placeholder="请输入考点" clearable /> |
||||
<span style="color:red;">包含多个考点,以英文";"分割!</span> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
|
||||
</div> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button plain @click="(visible=false)">取消</el-button> |
||||
<el-button v-jclick type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import { updateQuestion } from '@/api/question'; |
||||
|
||||
export default { |
||||
data () { |
||||
return { |
||||
visible: false, |
||||
canSubmit: true, |
||||
dialogForm: { |
||||
questionId: undefined, |
||||
isVip: 0, |
||||
isVip2: 0, |
||||
isError: 0, |
||||
isNew: 0, |
||||
isExam1: 0, |
||||
isExam2: 0, |
||||
examKeys: undefined |
||||
}, |
||||
dataRule: { |
||||
schoolName: [{ required: true, message: '驾校名称不能为空', trigger: 'blur' }], |
||||
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }] |
||||
} |
||||
}; |
||||
}, |
||||
methods: { |
||||
init (info = undefined) { |
||||
// debugger |
||||
this.visible = true; |
||||
this.$nextTick(() => { |
||||
this.resetDialogForm(); |
||||
// this.$refs['dialogForm'].resetFields(); |
||||
if (info) { |
||||
this.dialogForm = this.deepClone(info); |
||||
} |
||||
}); |
||||
}, |
||||
resetDialogForm () { |
||||
this.dialogForm = { |
||||
questionId: undefined, |
||||
isVip: 0, |
||||
isVip2: 0, |
||||
isError: 0, |
||||
isNew: 0, |
||||
isExam1: 0, |
||||
isExam2: 0, |
||||
examKeys: undefined |
||||
}; |
||||
}, |
||||
closeDialog () { |
||||
this.$emit('update:dialogVisible', false); |
||||
}, |
||||
// 表单提交 |
||||
dialogFormSubmit () { |
||||
this.$refs.dialogForm.validate((valid) => { |
||||
if (valid) { |
||||
updateQuestion(this.dialogForm).then(response => { |
||||
if (response.code == 200) { |
||||
this.$modal.msgSuccess('修改成功'); |
||||
// this.visible = true; |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
@ -0,0 +1,101 @@ |
||||
<template> |
||||
<div class="app-container" style="text-align:center"> |
||||
<el-form size="small" :inline="true" label-width="68px"> |
||||
<el-form-item label="题目"> |
||||
<el-input v-model="queryParams.question" placeholder="请输入题目" clearable style="width:400px" @keyup.enter.native="handleQuery" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-table v-loading="loading" :data="tableList" style="width:80%;margin:auto" @row-click="handleEdit"> |
||||
<el-table-column type="index" width="55" align="center" /> |
||||
<el-table-column label="题目" align="center" prop="question" min-width="140" /> |
||||
<el-table-column label="选项" align="center" min-width="140"> |
||||
<template slot-scope="{row}"> |
||||
<p v-if="row.chooseA">a:{{ row.chooseA }}</p> |
||||
<p v-if="row.chooseB">b:{{ row.chooseB }}</p> |
||||
<p v-if="row.chooseC">c:{{ row.chooseC }}</p> |
||||
<p v-if="row.chooseD">d:{{ row.chooseD }}</p> |
||||
<p v-if="row.chooseE">e:{{ row.chooseE }}</p> |
||||
<p v-if="row.chooseF">f:{{ row.chooseF }}</p> |
||||
<p v-if="row.chooseG">g:{{ row.chooseG }}</p> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="答案" align="center" prop="trueAnswer" min-width="100" /> |
||||
<el-table-column label="科目" align="center" prop="subject" min-width="100"> |
||||
<template slot-scope="{row}"> |
||||
<p v-if="row.subject == 1">科一</p> |
||||
<p v-if="row.subject == 4">科四</p> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
||||
<template slot-scope="scope"> |
||||
<el-button size="mini" type="text" icon="el-icon-download" @click="handleEdit(scope.row)">编辑</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
|
||||
<!-- <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> --> |
||||
<QuestionForm v-if="dialogVisible" ref="dialogForm" :dialog-visible="dialogVisible" @refreshDataList="getList" /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { searchQuestion } from '@/api/question'; |
||||
import QuestionForm from './components/QuestionForm.vue'; |
||||
|
||||
export default { |
||||
name: 'Question', |
||||
components: { |
||||
QuestionForm |
||||
}, |
||||
data () { |
||||
return { |
||||
// 遮罩层 |
||||
loading: false, |
||||
// 总条数 |
||||
total: 0, |
||||
tableList: [], |
||||
// 查询参数 |
||||
queryParams: { |
||||
question: '' |
||||
}, |
||||
dialogVisible: false |
||||
}; |
||||
}, |
||||
created () { |
||||
// this.getList(); |
||||
}, |
||||
methods: { |
||||
/** 查询文件列表 */ |
||||
getList () { |
||||
this.loading = true; |
||||
searchQuestion(this.queryParams).then(response => { |
||||
this.tableList = response.data; |
||||
// this.total = response.total; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
|
||||
/** 搜索按钮操作 */ |
||||
handleQuery () { |
||||
this.getList(); |
||||
}, |
||||
/** 重置按钮操作 */ |
||||
resetQuery () { |
||||
this.queryParams.question = ''; |
||||
this.handleQuery(); |
||||
}, |
||||
handleEdit (item) { |
||||
this.dialogVisible = true; |
||||
this.$nextTick(() => { |
||||
this.$refs.dialogForm.init(item); |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
Loading…
Reference in new issue