dev-qsh
zcxee 1 year ago
parent ca533e85e3
commit 15622a2e5a
  1. 9
      .env.development
  2. 26
      src/api/question.js
  3. 2
      src/permission.js
  4. 5
      src/router/index.js
  5. 174
      src/views/question/components/QuestionForm.vue
  6. 101
      src/views/question/index.vue
  7. 13
      vue.config.js

@ -1,3 +1,10 @@
###
# @Author: riverQiu
# @Date: 2023-08-16 22:04:23
# @LastEditors: riverQiu
# @LastEditTime: 2023-08-18 23:22:27
# @Description:
###
# 页面标题
VUE_APP_TITLE = 莳松管理系统
@ -7,5 +14,7 @@ ENV = 'development'
# 莳松管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
JWL_API = ''
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

@ -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
});
}

@ -16,7 +16,7 @@ NProgress.configure({
showSpinner: false
});
const whiteList = ['/login', '/auth-redirect', '/bind', '/register'];
const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/question'];
router.beforeEach((to, from, next) => {
NProgress.start();

@ -48,6 +48,11 @@ export const constantRoutes = [{
component: () => import('@/views/register'),
hidden: true
},
{
path: '/question',
component: () => import('@/views/question'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/error/404'),

@ -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>

@ -33,15 +33,24 @@ module.exports = {
port: port,
open: true,
proxy: {
[process.env.VUE_APP_BASE_API + '/driver-api']: {
// target: `https://xueche.ahduima.com/duima/`,
target: `http://localhost:8888/driver-api/`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API + '/driver-api']: ''
}
},
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
// target: `https://xueche.ahduima.com/duima/`,
target: `http://localhost:8086`,
target: `https://xueche.ahduima.com/duima/`,
// target: `http://localhost:8086`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
}
}
},
disableHostCheck: true
},

Loading…
Cancel
Save