pull/13/head
zcxee 1 year ago
parent ca533e85e3
commit 15622a2e5a
  1. 9
      .env.development
  2. 26
      src/api/question.js
  3. 2
      src/permission.js
  4. 325
      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 = 莳松管理系统 VUE_APP_TITLE = 莳松管理系统
@ -7,5 +14,7 @@ ENV = 'development'
# 莳松管理系统/开发环境 # 莳松管理系统/开发环境
VUE_APP_BASE_API = '/dev-api' VUE_APP_BASE_API = '/dev-api'
JWL_API = ''
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true 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 showSpinner: false
}); });
const whiteList = ['/login', '/auth-redirect', '/bind', '/register']; const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/question'];
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start(); NProgress.start();

@ -30,170 +30,175 @@ import Layout from '@/layout';
// 公共路由 // 公共路由
export const constantRoutes = [{ export const constantRoutes = [{
path: '/redirect', path: '/redirect',
component: Layout, component: Layout,
hidden: true, hidden: true,
children: [{ children: [{
path: '/redirect/:path(.*)', path: '/redirect/:path(.*)',
component: () => import('@/views/redirect') component: () => import('@/views/redirect')
}] }]
}, },
{ {
path: '/login', path: '/login',
component: () => import('@/views/login'), component: () => import('@/views/login'),
hidden: true hidden: true
}, },
{ {
path: '/register', path: '/register',
component: () => import('@/views/register'), component: () => import('@/views/register'),
hidden: true hidden: true
}, },
{ {
path: '/404', path: '/question',
component: () => import('@/views/error/404'), component: () => import('@/views/question'),
hidden: true hidden: true
}, },
{ {
path: '/401', path: '/404',
component: () => import('@/views/error/401'), component: () => import('@/views/error/404'),
hidden: true hidden: true
}, },
{ {
path: '', path: '/401',
component: Layout, component: () => import('@/views/error/401'),
redirect: 'index', hidden: true
children: [{ },
path: 'index', {
component: () => import('@/views/index'), path: '',
name: 'Index', component: Layout,
meta: { redirect: 'index',
title: '首页', children: [{
icon: 'dashboard', path: 'index',
affix: true component: () => import('@/views/index'),
} name: 'Index',
}] meta: {
}, title: '首页',
// { icon: 'dashboard',
// path: '/demo', affix: true
// component: Layout, }
// redirect: 'noredirect', }]
// meta: { },
// title: 'Demo', // {
// icon: 'xx' // path: '/demo',
// }, // component: Layout,
// children: [{ // redirect: 'noredirect',
// path: '/base-page', // meta: {
// component: () => import('@/views/demo/basePage/index'), // title: 'Demo',
// name: 'BasePage', // icon: 'xx'
// meta: { // },
// title: 'BasePage', // children: [{
// icon: 'xx' // path: '/base-page',
// } // component: () => import('@/views/demo/basePage/index'),
// }, // name: 'BasePage',
// { // meta: {
// path: '/base-components', // title: 'BasePage',
// component: () => import('@/views/demo/baseComponents/index'), // icon: 'xx'
// name: 'BaseComponents', // }
// meta: { // },
// title: 'BaseComponents', // {
// icon: 'xx' // path: '/base-components',
// } // component: () => import('@/views/demo/baseComponents/index'),
// } // name: 'BaseComponents',
// ] // meta: {
// }, // title: 'BaseComponents',
{ // icon: 'xx'
path: '/user', // }
component: Layout, // }
hidden: true, // ]
redirect: 'noredirect', // },
children: [{ {
path: 'profile', path: '/user',
component: () => import('@/views/system/user/profile/index'), component: Layout,
name: 'Profile', hidden: true,
meta: { redirect: 'noredirect',
title: '个人中心', children: [{
icon: 'user' path: 'profile',
} component: () => import('@/views/system/user/profile/index'),
}] name: 'Profile',
} meta: {
title: '个人中心',
icon: 'user'
}
}]
}
]; ];
// 动态路由,基于用户权限动态去加载 // 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [{ export const dynamicRoutes = [{
path: '/system/user-auth', path: '/system/user-auth',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:user:edit'], permissions: ['system:user:edit'],
children: [{ children: [{
path: 'role/:userId(\\d+)', path: 'role/:userId(\\d+)',
component: () => import('@/views/system/user/authRole'), component: () => import('@/views/system/user/authRole'),
name: 'AuthRole', name: 'AuthRole',
meta: { meta: {
title: '分配角色', title: '分配角色',
activeMenu: '/system/user' activeMenu: '/system/user'
} }
}] }]
}, },
{ {
path: '/system/role-auth', path: '/system/role-auth',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:role:edit'], permissions: ['system:role:edit'],
children: [{ children: [{
path: 'user/:roleId(\\d+)', path: 'user/:roleId(\\d+)',
component: () => import('@/views/system/role/authUser'), component: () => import('@/views/system/role/authUser'),
name: 'AuthUser', name: 'AuthUser',
meta: { meta: {
title: '分配用户', title: '分配用户',
activeMenu: '/system/role' activeMenu: '/system/role'
} }
}] }]
}, },
{ {
path: '/system/dict-data', path: '/system/dict-data',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:dict:list'], permissions: ['system:dict:list'],
children: [{ children: [{
path: 'index/:dictId(\\d+)', path: 'index/:dictId(\\d+)',
component: () => import('@/views/system/dict/data'), component: () => import('@/views/system/dict/data'),
name: 'Data', name: 'Data',
meta: { meta: {
title: '字典数据', title: '字典数据',
activeMenu: '/system/dict' activeMenu: '/system/dict'
} }
}] }]
}, },
{ {
path: '/monitor/job-log', path: '/monitor/job-log',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['monitor:job:list'], permissions: ['monitor:job:list'],
children: [{ children: [{
path: 'index', path: 'index',
component: () => import('@/views/monitor/job/log'), component: () => import('@/views/monitor/job/log'),
name: 'JobLog', name: 'JobLog',
meta: { meta: {
title: '调度日志', title: '调度日志',
activeMenu: '/monitor/job' activeMenu: '/monitor/job'
} }
}] }]
}, },
{ {
path: '/zs/clue-form', path: '/zs/clue-form',
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['zs:clue:add', 'zs:clue:edit'], permissions: ['zs:clue:add', 'zs:clue:edit'],
children: [{ children: [{
path: 'index/:clueId(\\d+)', path: 'index/:clueId(\\d+)',
component: () => import('@/views/zs/clue/ClueForm'), component: () => import('@/views/zs/clue/ClueForm'),
name: 'ClueForm', name: 'ClueForm',
meta: { meta: {
title: '线索详情', title: '线索详情',
activeMenu: '/zs/clue' activeMenu: '/zs/clue'
} }
}] }]
} }
]; ];
// 防止连续点击多次路由报错 // 防止连续点击多次路由报错

@ -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, port: port,
open: true, open: true,
proxy: { 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 // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
// target: `https://xueche.ahduima.com/duima/`, target: `https://xueche.ahduima.com/duima/`,
target: `http://localhost:8086`, // target: `http://localhost:8086`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''
} }
} }
}, },
disableHostCheck: true disableHostCheck: true
}, },

Loading…
Cancel
Save