提交 4882771f authored 作者: lihuihui's avatar lihuihui

update:新修改开发

上级 0f5992d7
...@@ -53,9 +53,12 @@ ...@@ -53,9 +53,12 @@
<ul class="topics"> <ul class="topics">
<template v-for="(item, index) in questionData.list"> <template v-for="(item, index) in questionData.list">
<li :key="'type5' + index"> <li :key="'type5' + index">
<div class="title"> <div :class="item.q_order === questionParams.questionIndex + 1 ? 'active title' : 'title'">
<div class="num">{{ item.q_order }}.</div><div class="des" v-html="item.content"></div> <div class="num">{{ item.q_order }}.</div><div class="des" v-html="item.content"></div>
</div> </div>
<!-- <template v-if="item.type == 3">
<el-input @input="QAChange(questionData.question_item_id, item.id)" type="textarea" placeholder="请输入内容" v-model="questionData.textContent"></el-input>
</template> -->
<ul :class="item.type == 2 ? 'check-option' : 'radio-option'"><!-- radio-option check-option --> <ul :class="item.type == 2 ? 'check-option' : 'radio-option'"><!-- radio-option check-option -->
<template v-if="item.options"> <template v-if="item.options">
<template v-for="(items, cIndex) in item.options"> <template v-for="(items, cIndex) in item.options">
...@@ -63,14 +66,14 @@ ...@@ -63,14 +66,14 @@
:id="items.id" :id="items.id"
:key="'c' + cIndex" :key="'c' + cIndex"
:class="questionParams.answerRecord[questionData.question_item_id] :class="questionParams.answerRecord[questionData.question_item_id]
? questionParams.answerRecord[questionData.question_item_id][questionData.id] ? questionParams.answerRecord[questionData.question_item_id][item.id]
? questionParams.answerRecord[questionData.question_item_id][questionData.id].answer.find(id => { return id === items.id }) ? questionParams.answerRecord[questionData.question_item_id][item.id].answer.find(id => { return id === items.id })
? 'active' ? 'active'
: '' : ''
: '' : ''
: ''" : ''"
> >
<div @click="changeOptions(item.type, questionData.question_item_id, questionData.id, items.id)"> <div @click="changeOptions(item.type, questionData.question_item_id, item.id, items.id, item.q_order)">
<div class="icon"></div> <div class="icon"></div>
<div class="txt">{{items.option}}</div> <div class="txt">{{items.option}}</div>
</div> </div>
...@@ -127,17 +130,17 @@ export default { ...@@ -127,17 +130,17 @@ export default {
this.questionData = {} this.questionData = {}
this.questionData.common_content = cItem.common_content this.questionData.common_content = cItem.common_content
this.questionData.list = cItem.list.map(k => { this.questionData.list = cItem.list.map(k => {
if (k.q_order === this.questionParams.questionIndex + 1) { this.questionData.id = k.id
this.questionData.id = k.id this.questionData.q_order = k.q_order
this.questionData.q_order = k.q_order typeof k.options === 'string' && (k.options = JSON.parse(k.options))
typeof k.options === 'string' && (k.options = JSON.parse(k.options)) return k
return k // if (k.q_order === this.questionParams.questionIndex + 1) {
} else { // } else {
return { // return {
content: k.content, // content: k.content,
q_order: k.q_order // q_order: k.q_order
} // }
} // }
}) })
const key = ['question_item_id', 'question_item_title', 'question_item_type'] const key = ['question_item_id', 'question_item_title', 'question_item_type']
key.map(k => { key.map(k => {
...@@ -156,7 +159,6 @@ export default { ...@@ -156,7 +159,6 @@ export default {
typeof this.questionData.options === 'string' && (this.questionData.options = JSON.parse(currentItem.options)) typeof this.questionData.options === 'string' && (this.questionData.options = JSON.parse(currentItem.options))
const pId = this.questionData.question_item_id const pId = this.questionData.question_item_id
const cId = this.questionData.id const cId = this.questionData.id
console.log(this.questionData.question_item_id, this.questionData.id, '321++')
// 问答题答案回显 // 问答题答案回显
if (this.questionParams.answerRecord[pId]) { if (this.questionParams.answerRecord[pId]) {
if (this.questionParams.answerRecord[pId][cId]) { if (this.questionParams.answerRecord[pId][cId]) {
...@@ -168,7 +170,6 @@ export default { ...@@ -168,7 +170,6 @@ export default {
} }
} }
}) })
console.log(this.questionData, '===123', this.questionParams)
}, },
// 问答题回答 // 问答题回答
QAChange(pId, cId) { QAChange(pId, cId) {
...@@ -188,7 +189,10 @@ export default { ...@@ -188,7 +189,10 @@ export default {
this.$forceUpdate() this.$forceUpdate()
}, },
// 选项选择 // 选项选择
changeOptions: _.debounce(function(type, pId, cId, optId) { changeOptions: _.debounce(function(type, pId, cId, optId, order) {
if (order) {
this.questionParams.questionIndex = order - 1
}
if (parseInt(type) !== 2) { if (parseInt(type) !== 2) {
this.questionParams.answerRecord[pId] this.questionParams.answerRecord[pId]
? this.questionParams.answerRecord[pId][cId] ? this.questionParams.answerRecord[pId][cId]
...@@ -257,21 +261,40 @@ export default { ...@@ -257,21 +261,40 @@ export default {
onSignHandle() { onSignHandle() {
const pId = this.questionData.question_item_id const pId = this.questionData.question_item_id
const cId = this.questionData.id const cId = this.questionData.id
this.questionParams.answerRecord[pId] if (this.questionData.question_item_type === '5') {
? this.questionParams.answerRecord[pId][cId] this.questionData.list.forEach(item => {
? this.questionParams.answerRecord[pId][cId].sign if (this.questionParams.answerRecord[pId]) {
? this.questionParams.answerRecord[pId][cId].sign = false if (this.questionParams.answerRecord[pId][item.id]) {
: this.questionParams.answerRecord[pId][cId].sign = true if (this.questionParams.answerRecord[pId][item.id].sign) {
: this.questionParams.answerRecord[pId][cId] = { this.questionParams.answerRecord[pId][item.id].sign = false
sign: true, } else {
answer: [] this.questionParams.answerRecord[pId][item.id].sign = true
}
console.log(this.questionParams.answerRecord[pId][item.id], '=123')
} else {
this.questionParams.answerRecord[pId][cId] = { sign: true, answer: [] }
}
} else {
this.questionParams.answerRecord[pId] = { [item.id]: { sign: true, answer: [] } }
} }
: this.questionParams.answerRecord[pId] = { })
[cId]: { } else {
sign: true, this.questionParams.answerRecord[pId]
answer: [] ? this.questionParams.answerRecord[pId][cId]
? this.questionParams.answerRecord[pId][cId].sign
? this.questionParams.answerRecord[pId][cId].sign = false
: this.questionParams.answerRecord[pId][cId].sign = true
: this.questionParams.answerRecord[pId][cId] = {
sign: true,
answer: []
}
: this.questionParams.answerRecord[pId] = {
[cId]: {
sign: true,
answer: []
}
} }
} }
this.signCallback() this.signCallback()
}, },
signCallback() { signCallback() {
...@@ -462,6 +485,12 @@ export default { ...@@ -462,6 +485,12 @@ export default {
font-weight: bold; font-weight: bold;
color: #222222; color: #222222;
line-height: 25px; line-height: 25px;
&.active{
color: #c01540;
.num{
color: #c01540 !important;
}
}
span{ span{
font-size: 32px; font-size: 32px;
font-weight: bold; font-weight: bold;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</div> </div>
</div> </div>
<div class="exam-main" :style="{ height: this.contentHeight + 'px' }"> <div class="exam-main" :style="{ height: this.contentHeight + 'px' }">
<div class="left" ref="wrapper2"> <div :class="isMobile() ? 'left scroll' : 'left hidden'" ref="wrapper2">
<div> <div>
<question <question
style="padding-bottom: 30px" style="padding-bottom: 30px"
...@@ -133,9 +133,11 @@ export default { ...@@ -133,9 +133,11 @@ export default {
window.onresize = () => { window.onresize = () => {
this.countHeight() this.countHeight()
} }
const wrapper = this.$refs.wrapper if (!this.isMobile()) {
new BScroll(wrapper, { click: true }) const wrapper = this.$refs.wrapper
this.initBscroll(1000) new BScroll(wrapper, { click: true })
this.initBscroll()
}
}, },
methods: { methods: {
// 初始化bscroll插件 // 初始化bscroll插件
...@@ -307,13 +309,14 @@ export default { ...@@ -307,13 +309,14 @@ export default {
this.questionParams.questionIndex++ this.questionParams.questionIndex++
} }
this.refreshBscroll() this.refreshBscroll()
// this.initBscroll()
}, },
refreshBscroll() { refreshBscroll() {
this.$nextTick(() => { if (!this.isMobile()) {
this.domBScroll.refresh() this.$nextTick(() => {
this.domBScroll.scrollTo(0, -10, 0) this.domBScroll.refresh()
}) this.domBScroll.scrollTo(0, -10, 0)
})
}
}, },
switchQuestion() { switchQuestion() {
this.refreshBscroll() this.refreshBscroll()
...@@ -356,6 +359,25 @@ export default { ...@@ -356,6 +359,25 @@ export default {
} }
} }
}) })
},
isMobile() {
const ua = navigator.userAgent
const isWindowsPhone = /(?:Windows Phone)/.test(ua)
const isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone
const isAndroid = /(?:Android)/.test(ua)
const isPhone = /(?:iPhone)/.test(ua)
const isPc = !isPhone && !isAndroid && !isSymbian
return isPc
}
},
computed: {
changeQuestionIndex() {
return this.questionParams.questionIndex
}
},
watch: {
changeQuestionIndex(newV, oldV) {
this.refreshBscroll()
} }
} }
} }
...@@ -411,11 +433,16 @@ export default { ...@@ -411,11 +433,16 @@ export default {
.left { .left {
flex: 1; flex: 1;
padding: 10px 20px 0 53px; padding: 10px 20px 0 53px;
overflow: hidden; &.hidden{
// scrollbar-width: none; overflow: hidden;
// &::-webkit-scrollbar { }
// display: none; &.scroll{
// } overflow-y: scroll;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
} }
.right { .right {
position: relative; position: relative;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
v-show="loginParam.is" v-show="loginParam.is"
/> />
<div class="btn" @click="login">登录</div> <div class="btn" @click="login">登录</div>
<!-- 11 -->
<!-- <div class="btn prohibit">登录</div> --> <!-- <div class="btn prohibit">登录</div> -->
<div class="time-tips" v-show="loginParam.is">{{ loginParam.countTimeText }}</div> <div class="time-tips" v-show="loginParam.is">{{ loginParam.countTimeText }}</div>
</div> </div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论