|
@@ -290,7 +290,7 @@ export default defineComponent({
|
|
|
result.push({
|
|
|
answerId: leftOption.index,
|
|
|
answer: leftOption.leftValue,
|
|
|
- extra: rightOption.rightValue
|
|
|
+ answerExtra: rightOption.rightValue
|
|
|
})
|
|
|
})
|
|
|
emit('update:value', result)
|
|
@@ -299,6 +299,7 @@ export default defineComponent({
|
|
|
const initOptions = () => {
|
|
|
const answers = props.data.answers || []
|
|
|
const userAnswer = props.data.userAnswer || [] // 用户填写的答案
|
|
|
+ // console.log(answers, '111')
|
|
|
answers.forEach((answer: any) => {
|
|
|
const tmp = {
|
|
|
index: answer.examinationQuestionAnswerId, // 左边的值
|
|
@@ -316,8 +317,8 @@ export default defineComponent({
|
|
|
})
|
|
|
|
|
|
// 反显答案-初始化数据
|
|
|
+ console.log(userAnswer)
|
|
|
userAnswer.forEach((user: any) => {
|
|
|
- console.log(user)
|
|
|
const temps: any = {
|
|
|
startPoint: { x: 0, y: 0 },
|
|
|
endPoint: { x: 0, y: 0 },
|
|
@@ -332,7 +333,8 @@ export default defineComponent({
|
|
|
temps.leftIndex = option.index
|
|
|
}
|
|
|
// 右边状态
|
|
|
- if (option.rightValue === user.extra) {
|
|
|
+ // console.log(option, user, '----')
|
|
|
+ if (option.rightValue === user.answerExtra) {
|
|
|
option.right = true
|
|
|
option.leftLocked = true
|
|
|
temps.rightIndex = option.index
|
|
@@ -345,14 +347,19 @@ export default defineComponent({
|
|
|
// 反显答案-连线
|
|
|
nextTick(() => {
|
|
|
state.drawLineList.forEach((draw: any) => {
|
|
|
+ console.log(draw, 'drawLine')
|
|
|
state.selectItem = []
|
|
|
const leftObj: any = useRect(document.getElementById(draw.leftIndex + '-left') as any)
|
|
|
leftObj.index = draw.leftIndex
|
|
|
state.selectItem[0] = leftObj
|
|
|
- const rightObj: any = useRect(document.getElementById(draw.leftIndex + '-right') as any)
|
|
|
+ const rightObj: any = useRect(document.getElementById(draw.rightIndex + '-right') as any)
|
|
|
rightObj.index = draw.rightIndex
|
|
|
state.selectItem[1] = rightObj
|
|
|
-
|
|
|
+ console.log(state.selectItem, 'state.selectItem')
|
|
|
+ console.log(
|
|
|
+ document.getElementById(draw.leftIndex + '-left'),
|
|
|
+ document.getElementById(draw.rightIndex + '-right')
|
|
|
+ )
|
|
|
const postion = calcPoint()
|
|
|
draw.endPoint = postion.endPoint
|
|
|
draw.startPoint = postion.startPoint
|
|
@@ -360,7 +367,7 @@ export default defineComponent({
|
|
|
})
|
|
|
setTimeout(() => {
|
|
|
renderDrawLine(canvasRef.value)
|
|
|
- }, 60)
|
|
|
+ }, 100)
|
|
|
})
|
|
|
}
|
|
|
|