+
未找到试题,去新增
-
已选题数/目标题数:{{ checkedLen }}/{{ $parent.curType.questionNum }}
-
+
已选题数/目标题数:{{ checkedLen }}/{{ $parent.curType.questionNum }}
+
@@ -101,17 +155,26 @@ export default {
data () {
return {
selectQuesVisible: false,
+ searchTimer: null,
quesBankKeyword: '',
+ curQuesBank: {},
+ quesBankTypeVal: [],
+ quesBankTypes: [],
+ quesBanks: [],
+ pageQuesBank: 1,
+ pageSizeQuesBank: 10,
+ totalQuesBank: 0,
+
knowledgeKeyword: '',
- searchTimer: null,
key: 1,
- quesBanks: [],
+ knowledgeVal: [],
knowledges: [],
quesAllCheck: false,
ques: [],
checkedAllCheck: false,
checked: [],
curCheckQues: [],
+ checkedKeyword: '',
submiting: false,
quesVisible: false,
@@ -141,11 +204,11 @@ export default {
watch: {
'quesBankKeyword': function (val) {
clearTimeout(this.searchTimer)
- this.searchTimer = setTimeout(this.getQuesBank, 500)
+ this.searchTimer = setTimeout(this.initQuesBank, 500)
},
'knowledgeKeyword': function (val) {
clearTimeout(this.searchTimer)
- this.searchTimer = setTimeout(this.getKnowledge, 500)
+ this.searchTimer = setTimeout(this.getQues, 500)
},
visible () {
this.selectQuesVisible = this.visible
@@ -171,69 +234,109 @@ export default {
const parent = this.$parent.curType
this.curCheckQues = parent.examQuestions
- this.getQuesBank()
+ this.getQuesBankType()
+ this.initQuesBank()
+ },
+ // 获取题库分类
+ async getQuesBankType () {
+ try {
+ const { data } = await this.$post(this.api.getAllQuestionBankCategories, {
+ createSource: 1,
+ status: 1,
+ })
+ this.handleList(data)
+ this.quesBankTypes = data
+ } catch (e) { }
},
// 获取题库
async getQuesBank () {
try {
- const { list } = await this.$post(this.api.questionBankStructureLevel, {
- keyword: this.quesBankKeyword,
- createSource: 1,
+ const type = this.quesBankTypeVal
+ const res = await this.$post(this.api.questionBankList, {
status: 1,
+ pageNum: this.pageQuesBank,
+ pageSize: this.pageSizeQuesBank,
+ questionCategoryId: type.length ? type[type.length - 1] : '',
+ name: this.quesBankKeyword
})
- this.quesBanks = list
+ const { records } = res.message
+ this.quesBanks = records
+ this.totalQuesBank = res.message.total
+ records.length && this.questionBankClick(records[0])
} catch (e) { }
},
+ initQuesBank () {
+ this.curQuesBank = {}
+ this.pageQuesBank = 1
+ this.getQuesBank()
+ },
+ // 切换页码
+ currentChangeQuesBank (val) {
+ this.pageQuesBank = val
+ this.getQuesBank()
+ },
+ // 题目多选回调
+ questionBankClick (item) {
+ this.curQuesBank = item
+ this.knowledgeCheck = false
+ this.getKnowledge()
+ this.getQues()
+ this.quesAllCheck = false
+ },
+
+ // 处理树形
+ handleList (list) {
+ list.map(e => {
+ if (e.children && e.children.length) {
+ this.handleList(e.children)
+ } else {
+ delete e.children
+ }
+ })
+ },
+
// 获取知识点
async getKnowledge () {
try {
- const id = this.$refs.quesBank.getCurrentKey()
+ const { id } = this.curQuesBank
if (id) {
const { data } = await this.$post(this.api.TreeStructure, {
createSource: 1,
questionBankId: id,
- keyword: this.knowledgeKeyword,
+ keyword: '',
})
+ this.handleList(data)
this.knowledges = data
}
} catch (e) { }
},
// 获取试题
async getQues () {
- let k = this.$refs.knowledge.getCurrentNode() // 选中的知识点
- // debugger
- // 选中了知识点才能查询试题
- if (k && k.type) {
+ const { id } = this.curQuesBank
+ let k = this.knowledgeVal // 选中的知识点
+ k = k.map(e => {
+ return e[e.length - 1]
+ })
+ if (id) {
const { list } = await this.$post(this.api.findAllByQuestionBank, {
status: 1,
- questionBankId: this.$refs.quesBank.getCurrentKey(),
- knowledgePointIds: [k.id],
+ questionBankIds: [id],
+ knowledgePointIds: k,
questionTypes: this.questionType ? [this.questionType] : [],
+ keyword: this.knowledgeKeyword,
})
const data = list
- const checked = this.curCheckQues
+ const { curCheckQues, checked } = this
data.map(e => {
const el = document.createElement('div')
el.innerHTML = e.stem
e.stemText = el.innerText
- e.check = !!this.checked.find(n => n.questionVersionId === e.questionVersionId)
- e.disabled = !!checked.find(n => n.questionVersionId === e.questionVersionId)
+ const quesChecked = !!curCheckQues.find(n => n.questionVersionId === e.questionVersionId)
+ e.disabled = quesChecked
+ e.check = !!checked.find(n => n.questionVersionId === e.questionVersionId) || quesChecked
})
this.ques = data
}
- },
- // 题库勾选回调
- quesBankCheck (data, checked) {
- // debugger
- if (checked) {
- // this.$refs.quesBank.setCurrentKey(data.id)
- this.getKnowledge()
- }
- this.$refs.knowledge.setCheckedNodes(checked ? this.knowledges : [])
- },
- // 知识点点击回调
- knowledgeClick (data) {
-
},
// 知识点勾选回调
knowledgeCheck () {
@@ -242,8 +345,10 @@ export default {
// 题目全选回调
quesAllCheckChange (val) {
this.ques.map(e => {
- e.check = val
- this.quesChange(val, e)
+ if (!e.disabled) {
+ e.check = val
+ this.quesChange(val, e)
+ }
})
},
// 题目多选回调
@@ -270,7 +375,7 @@ export default {
try {
const checked = this.checked.filter(e => e.check)
if (checked.length) {
- await this.$confirm(`确认要删除吗?`, '提示', {
+ await this.$confirm(`确认要移除吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@@ -293,12 +398,12 @@ export default {
// 已选试题单个删除
async delChecked (item) {
try {
- // await this.$confirm(`确认要删除吗?`, '提示', {
- // confirmButtonText: '确定',
- // cancelButtonText: '取消',
- // type: 'warning',
- // closeOnClickModal: false,
- // })
+ await this.$confirm(`确认要移除吗?`, '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ closeOnClickModal: false,
+ })
const cur = this.ques.find(e => e.questionVersionId === item.questionVersionId)
if (cur) cur.check = false
this.checked.splice(this.checked.findIndex(e => e.questionVersionId === item.questionVersionId), 1)
@@ -377,16 +482,28 @@ export default {
margin-bottom: 10px;
border: 1px solid #eee;
+ .filter {
+ margin-bottom: 15px;
+
+ li {
+ display: flex;
+ align-items: center;
+ }
+
+ label {
+ margin-right: 10px;
+ font-size: 14px;
+ color: #333;
+ white-space: nowrap;
+ }
+ }
+
.item {
- width: 25%;
- max-height: calc(100vh - 190px);
+ width: 38%;
+ height: calc(100vh - 173px);
padding: 15px;
border-right: 1px solid #eee;
overflow: auto;
-
- &:last-child {
- border-right: 0;
- }
}
.total {
@@ -394,40 +511,69 @@ export default {
color: #333;
}
- .ques {
- margin-top: 10px;
+ .line {
+ display: flex;
+ padding: 5px 0;
+ color: #333;
+ }
+
+ .able-check {
.line {
- display: flex;
- margin: 8px 0;
- }
+ cursor: pointer;
- .serial {
- width: 32px;
- margin: 0 12px;
- text-align: center;
- white-space: nowrap;
- }
+ &:hover {
+ background-color: #f5f5f5;
+ }
- .stem {
- max-width: calc(100% - 71px);
- @include ellipsis;
+ &.active {
+ background-color: #e5e5e5;
+ }
}
+ }
- .checked-stem {
- max-width: 165px;
- @include ellipsis;
- }
+ .serial {
+ width: 32px;
+ margin: 0 12px;
+ text-align: center;
+ white-space: nowrap;
+ }
- .check-left {
- display: inline-flex;
- align-items: center;
- }
+ .quesBank {
+ width: calc(100% - 71px);
+ @include ellipsis;
+ }
- .action-icon {
- font-size: 14px;
+ .stem {
+ width: calc(100% - 210px);
+ margin-right: 20px;
+ @include ellipsis;
+ }
+
+ .kl {
+ width: 120px;
+ @include ellipsis;
+
+ &.checked-kl {
+ width: 90px;
+ margin-right: 10px;
}
}
+
+ .checked-stem {
+ max-width: 165px;
+ margin-right: 20px;
+ @include ellipsis;
+ }
+
+ .check-left {
+ display: inline-flex;
+ align-items: center;
+ }
+
+ .action-icon {
+ font-size: 14px;
+ }
}
.link {
diff --git a/src/pages/testPaperLibrary/index.vue b/src/pages/testPaperLibrary/index.vue
index a5a9e3d..9876634 100644
--- a/src/pages/testPaperLibrary/index.vue
+++ b/src/pages/testPaperLibrary/index.vue
@@ -58,7 +58,7 @@
-
+
试卷管理
diff --git a/src/router/permission.js b/src/router/permission.js
index 419f413..8e51ffc 100644
--- a/src/router/permission.js
+++ b/src/router/permission.js
@@ -4,5 +4,6 @@ import util from '@/libs/util'
router.beforeEach((to, from, next) => {
document.title = Setting.titleSuffix
+ localStorage.setItem('examPath', to.fullPath)
next()
});
\ No newline at end of file
diff --git a/src/setting.js b/src/setting.js
index 9758e21..0cd7759 100644
--- a/src/setting.js
+++ b/src/setting.js
@@ -2,6 +2,7 @@
* 业务配置
* */
const isDev = process.env.NODE_ENV === 'development' // 开发环境
+const isPro = location.host.includes('huorantech.cn') //正式服
let host = location.origin
if (isDev) {
host = 'http://192.168.31.51:9000'
@@ -22,6 +23,7 @@ const Setting = {
errorModalType: "Message", // 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice
tokenExpires: 1296000000, // token在localStorage的时间(毫秒)
isDev,
+ isPro,
/**
* 路由白名单
* */