Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eduline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冷斌
eduline
Commits
914f4a47
Commit
914f4a47
authored
May 30, 2020
by
冷斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
7c8f9b39
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
108 deletions
+83
-108
apps/exams/Tpl/default/Index/examsroom_w3g.html
+83
-108
No files found.
apps/exams/Tpl/default/Index/examsroom_w3g.html
View file @
914f4a47
<include
file=
"__THEME__/public_header_w3g"
/>
<include
file=
"__THEME__/public_header_w3g"
/>
<style
type=
"text/css"
>
/*比较多用到的*/
.box
{
...
...
@@ -125,6 +125,9 @@
}
body
{
background-color
:
#fff
;
}
...
...
@@ -324,24 +327,20 @@
<div
class=
"testPaperTop box"
>
<p
class=
"testPaperTop_time flex1"
>
{{countDown}}
</p>
<span
v-show=
"!review"
class=
"testPaperTop_da"
>
答题卡
</span>
<img
v-show=
"!review"
@
click=
"onCounting"
class=
"testPaperTop_pau"
:src=
"counting ? '__THEME__/img/pau.png' : '__THEME__/img/right_arrow.png'"
>
<img
v-show=
"!review"
@
click=
"onCounting"
class=
"testPaperTop_pau"
:src=
"counting ? '__THEME__/img/pau.png' : '__THEME__/img/right_arrow.png'"
>
</div>
<div
class=
"testPaperBotm"
>
<div
class=
"box"
>
<span
class=
"testPaperNum"
>
{{current}}/{{totalQuestion}}
</span>
<p
class=
"testPaperLei flex1"
>
({{currentQuestionTypeName}})
</p>
<img
v-if=
"currentQuestion.is_collect == 0"
@
click=
"onCollect(1)"
class=
"testPaperColl"
src=
"__THEME__/img/share_unstar.png"
>
<img
v-if=
"currentQuestion.is_collect == 1"
@
click=
"onCollect(0)"
class=
"testPaperColl"
src=
"__THEME__/img/share_star.png"
>
<img
v-if=
"currentQuestion.is_collect == 0"
@
click=
"onCollect(1)"
class=
"testPaperColl"
src=
"__THEME__/img/share_unstar.png"
>
<img
v-if=
"currentQuestion.is_collect == 1"
@
click=
"onCollect(0)"
class=
"testPaperColl"
src=
"__THEME__/img/share_star.png"
>
</div>
<template
v-if=
"showChoiceQuestion"
>
<div
v-html=
"currentQuestion.content"
class=
"testPaperInfo"
></div>
<ul>
<li
v-for=
"(opt, index) in currentOptions"
:key=
"index"
class=
"testPaperAnswer box"
>
<span
@
click=
"onChoose(opt)"
class=
"testPaperAnswer_num"
:class=
"opt.selected ? 'testPaperAnswer_numAt' : ''"
>
{{opt.key}}
</span>
<span
@
click=
"onChoose(opt)"
class=
"testPaperAnswer_num"
:class=
"opt.selected ? 'testPaperAnswer_numAt' : ''"
>
{{opt.key}}
</span>
<div
v-html=
"opt.value"
class=
"testPaperAnswer_desc flex1"
style=
"margin-top: 0.625rem;"
></div>
</li>
</ul>
...
...
@@ -357,15 +356,11 @@
<!-- 解析 -->
<div
class=
"testPaperJiedaPage"
>
<div
class=
"box testPaperJiedaBox"
>
<span
@
click=
"expand = !expand"
class=
"testPaperJiedaBtn box"
>
{{expand ? '收起解析' : '查看解析'}}
<img
class=
"testPaperJiedaBtn_icon"
src=
"__THEME__/img/openBtn.png"
></span>
<span
@
click=
"expand = !expand"
class=
"testPaperJiedaBtn box"
>
{{expand ? '收起解析' : '查看解析'}}
<img
class=
"testPaperJiedaBtn_icon"
src=
"__THEME__/img/openBtn.png"
></span>
</div>
<ul
v-if=
"expand"
class=
"testPaperAnswers"
>
<li
class=
"testPaperAnswer"
>
正确答案:
<span
v-for=
"(answer, index) in currentRightOptions"
:key=
"index"
class=
"testPaperAnswer_n"
>
{{answer}}
</span></li>
<li
class=
"testPaperAnswer"
>
我的答案:
<span
v-for=
"(answer, index) in currentMyOptions"
:key=
"index"
:class=
"answer.right ? 'testPaperAnswer_n' : 'testPaperAnswer_e'"
>
{{answer.key}}
</span>
</li>
<li
class=
"testPaperAnswer"
>
正确答案:
<span
v-for=
"(answer, index) in currentRightOptions"
:key=
"index"
class=
"testPaperAnswer_n"
>
{{answer}}
</span></li>
<li
class=
"testPaperAnswer"
>
我的答案:
<span
v-for=
"(answer, index) in currentMyOptions"
:key=
"index"
:class=
"answer.right ? 'testPaperAnswer_n' : 'testPaperAnswer_e'"
>
{{answer.key}}
</span></li>
</ul>
<div
v-if=
"expand"
class=
"testPaperAnswer_infoBox"
>
<p
class=
"testPaperAnswer_infoTitle"
>
解析
</p>
...
...
@@ -394,12 +389,12 @@
</div>
<include
file=
"__THEME__/public_footer_w3g"
/>
<include
file=
"__THEME__/public_footer_w3g"
/>
<script
type=
"text/javascript"
>
new
Vue
({
el
:
"#app"
,
data
:
function
()
{
data
:
function
()
{
return
{
info
:
{},
temp
:
{},
...
...
@@ -419,60 +414,60 @@
},
computed
:
{
//computed
nextButton
:
function
()
{
if
(
this
.
review
)
{
nextButton
:
function
()
{
if
(
this
.
review
)
{
return
this
.
current
==
this
.
totalQuestion
?
'返回'
:
'下一题'
}
else
{
return
this
.
current
==
this
.
totalQuestion
?
'交卷'
:
'下一题'
}
},
totalQuestion
:
function
()
{
totalQuestion
:
function
()
{
let
count
=
0
let
data
=
this
.
paperOptions
.
options_questions_data
this
.
paperOptions
.
options_type
.
forEach
(
r
=>
{
this
.
paperOptions
.
options_type
.
forEach
(
r
=>
{
count
+=
data
[
r
.
question_type
].
length
})
return
count
},
currentTypeIndex
:
function
()
{
currentTypeIndex
:
function
()
{
let
count
=
0
let
data
=
this
.
paperOptions
.
options_questions_data
let
current
=
this
.
current
for
(
let
i
=
0
;
i
<
this
.
paperOptions
.
options_type
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
paperOptions
.
options_type
.
length
;
i
++
)
{
let
r
=
this
.
paperOptions
.
options_type
[
i
]
let
next
=
count
+
data
[
r
.
question_type
].
length
if
(
current
>
count
&&
current
<=
next
)
{
if
(
current
>
count
&&
current
<=
next
)
{
return
i
}
else
{
count
=
next
}
}
},
currentQuestions
:
function
()
{
currentQuestions
:
function
()
{
let
optionType
=
this
.
currentQuestionType
let
questionType
=
optionType
.
question_type
let
questionData
=
this
.
paperOptions
.
options_questions_data
let
questions
=
questionData
[
questionType
]
return
questions
},
currentQuestionType
:
function
()
{
currentQuestionType
:
function
()
{
return
this
.
paperOptions
.
options_type
[
this
.
currentTypeIndex
]
},
currentQuestionTypeName
:
function
()
{
currentQuestionTypeName
:
function
()
{
return
this
.
currentQuestionType
.
type_info
.
question_type_title
},
currentQuestionTypeKey
:
function
()
{
currentQuestionTypeKey
:
function
()
{
return
this
.
currentQuestionType
.
question_type_key
},
currentQuestion
:
function
()
{
currentQuestion
:
function
()
{
let
count
=
0
let
data
=
this
.
paperOptions
.
options_questions_data
let
current
=
this
.
current
for
(
let
i
=
0
;
i
<
this
.
paperOptions
.
options_type
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
paperOptions
.
options_type
.
length
;
i
++
)
{
let
r
=
this
.
paperOptions
.
options_type
[
i
]
let
next
=
count
+
data
[
r
.
question_type
].
length
if
(
current
>
count
&&
current
<=
next
)
{
if
(
current
>
count
&&
current
<=
next
)
{
return
data
[
r
.
question_type
][
current
-
count
-
1
]
}
else
{
count
=
next
...
...
@@ -480,53 +475,37 @@
}
},
//选择题答案
currentRightOptions
:
function
()
{
currentRightOptions
:
function
()
{
return
this
.
currentQuestion
.
answer_true_option
},
//我的答案
currentMyOptions
:
function
()
{
currentMyOptions
:
function
()
{
let
cur
=
this
.
currentRightOptions
return
this
.
currentOptions
.
filter
(
r
=>
{
return
r
.
selected
}).
map
(
r
=>
{
return
this
.
currentOptions
.
filter
(
r
=>
{
return
r
.
selected
}).
map
(
r
=>
{
return
{
right
:
cur
.
hx_indexOf
(
k
=>
{
return
k
==
r
.
key
})
!=
-
1
,
right
:
cur
.
hx_indexOf
(
k
=>
{
return
k
==
r
.
key
})
!=
-
1
,
key
:
r
.
key
}
})
},
//解析
currentAnalyze
:
function
()
{
currentAnalyze
:
function
()
{
return
this
.
currentQuestion
.
analyze
},
//Helper
showChoiceQuestion
:
function
()
{
showChoiceQuestion
:
function
()
{
let
key
=
this
.
currentQuestionTypeKey
return
key
==
'radio'
||
key
==
'multiselect'
||
key
==
'judge'
}
},
created
:
function
()
{
this
.
info
=
{
:
json_encode
(
$paper
)
}
;
this
.
temp
=
{
:
json_encode
(
$tempData
)
}
;
this
.
paperOptions
=
{
:
json_encode
(
$paper_options
)
}
;
created
:
function
()
{
this
.
info
=
{:
json_encode
(
$paper
)};
this
.
temp
=
{:
json_encode
(
$tempData
)};
this
.
paperOptions
=
{:
json_encode
(
$paper_options
)};
this
.
review
=
"{$review}"
this
.
initAnswerMode
()
this
.
doCountDown
()
if
(
this
.
review
)
{
if
(
this
.
review
)
{
this
.
countDown
=
this
.
computeTime
(
this
.
info
.
reply_time
*
60
)
this
.
expand
=
true
}
...
...
@@ -536,21 +515,19 @@
console
.
log
(
this
.
paperOptions
)
},
watch
:
{
current
:
function
(
o
,
n
)
{
current
:
function
(
o
,
n
)
{
this
.
initAnswerMode
()
}
},
methods
:
{
initAnswerMode
:
function
()
{
initAnswerMode
:
function
()
{
let
q
=
this
.
currentQuestionTypeKey
switch
(
q
)
{
switch
(
q
)
{
case
"radio"
:
this
.
currentOptions
=
[]
let
Q
=
this
.
currentQuestion
let
old
=
this
.
finished
.
hx_firstOf
(
r
=>
{
return
r
.
qId
==
Q
.
exams_question_id
})
for
(
let
k
in
Q
.
answer_options
)
{
let
old
=
this
.
finished
.
hx_firstOf
(
r
=>
{
return
r
.
qId
==
Q
.
exams_question_id
})
for
(
let
k
in
Q
.
answer_options
)
{
let
value
=
Q
.
answer_options
[
k
]
let
select
=
old
?
old
.
option
==
k
:
false
this
.
currentOptions
.
push
({
...
...
@@ -562,7 +539,7 @@
break
}
},
recordData
:
function
()
{
recordData
:
function
()
{
return
{
paperId
:
this
.
info
.
exams_paper_id
,
timeConsumed
:
this
.
timeConsumed
,
...
...
@@ -570,19 +547,19 @@
finished
:
this
.
finished
}
},
computeTime
:
function
(
time
)
{
computeTime
:
function
(
time
)
{
let
hours
=
Math
.
floor
(
time
/
3600
)
let
minutes
=
Math
.
floor
((
time
%
3600
)
/
60
)
let
seconds
=
Math
.
round
(
time
%
60
)
return
(
hours
<
10
?
'0'
+
hours
:
hours
)
+
":"
+
(
minutes
<
10
?
'0'
+
minutes
:
minutes
)
+
":"
+
(
seconds
<
10
?
'0'
+
seconds
:
seconds
)
},
doCountDown
:
function
()
{
if
(
!
this
.
counting
||
this
.
review
)
{
doCountDown
:
function
()
{
if
(
!
this
.
counting
||
this
.
review
)
{
return
}
if
(
this
.
info
.
reply_time
)
{
if
(
this
.
info
.
reply_time
)
{
let
time
=
this
.
info
.
reply_time
*
60
-
this
.
timeConsumed
if
(
time
<=
0
)
{
if
(
time
<=
0
)
{
this
.
showFinish
=
true
}
else
{
this
.
countDown
=
this
.
computeTime
(
time
)
...
...
@@ -593,27 +570,27 @@
this
.
countDown
=
"不限时"
}
},
onCollect
:
function
(
collect
)
{
onCollect
:
function
(
collect
)
{
let
that
=
this
$
.
post
(
U
(
'exams/Index/collect'
),
{
action
:
collect
,
source_id
:
that
.
currentQuestion
.
exams_question_id
},
function
(
res
)
{
},
function
(
res
)
{
let
r
=
JSON
.
parse
(
res
)
if
(
r
.
status
==
1
)
{
if
(
r
.
status
==
1
)
{
that
.
currentQuestion
.
is_collect
=
collect
}
})
},
onChoose
:
function
(
opt
)
{
if
(
this
.
currentQuestionTypeKey
==
'radio'
)
{
this
.
currentOptions
.
forEach
(
r
=>
{
onChoose
:
function
(
opt
)
{
if
(
this
.
currentQuestionTypeKey
==
'radio'
)
{
this
.
currentOptions
.
forEach
(
r
=>
{
r
.
selected
=
opt
.
key
==
r
.
key
})
}
},
onCounting
:
function
()
{
if
(
this
.
counting
)
{
onCounting
:
function
()
{
if
(
this
.
counting
)
{
this
.
counting
=
false
this
.
showPause
=
true
}
else
{
...
...
@@ -621,64 +598,62 @@
this
.
doCountDown
()
}
},
onContinue
:
function
()
{
onContinue
:
function
()
{
this
.
showPause
=
false
this
.
onCounting
()
},
onQuit
:
function
()
{
onQuit
:
function
()
{
this
.
showPause
=
false
this
.
saveProgress
()
},
onCancel
:
function
()
{
onCancel
:
function
()
{
this
.
showFinish
=
false
window
.
history
.
back
()
},
onSure
:
function
()
{
onSure
:
function
()
{
this
.
showFinish
=
false
this
.
submitPaper
()
},
onNextQuestion
:
function
()
{
if
(
this
.
current
<
this
.
totalQuestion
)
{
onNextQuestion
:
function
()
{
if
(
this
.
current
<
this
.
totalQuestion
)
{
this
.
cacheQuestion
()
if
(
!
this
.
review
)
{
if
(
!
this
.
review
)
{
this
.
expand
=
false
}
this
.
current
+=
1
}
else
{
if
(
!
this
.
review
)
{
if
(
!
this
.
review
)
{
this
.
showFinish
=
true
}
else
{
window
.
history
.
back
()
}
}
},
onPreviousQuestion
:
function
()
{
if
(
this
.
current
>
1
)
{
onPreviousQuestion
:
function
()
{
if
(
this
.
current
>
1
)
{
this
.
current
-=
1
}
},
cacheQuestion
:
function
()
{
if
(
this
.
review
)
{
cacheQuestion
:
function
()
{
if
(
this
.
review
)
{
return
}
let
q
=
this
.
currentQuestion
let
mode
=
this
.
finished
.
hx_firstOf
(
r
=>
{
return
r
.
qId
==
q
.
exams_question_id
})
if
(
mode
)
{
switch
(
this
.
currentQuestionTypeKey
)
{
let
mode
=
this
.
finished
.
hx_firstOf
(
r
=>
{
return
r
.
qId
==
q
.
exams_question_id
})
if
(
mode
)
{
switch
(
this
.
currentQuestionTypeKey
)
{
case
"radio"
:
let
my
=
this
.
currentMyOptions
if
(
my
.
length
>
0
)
{
if
(
my
.
length
>
0
)
{
mode
.
option
=
my
[
0
].
key
}
break
}
}
else
{
switch
(
this
.
currentQuestionTypeKey
)
{
switch
(
this
.
currentQuestionTypeKey
)
{
case
"radio"
:
let
my
=
this
.
currentMyOptions
if
(
my
.
length
>
0
)
{
if
(
my
.
length
>
0
)
{
this
.
finished
.
push
({
qId
:
q
.
exams_question_id
,
option
:
my
[
0
].
key
,
...
...
@@ -691,7 +666,7 @@
},
//Request
//Collect Params
collectParam
:
function
()
{
collectParam
:
function
()
{
let
that
=
this
let
time
=
that
.
info
.
reply_time
*
60
-
that
.
timeConsumed
let
param
=
{
...
...
@@ -703,9 +678,9 @@
is_timeout
:
time
<=
0
?
1
:
0
,
paper_options_id
:
that
.
paperOptions
.
exams_paper_options_id
,
}
that
.
finished
.
forEach
(
r
=>
{
that
.
finished
.
forEach
(
r
=>
{
let
key
=
'user_answer['
+
r
.
qId
+
']'
switch
(
r
.
key
)
{
switch
(
r
.
key
)
{
case
"radio"
:
param
[
key
]
=
r
.
option
break
...
...
@@ -713,15 +688,15 @@
})
return
param
},
saveProgress
:
function
()
{
saveProgress
:
function
()
{
let
that
=
this
that
.
cacheQuestion
()
let
param
=
this
.
collectParam
()
$
.
post
(
U
(
'exams/Index/doProgressExams'
),
param
,
function
(
res
)
{
if
(
typeof
(
res
)
!=
'object'
)
{
function
(
res
)
{
if
(
typeof
(
res
)
!=
'object'
)
{
try
{
let
res
=
JSON
.
parse
(
res
)
}
catch
(
e
)
{
...
...
@@ -736,14 +711,14 @@
}
})
},
submitPaper
:
function
()
{
submitPaper
:
function
()
{
let
that
=
this
that
.
cacheQuestion
()
let
param
=
this
.
collectParam
()
$
.
post
(
U
(
'exams/Index/doHaddleExams'
),
param
,
function
(
r
)
{
function
(
r
)
{
let
res
=
JSON
.
parse
(
r
)
if
(
res
.
status
==
1
)
{
ui
.
success
(
res
.
data
.
info
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment