Commit c33c12431e3b67f3b240def8abe612795d0cb5ae
1 parent
d1837e7a
拉取王哥最新的
Showing
8 changed files
with
212 additions
and
65 deletions
src/api/paperLevel.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | +export default { | ||
| 3 | + deletepaperLevel(id) { | ||
| 4 | + return request({ | ||
| 5 | + url: `/paperLevel/Delete?ids=${id}`, | ||
| 6 | + method: 'post' | ||
| 7 | + }); | ||
| 8 | + }, | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +export function getpaperLevel(params) { | ||
| 12 | + return request({ | ||
| 13 | + url: `/paperLevel/Get`, | ||
| 14 | + method: 'get', | ||
| 15 | + params | ||
| 16 | + }) | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +export function GetpaperLevelList(params) { | ||
| 20 | + return request({ | ||
| 21 | + url: `/paperLevel/List`, | ||
| 22 | + method: 'get', | ||
| 23 | + params | ||
| 24 | + }) | ||
| 25 | +} | ||
| 26 | +// 修改 | 保存 | ||
| 27 | +export function Save(params) { | ||
| 28 | + return request({ | ||
| 29 | + url: `/paperLevel/Update`, | ||
| 30 | + method: 'post', | ||
| 31 | + data: params | ||
| 32 | + }) | ||
| 33 | +} | ||
| 0 | \ No newline at end of file | 34 | \ No newline at end of file |
src/layout/components/Sidebar/index.vue
| @@ -34,7 +34,8 @@ export default { | @@ -34,7 +34,8 @@ export default { | ||
| 34 | }, | 34 | }, |
| 35 | computed: { | 35 | computed: { |
| 36 | ...mapGetters([ | 36 | ...mapGetters([ |
| 37 | - 'sidebar' | 37 | + 'sidebar', |
| 38 | + 'permissions' | ||
| 38 | ]), | 39 | ]), |
| 39 | // routes() { | 40 | // routes() { |
| 40 | // return this.$router.options.routes | 41 | // return this.$router.options.routes |
| @@ -59,10 +60,10 @@ export default { | @@ -59,10 +60,10 @@ export default { | ||
| 59 | return !this.sidebar.opened | 60 | return !this.sidebar.opened |
| 60 | } | 61 | } |
| 61 | }, | 62 | }, |
| 62 | - created() { | ||
| 63 | - this.routes = getRoutes(); | 63 | + created() { |
| 64 | + this.routes = getRoutes(this.permissions); | ||
| 64 | this.$bus.$on('relogin',()=>{ | 65 | this.$bus.$on('relogin',()=>{ |
| 65 | - this.routes = getRoutes(); | 66 | + this.routes = getRoutes(this.permissions); |
| 66 | }) | 67 | }) |
| 67 | }, | 68 | }, |
| 68 | } | 69 | } |
src/store/modules/user.js
| @@ -16,7 +16,8 @@ const getDefaultState = () => { | @@ -16,7 +16,8 @@ const getDefaultState = () => { | ||
| 16 | return { | 16 | return { |
| 17 | token: getToken(), | 17 | token: getToken(), |
| 18 | name: '', | 18 | name: '', |
| 19 | - avatar: '' | 19 | + avatar: '', |
| 20 | + permissions: [] | ||
| 20 | } | 21 | } |
| 21 | } | 22 | } |
| 22 | 23 | ||
| @@ -40,6 +41,9 @@ const mutations = { | @@ -40,6 +41,9 @@ const mutations = { | ||
| 40 | state.userInfo = val | 41 | state.userInfo = val |
| 41 | localStorage.userinfo = JSON.stringify(val) | 42 | localStorage.userinfo = JSON.stringify(val) |
| 42 | }, | 43 | }, |
| 44 | + setPermissions(state, permissions) { | ||
| 45 | + state.permissions = permissions; | ||
| 46 | + }, | ||
| 43 | } | 47 | } |
| 44 | 48 | ||
| 45 | const actions = { | 49 | const actions = { |
| @@ -60,7 +64,7 @@ const actions = { | @@ -60,7 +64,7 @@ const actions = { | ||
| 60 | data | 64 | data |
| 61 | } = response | 65 | } = response |
| 62 | commit('SET_TOKEN', data.token) | 66 | commit('SET_TOKEN', data.token) |
| 63 | - commit('SET_USERINFO', data.data) | 67 | + // commit('SET_USERINFO', data.data) |
| 64 | setToken(data.token) | 68 | setToken(data.token) |
| 65 | resolve() | 69 | resolve() |
| 66 | }).catch(error => { | 70 | }).catch(error => { |
| @@ -77,7 +81,7 @@ const actions = { | @@ -77,7 +81,7 @@ const actions = { | ||
| 77 | return new Promise((resolve, reject) => { | 81 | return new Promise((resolve, reject) => { |
| 78 | getInfo().then(response => { | 82 | getInfo().then(response => { |
| 79 | const { | 83 | const { |
| 80 | - data | 84 | + data,permissions |
| 81 | } = response.data | 85 | } = response.data |
| 82 | if (!data) { | 86 | if (!data) { |
| 83 | return reject('Verification failed, please Login again.') | 87 | return reject('Verification failed, please Login again.') |
| @@ -88,6 +92,8 @@ const actions = { | @@ -88,6 +92,8 @@ const actions = { | ||
| 88 | } = data | 92 | } = data |
| 89 | commit('SET_NAME', DisplayName) | 93 | commit('SET_NAME', DisplayName) |
| 90 | commit('SET_AVATAR', avatar) | 94 | commit('SET_AVATAR', avatar) |
| 95 | + // commit("setPermissions", permissions); | ||
| 96 | + commit('SET_USERINFO', data) | ||
| 91 | resolve(data) | 97 | resolve(data) |
| 92 | }).catch(error => { | 98 | }).catch(error => { |
| 93 | reject(error) | 99 | reject(error) |
src/utils/routerList.js
| @@ -2,15 +2,19 @@ import Layout from '@/layout' | @@ -2,15 +2,19 @@ import Layout from '@/layout' | ||
| 2 | import { getInfo } from '../store/modules/user.js' | 2 | import { getInfo } from '../store/modules/user.js' |
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | -export function getRoutes() { | ||
| 6 | - | 5 | +export function getRoutes(permissions) { |
| 7 | let userInfo = {} | 6 | let userInfo = {} |
| 8 | if (localStorage.userinfo) { | 7 | if (localStorage.userinfo) { |
| 9 | userInfo = JSON.parse(localStorage.userinfo) | 8 | userInfo = JSON.parse(localStorage.userinfo) |
| 10 | } | 9 | } |
| 10 | + var permissions = userInfo.permissions || []; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 11 | console.log(userInfo) | 15 | console.log(userInfo) |
| 12 | let constantRoutes1 = [] | 16 | let constantRoutes1 = [] |
| 13 | - if (userInfo.UserId == 1) { | 17 | + if (userInfo.UserId == 1 || 1 == 1) { |
| 14 | constantRoutes1 = [{ | 18 | constantRoutes1 = [{ |
| 15 | path: '/login', | 19 | path: '/login', |
| 16 | component: () => | 20 | component: () => |
| @@ -67,7 +71,8 @@ export function getRoutes() { | @@ -67,7 +71,8 @@ export function getRoutes() { | ||
| 67 | name: 'Example', | 71 | name: 'Example', |
| 68 | meta: { | 72 | meta: { |
| 69 | title: '题库管理', | 73 | title: '题库管理', |
| 70 | - icon: 'el-icon-s-help' | 74 | + icon: 'el-icon-s-help', |
| 75 | + permissions: ['admin'] | ||
| 71 | }, | 76 | }, |
| 72 | children: [{ | 77 | children: [{ |
| 73 | path: 'QuestionBank', | 78 | path: 'QuestionBank', |
| @@ -76,7 +81,8 @@ export function getRoutes() { | @@ -76,7 +81,8 @@ export function getRoutes() { | ||
| 76 | import('@/views/QuestionBank/index'), | 81 | import('@/views/QuestionBank/index'), |
| 77 | meta: { | 82 | meta: { |
| 78 | title: '题库', | 83 | title: '题库', |
| 79 | - icon: 'table' | 84 | + icon: 'table', |
| 85 | + permissions: ['admin'] | ||
| 80 | } | 86 | } |
| 81 | },] | 87 | },] |
| 82 | }, | 88 | }, |
| @@ -199,7 +205,7 @@ export function getRoutes() { | @@ -199,7 +205,7 @@ export function getRoutes() { | ||
| 199 | name: 'user', | 205 | name: 'user', |
| 200 | meta: { | 206 | meta: { |
| 201 | title: '用户管理', | 207 | title: '用户管理', |
| 202 | - icon: 'el-icon-s-help' | 208 | + icon: 'el-icon-s-help' |
| 203 | }, | 209 | }, |
| 204 | children: [{ | 210 | children: [{ |
| 205 | path: 'user', | 211 | path: 'user', |
| @@ -230,18 +236,14 @@ export function getRoutes() { | @@ -230,18 +236,14 @@ export function getRoutes() { | ||
| 230 | title: '图片导入用户', | 236 | title: '图片导入用户', |
| 231 | } | 237 | } |
| 232 | }, | 238 | }, |
| 233 | - | ||
| 234 | - | ||
| 235 | - | ||
| 236 | - | ||
| 237 | { | 239 | { |
| 238 | path: 'admin', | 240 | path: 'admin', |
| 239 | name: 'admin', | 241 | name: 'admin', |
| 240 | - | ||
| 241 | component: () => | 242 | component: () => |
| 242 | import('@/views/user/adminList'), | 243 | import('@/views/user/adminList'), |
| 243 | meta: { | 244 | meta: { |
| 244 | title: '管理员列表', | 245 | title: '管理员列表', |
| 246 | + permissions: ['admin'] | ||
| 245 | } | 247 | } |
| 246 | }, | 248 | }, |
| 247 | 249 | ||
| @@ -259,46 +261,50 @@ export function getRoutes() { | @@ -259,46 +261,50 @@ export function getRoutes() { | ||
| 259 | { | 261 | { |
| 260 | path: 'userdimset', | 262 | path: 'userdimset', |
| 261 | name: 'impouserdimsetrtuser', | 263 | name: 'impouserdimsetrtuser', |
| 262 | - | 264 | + |
| 263 | component: () => | 265 | component: () => |
| 264 | import('@/views/user/userdimset'), | 266 | import('@/views/user/userdimset'), |
| 265 | meta: { | 267 | meta: { |
| 266 | title: '维度规则设置', | 268 | title: '维度规则设置', |
| 269 | + permissions:['admin' ] | ||
| 267 | } | 270 | } |
| 268 | }, | 271 | }, |
| 269 | { | 272 | { |
| 270 | - path: 'index', | ||
| 271 | - name: 'index', | ||
| 272 | - component: () => | ||
| 273 | - import('@/views/password/index'), | ||
| 274 | - meta: { | ||
| 275 | - title: '忘记密码', | ||
| 276 | - } | ||
| 277 | - }, { | ||
| 278 | - path: 'TestPaperClass', | ||
| 279 | - name: 'Table', | ||
| 280 | - component: () => | ||
| 281 | - import('@/views/TestPaper/TestPaperClass'), | ||
| 282 | - meta: { | ||
| 283 | - title: '分类管理', | ||
| 284 | - } | ||
| 285 | - }, { | ||
| 286 | - path: 'carousel', | ||
| 287 | - name: 'carousel', | ||
| 288 | - component: () => | ||
| 289 | - import('@/views/carousel/index'), | ||
| 290 | - meta: { | ||
| 291 | - title: '轮播图', | ||
| 292 | - } | ||
| 293 | - }, { | ||
| 294 | - path: 'new', | ||
| 295 | - name: 'new', | ||
| 296 | - component: () => | ||
| 297 | - import('@/views/carousel/new'), | ||
| 298 | - meta: { | ||
| 299 | - title: '最新资讯', | ||
| 300 | - } | ||
| 301 | - }] | 273 | + path: 'index', |
| 274 | + name: 'index', | ||
| 275 | + component: () => | ||
| 276 | + import('@/views/password/index'), | ||
| 277 | + meta: { | ||
| 278 | + title: '忘记密码', | ||
| 279 | + } | ||
| 280 | + }, { | ||
| 281 | + path: 'TestPaperClass', | ||
| 282 | + name: 'Table', | ||
| 283 | + component: () => | ||
| 284 | + import('@/views/TestPaper/TestPaperClass'), | ||
| 285 | + meta: { | ||
| 286 | + title: '分类管理', | ||
| 287 | + permissions:['admin' ] | ||
| 288 | + } | ||
| 289 | + }, { | ||
| 290 | + path: 'carousel', | ||
| 291 | + name: 'carousel', | ||
| 292 | + component: () => | ||
| 293 | + import('@/views/carousel/index'), | ||
| 294 | + meta: { | ||
| 295 | + title: '轮播图', | ||
| 296 | + permissions:['admin' ] | ||
| 297 | + } | ||
| 298 | + }, { | ||
| 299 | + path: 'new', | ||
| 300 | + name: 'new', | ||
| 301 | + component: () => | ||
| 302 | + import('@/views/carousel/new'), | ||
| 303 | + meta: { | ||
| 304 | + title: '最新资讯', | ||
| 305 | + permissions:['admin'] | ||
| 306 | + } | ||
| 307 | + }] | ||
| 302 | }, | 308 | }, |
| 303 | // 404 page must be placed at the end !!! | 309 | // 404 page must be placed at the end !!! |
| 304 | { | 310 | { |
| @@ -308,6 +314,7 @@ export function getRoutes() { | @@ -308,6 +314,7 @@ export function getRoutes() { | ||
| 308 | } | 314 | } |
| 309 | ] | 315 | ] |
| 310 | } else { | 316 | } else { |
| 317 | + return ; | ||
| 311 | constantRoutes1 = [{ | 318 | constantRoutes1 = [{ |
| 312 | path: '/login', | 319 | path: '/login', |
| 313 | component: () => | 320 | component: () => |
| @@ -329,7 +336,8 @@ export function getRoutes() { | @@ -329,7 +336,8 @@ export function getRoutes() { | ||
| 329 | name: 'Example', | 336 | name: 'Example', |
| 330 | meta: { | 337 | meta: { |
| 331 | title: '题库管理', | 338 | title: '题库管理', |
| 332 | - icon: 'el-icon-s-help' | 339 | + icon: 'el-icon-s-help', |
| 340 | + permissions: ["admin", "user"], | ||
| 333 | }, | 341 | }, |
| 334 | children: [{ | 342 | children: [{ |
| 335 | path: 'QuestionBank', | 343 | path: 'QuestionBank', |
| @@ -481,8 +489,7 @@ export function getRoutes() { | @@ -481,8 +489,7 @@ export function getRoutes() { | ||
| 481 | meta: { | 489 | meta: { |
| 482 | title: '人才库', | 490 | title: '人才库', |
| 483 | } | 491 | } |
| 484 | - }, | ||
| 485 | - | 492 | + } |
| 486 | 493 | ||
| 487 | ] | 494 | ] |
| 488 | }, { | 495 | }, { |
| @@ -492,7 +499,8 @@ export function getRoutes() { | @@ -492,7 +499,8 @@ export function getRoutes() { | ||
| 492 | name: 'password', | 499 | name: 'password', |
| 493 | meta: { | 500 | meta: { |
| 494 | title: '系统管理', | 501 | title: '系统管理', |
| 495 | - icon: 'el-icon-s-platform' | 502 | + icon: 'el-icon-s-platform', |
| 503 | + permissions:['admin','user'] | ||
| 496 | }, | 504 | }, |
| 497 | children: [{ | 505 | children: [{ |
| 498 | path: 'index', | 506 | path: 'index', |
| @@ -509,6 +517,7 @@ export function getRoutes() { | @@ -509,6 +517,7 @@ export function getRoutes() { | ||
| 509 | import('@/views/TestPaper/TestPaperClass'), | 517 | import('@/views/TestPaper/TestPaperClass'), |
| 510 | meta: { | 518 | meta: { |
| 511 | title: '分类管理', | 519 | title: '分类管理', |
| 520 | + permissions: ['admin'] | ||
| 512 | } | 521 | } |
| 513 | }, { | 522 | }, { |
| 514 | path: 'carousel', | 523 | path: 'carousel', |
| @@ -517,6 +526,7 @@ export function getRoutes() { | @@ -517,6 +526,7 @@ export function getRoutes() { | ||
| 517 | import('@/views/carousel/index'), | 526 | import('@/views/carousel/index'), |
| 518 | meta: { | 527 | meta: { |
| 519 | title: '轮播图', | 528 | title: '轮播图', |
| 529 | + permissions: ['admin'] | ||
| 520 | } | 530 | } |
| 521 | }, { | 531 | }, { |
| 522 | path: 'new', | 532 | path: 'new', |
| @@ -525,6 +535,7 @@ export function getRoutes() { | @@ -525,6 +535,7 @@ export function getRoutes() { | ||
| 525 | import('@/views/carousel/new'), | 535 | import('@/views/carousel/new'), |
| 526 | meta: { | 536 | meta: { |
| 527 | title: '最新资讯', | 537 | title: '最新资讯', |
| 538 | + permissions: ['admin'] | ||
| 528 | } | 539 | } |
| 529 | }] | 540 | }] |
| 530 | }, | 541 | }, |
| @@ -538,5 +549,29 @@ export function getRoutes() { | @@ -538,5 +549,29 @@ export function getRoutes() { | ||
| 538 | } | 549 | } |
| 539 | 550 | ||
| 540 | 551 | ||
| 552 | + function hasPermission(permissions, route) { | ||
| 553 | + if (route.meta && route.meta.permissions) { | ||
| 554 | + return permissions.some((role) => route.meta.permissions.includes(role)); | ||
| 555 | + } else { | ||
| 556 | + return true; | ||
| 557 | + } | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + | ||
| 561 | + function filterAsyncRoutes(routes, permissions) { | ||
| 562 | + const finallyRoutes = []; | ||
| 563 | + routes.forEach((route) => { | ||
| 564 | + const item = { ...route }; | ||
| 565 | + if (hasPermission(permissions, item)) { | ||
| 566 | + if (item.children) { | ||
| 567 | + item.children = filterAsyncRoutes(item.children, permissions); | ||
| 568 | + } | ||
| 569 | + finallyRoutes.push(item); | ||
| 570 | + } | ||
| 571 | + }); | ||
| 572 | + return finallyRoutes; | ||
| 573 | + } | ||
| 574 | + constantRoutes1 = filterAsyncRoutes(constantRoutes1, permissions); | ||
| 575 | + | ||
| 541 | return constantRoutes1; | 576 | return constantRoutes1; |
| 542 | } | 577 | } |
| 543 | \ No newline at end of file | 578 | \ No newline at end of file |
src/views/TestPaper/ManualTestPaper.vue
| @@ -84,7 +84,12 @@ | @@ -84,7 +84,12 @@ | ||
| 84 | </el-cascader> | 84 | </el-cascader> |
| 85 | </el-form-item> | 85 | </el-form-item> |
| 86 | 86 | ||
| 87 | - | 87 | + <el-form-item label="级别" prop="FLevelCount" class="el-form-item-custom" |
| 88 | + style="margin-bottom: 20px !important;width:100%;"> | ||
| 89 | + <el-select v-model="TestPaper.FLevelCount" placeholder="请选择级别" @change="changelevel" style="width:100%"> | ||
| 90 | + <el-option v-for="item in levellist" :label="item.title" :value="item.f_count"></el-option> | ||
| 91 | + </el-select> | ||
| 92 | + </el-form-item> | ||
| 88 | 93 | ||
| 89 | <el-form-item label="有效时间" required> | 94 | <el-form-item label="有效时间" required> |
| 90 | <el-form-item prop="date"> | 95 | <el-form-item prop="date"> |
| @@ -135,10 +140,15 @@ | @@ -135,10 +140,15 @@ | ||
| 135 | <ul class="random-list"> | 140 | <ul class="random-list"> |
| 136 | <li v-for="(item,index) in randomSubjectList" :key="index"> | 141 | <li v-for="(item,index) in randomSubjectList" :key="index"> |
| 137 | <span>试题分类:</span> | 142 | <span>试题分类:</span> |
| 138 | - <el-cascader :multiple="false" style="flex:1" v-model="item.QuestionClassId" :options="randomQuestionTypeList" | ||
| 139 | - clearable></el-cascader> | ||
| 140 | - <span style="margin-left:10px;">试题数量:</span> | ||
| 141 | - <el-input-number v-model="item.Count" :min="1" :max="100" label="描述文字" style="margin-left:10px;"> | 143 | + <el-cascader :multiple="false" style="flex:1" @change="(a)=>{ changetype(a,item)}" v-model="item.QuestionClassId" :options="randomQuestionTypeList" |
| 144 | + clearable> | ||
| 145 | + <template slot-scope="{ node, data }"> | ||
| 146 | + <span>{{ data.label }}</span> | ||
| 147 | + <span v-if="data.subjectCount"> ({{ data.subjectCount || '0' }}) </span> | ||
| 148 | + </template> | ||
| 149 | + </el-cascader> | ||
| 150 | + <span style="margin-left:10px;">试题数量:{{item.maxcount}}</span> | ||
| 151 | + <el-input-number v-model="item.Count" :min="1" :max="item.maxcount" label="描述文字" style="margin-left:10px;"> | ||
| 142 | </el-input-number> | 152 | </el-input-number> |
| 143 | <i class="el-icon-remove-outline" @click="changeSubjectCount(-1,index)" | 153 | <i class="el-icon-remove-outline" @click="changeSubjectCount(-1,index)" |
| 144 | style="margin-left:10px;color:#f56c6c;"></i> | 154 | style="margin-left:10px;color:#f56c6c;"></i> |
| @@ -173,6 +183,9 @@ | @@ -173,6 +183,9 @@ | ||
| 173 | <script> | 183 | <script> |
| 174 | import draggable from "vuedraggable"; | 184 | import draggable from "vuedraggable"; |
| 175 | import { PostRandomGetQuestion, getQuestionList, getQuestionClassList } from "@/api/QuestionBank"; | 185 | import { PostRandomGetQuestion, getQuestionList, getQuestionClassList } from "@/api/QuestionBank"; |
| 186 | + import { GetpaperLevelList } from "@/api/paperLevel"; | ||
| 187 | + | ||
| 188 | + | ||
| 176 | import { GetQuestionClassByType } from "@/api/QuestionClass"; | 189 | import { GetQuestionClassByType } from "@/api/QuestionClass"; |
| 177 | import { EditTestPaper, GetToplevel } from "@/api/TestPaper"; | 190 | import { EditTestPaper, GetToplevel } from "@/api/TestPaper"; |
| 178 | import { formatTime } from "@/utils/util"; | 191 | import { formatTime } from "@/utils/util"; |
| @@ -238,6 +251,7 @@ | @@ -238,6 +251,7 @@ | ||
| 238 | PresentPrice: "0", | 251 | PresentPrice: "0", |
| 239 | MembershipPrice: "0", | 252 | MembershipPrice: "0", |
| 240 | QuestionBankIds: [], | 253 | QuestionBankIds: [], |
| 254 | + FLevelCount:0 | ||
| 241 | }, | 255 | }, |
| 242 | loading: false, | 256 | loading: false, |
| 243 | rules: { | 257 | rules: { |
| @@ -246,7 +260,7 @@ | @@ -246,7 +260,7 @@ | ||
| 246 | required: true, | 260 | required: true, |
| 247 | message: "不能为空", | 261 | message: "不能为空", |
| 248 | }, | 262 | }, |
| 249 | - ], | 263 | + ], |
| 250 | PresentPrice: [ | 264 | PresentPrice: [ |
| 251 | { | 265 | { |
| 252 | required: true, | 266 | required: true, |
| @@ -278,6 +292,8 @@ | @@ -278,6 +292,8 @@ | ||
| 278 | }, | 292 | }, |
| 279 | ], | 293 | ], |
| 280 | timeout: 0, | 294 | timeout: 0, |
| 295 | + typelist:[], | ||
| 296 | + levellist:[] //等级 | ||
| 281 | }; | 297 | }; |
| 282 | }, | 298 | }, |
| 283 | watch: { | 299 | watch: { |
| @@ -311,6 +327,11 @@ | @@ -311,6 +327,11 @@ | ||
| 311 | if (res.data) { | 327 | if (res.data) { |
| 312 | this.usertypelist = res.data || []; | 328 | this.usertypelist = res.data || []; |
| 313 | } | 329 | } |
| 330 | + }); | ||
| 331 | + GetpaperLevelList({pageSize:1000,sortOrder:'asc'}).then(res => { | ||
| 332 | + if (res.data) { | ||
| 333 | + this.levellist = res.data.data || []; | ||
| 334 | + } | ||
| 314 | }); | 335 | }); |
| 315 | }, | 336 | }, |
| 316 | mounted() { | 337 | mounted() { |
| @@ -319,6 +340,25 @@ | @@ -319,6 +340,25 @@ | ||
| 319 | //this.GetList(); | 340 | //this.GetList(); |
| 320 | }, | 341 | }, |
| 321 | methods: { | 342 | methods: { |
| 343 | + changetype(a,item){ | ||
| 344 | + var type = this.typelist.find(o=>o.id == item.QuestionClassId[item.QuestionClassId.length-1]); | ||
| 345 | + if(type) { | ||
| 346 | + item.maxcount = type.subjectCount || 0; | ||
| 347 | + if(item.Count > item.maxcount) item.Count = item.maxcount; | ||
| 348 | + } | ||
| 349 | + }, | ||
| 350 | + | ||
| 351 | + changelevel(v){ | ||
| 352 | + var type = this.levellist.find(o=>o.f_count == v); | ||
| 353 | + if(type) { | ||
| 354 | + this.TestPaper.FLevelTitle = type.title || ''; | ||
| 355 | + } | ||
| 356 | + }, | ||
| 357 | + getmaxid(item){ | ||
| 358 | + var type = this.randomQuestionTypeList.find(o=>o.id == item.QuestionClassId); | ||
| 359 | + if(type) return type.subjectCount || 0; | ||
| 360 | + else return 0; | ||
| 361 | + }, | ||
| 322 | getSubTree(id, list) { | 362 | getSubTree(id, list) { |
| 323 | let result = []; | 363 | let result = []; |
| 324 | result = list.filter((t) => t.ParentId == id); | 364 | result = list.filter((t) => t.ParentId == id); |
| @@ -339,6 +379,7 @@ | @@ -339,6 +379,7 @@ | ||
| 339 | let _this = this; | 379 | let _this = this; |
| 340 | getQuestionClassList().then((res) => { | 380 | getQuestionClassList().then((res) => { |
| 341 | let alllist = res.data.data; | 381 | let alllist = res.data.data; |
| 382 | + this.typelist = alllist; | ||
| 342 | let list = alllist.filter(t => !t.ParentId); | 383 | let list = alllist.filter(t => !t.ParentId); |
| 343 | list = list.map((t) => { | 384 | list = list.map((t) => { |
| 344 | t.value = t.id; | 385 | t.value = t.id; |
| @@ -437,7 +478,11 @@ | @@ -437,7 +478,11 @@ | ||
| 437 | if (this.arr2.length > 0) { | 478 | if (this.arr2.length > 0) { |
| 438 | EditTestPaper(this.TestPaper).then((res) => { | 479 | EditTestPaper(this.TestPaper).then((res) => { |
| 439 | if (res.data.code == 200) { | 480 | if (res.data.code == 200) { |
| 440 | - this.$confirm("组卷成功!", "消息"); | 481 | + this.$notify({ |
| 482 | + title: '组卷成功!', | ||
| 483 | + // message: res.data.message, | ||
| 484 | + type: 'success' | ||
| 485 | + }); | ||
| 441 | this.$router.push({ | 486 | this.$router.push({ |
| 442 | path: '/views/TestPaperList', | 487 | path: '/views/TestPaperList', |
| 443 | query: { | 488 | query: { |
| @@ -550,7 +595,7 @@ | @@ -550,7 +595,7 @@ | ||
| 550 | getQuestionList({ | 595 | getQuestionList({ |
| 551 | QuestionClassId: d.id, | 596 | QuestionClassId: d.id, |
| 552 | PageIndex: 1, | 597 | PageIndex: 1, |
| 553 | - PageSize: 1000, | 598 | + PageSize: this.TestPaper.FLevelCount || 1000, |
| 554 | }).then((res) => { | 599 | }).then((res) => { |
| 555 | var data = res.data.data.rows || []; | 600 | var data = res.data.data.rows || []; |
| 556 | data = data.filter(o => !this.arr2.find(d => d.id == o.id)); | 601 | data = data.filter(o => !this.arr2.find(d => d.id == o.id)); |
src/views/TestPaper/TestPaperList.vue
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | <span>{{ scope.row.id }}</span> | 11 | <span>{{ scope.row.id }}</span> |
| 12 | </template> | 12 | </template> |
| 13 | </el-table-column> | 13 | </el-table-column> |
| 14 | - <el-table-column prop="date" label="试卷标题" width="250"> | 14 | + <el-table-column prop="date" label="试卷标题" width="300"> |
| 15 | <template slot-scope="scope"> | 15 | <template slot-scope="scope"> |
| 16 | <span>{{ scope.row.TestPaperTitle }}</span> | 16 | <span>{{ scope.row.TestPaperTitle }}</span> |
| 17 | </template> | 17 | </template> |
| @@ -52,6 +52,12 @@ | @@ -52,6 +52,12 @@ | ||
| 52 | <span>{{ scope.row.TestPaperClassId | typeFilters}}</span> | 52 | <span>{{ scope.row.TestPaperClassId | typeFilters}}</span> |
| 53 | </template> | 53 | </template> |
| 54 | </el-table-column> | 54 | </el-table-column> |
| 55 | + | ||
| 56 | + <el-table-column prop="FLevelTitle" label="等级" width="100"> | ||
| 57 | + <template slot-scope="scope"> | ||
| 58 | + <span>{{ scope.row.FLevelTitle }}</span> | ||
| 59 | + </template> | ||
| 60 | + </el-table-column> | ||
| 55 | <!-- <el-table-column prop="name" label="原价" width="80" v-show="false"> | 61 | <!-- <el-table-column prop="name" label="原价" width="80" v-show="false"> |
| 56 | <template slot-scope="scope"> | 62 | <template slot-scope="scope"> |
| 57 | <span>{{ scope.row.OriginalPrice/100 }}</span> | 63 | <span>{{ scope.row.OriginalPrice/100 }}</span> |
src/views/user/adminList.vue
| @@ -22,6 +22,14 @@ | @@ -22,6 +22,14 @@ | ||
| 22 | </el-table-column> | 22 | </el-table-column> |
| 23 | <el-table-column prop="username" label="登录账号"> | 23 | <el-table-column prop="username" label="登录账号"> |
| 24 | </el-table-column> | 24 | </el-table-column> |
| 25 | + | ||
| 26 | + <el-table-column prop="type" label="类型"> | ||
| 27 | + <template slot-scope="scope"> | ||
| 28 | + <span>{{ scope.row.type == 0?'超级管理员':'一般管理员' }}</span> | ||
| 29 | + </template> | ||
| 30 | + </el-table-column> | ||
| 31 | + | ||
| 32 | + | ||
| 25 | <el-table-column fixed="right" label="操作" width="150"> | 33 | <el-table-column fixed="right" label="操作" width="150"> |
| 26 | <template slot-scope="scope"> | 34 | <template slot-scope="scope"> |
| 27 | <el-dropdown @command="(e)=>{handleCommand(e,scope.row)}"> | 35 | <el-dropdown @command="(e)=>{handleCommand(e,scope.row)}"> |
| @@ -55,6 +63,13 @@ | @@ -55,6 +63,13 @@ | ||
| 55 | <el-form-item label="登录账号" style="margin-top: 40px;" prop="username"> | 63 | <el-form-item label="登录账号" style="margin-top: 40px;" prop="username"> |
| 56 | <el-input v-model="adminUserInfo.username" placeholder="请输入登录账号" style="width: 40%;"></el-input> | 64 | <el-input v-model="adminUserInfo.username" placeholder="请输入登录账号" style="width: 40%;"></el-input> |
| 57 | </el-form-item> | 65 | </el-form-item> |
| 66 | + <el-form-item label="类型" style="margin-top: 40px;" prop="type"> | ||
| 67 | + <el-radio-group v-model="adminUserInfo.type"> | ||
| 68 | + <el-radio :label="0">超级管理员</el-radio> | ||
| 69 | + <el-radio :label="5">一般管理员</el-radio> | ||
| 70 | + </el-radio-group> | ||
| 71 | + </el-form-item> | ||
| 72 | + | ||
| 58 | <el-form-item label="密码" prop="password" v-if="title=='添加管理员'"> | 73 | <el-form-item label="密码" prop="password" v-if="title=='添加管理员'"> |
| 59 | <el-input v-model="adminUserInfo.password " placeholder="请输入密码" show-password style="width: 40%;"></el-input> | 74 | <el-input v-model="adminUserInfo.password " placeholder="请输入密码" show-password style="width: 40%;"></el-input> |
| 60 | </el-form-item> | 75 | </el-form-item> |
| @@ -208,6 +223,11 @@ | @@ -208,6 +223,11 @@ | ||
| 208 | required: true, | 223 | required: true, |
| 209 | message: '请输入密码', | 224 | message: '请输入密码', |
| 210 | trigger: 'blur' | 225 | trigger: 'blur' |
| 226 | + }], | ||
| 227 | + type: [{ | ||
| 228 | + required: true, | ||
| 229 | + message: '请输选择用户类型', | ||
| 230 | + trigger: 'blur' | ||
| 211 | }] | 231 | }] |
| 212 | } | 232 | } |
| 213 | } | 233 | } |
vue.config.js
| @@ -39,7 +39,8 @@ module.exports = { | @@ -39,7 +39,8 @@ module.exports = { | ||
| 39 | proxy: { | 39 | proxy: { |
| 40 | '/development': { | 40 | '/development': { |
| 41 | // target: `http://inteview.t1j2.com/`, //后台服务地址 | 41 | // target: `http://inteview.t1j2.com/`, //后台服务地址 |
| 42 | - target:'http://localhost:8009', | 42 | + target:'http://localhost:8877', |
| 43 | + // target:'http://localhost:8009', | ||
| 43 | changeOrigin: true, | 44 | changeOrigin: true, |
| 44 | pathRewrite: { | 45 | pathRewrite: { |
| 45 | '^/development': '' | 46 | '^/development': '' |