Commit b13c07c4 authored by Facius's avatar Facius

improvement: 选题库的时候,题库可能些只到二级、三级

parent 5425fedc
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
}, },
computed: { computed: {
category() { category() {
return this.selected[key3] return this.selected[key3] || this.selected[key2] || this.selected[key1]
}, },
params() { params() {
return { return {
...@@ -171,7 +171,7 @@ export default { ...@@ -171,7 +171,7 @@ export default {
return false return false
}, },
thirdKey() { thirdKey() {
return key3 return key3 || key2 || key1
}, },
selectedTypeId() { selectedTypeId() {
for (var item of this.types) { for (var item of this.types) {
......
...@@ -99,27 +99,45 @@ export default { ...@@ -99,27 +99,45 @@ export default {
if (key == key1) { if (key == key1) {
// 选中一级标签 // 选中一级标签
this.scrollId = '' this.scrollId = ''
this.selected[key2] = {} if (
const query = uni.createSelectorQuery().in(this) this.labels[key2] &&
query this.labels[key2][index] &&
.select('.select-category-content') this.labels[key2][index].length > 0
.boundingClientRect((data) => { ) {
this.minHeight = data.height - 22 // 去掉margin、padding this.selected[key2] = {}
this.$nextTick(() => { const query = uni.createSelectorQuery().in(this)
this.scrollId = key2 + ind query
console.log(this.scrollId) .select('.select-category-content')
.boundingClientRect((data) => {
this.minHeight = data.height - 22 // 去掉margin、padding
this.$nextTick(() => {
this.scrollId = key2 + ind
console.log(this.scrollId)
})
}) })
.exec()
} else {
this.selected[key2] = null
this.setPageInfo(this.selected)
this.$u.route({
url: 'pages/learn/examSetting',
}) })
.exec() }
} else { } else {
// 选中二级标签 // 选中二级标签
this.selected[key1] = this.labels[key1][0][index] this.selected[key1] = this.labels[key1][0][index]
this.selected[key2].list = this.result.filter((item) => { this.selected[key2].list =
return item.parentId == label.id this.result.filter((item) => {
}) return item.parentId == label.id
}) || []
this.selected[key2].list = []
var path = 'addExam'
if (this.selected[key2].list.length <= 0) {
path = 'examSetting'
}
this.setPageInfo(this.selected) this.setPageInfo(this.selected)
this.$u.route({ this.$u.route({
url: 'pages/learn/addExam', url: 'pages/learn/' + path,
}) })
} }
}, },
...@@ -131,7 +149,6 @@ export default { ...@@ -131,7 +149,6 @@ export default {
let res = await this.$u.api.subjectList(param) let res = await this.$u.api.subjectList(param)
this.tapLoading = false this.tapLoading = false
this.result = res this.result = res
console.log('-----------res-------------', res)
var filterItems = res.filter((item) => { var filterItems = res.filter((item) => {
return item.parentId == 0 return item.parentId == 0
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment