Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李俊赕
self-support
Commits
9e03467d
Commit
9e03467d
authored
May 26, 2021
by
linwenqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:考试bug修复
parent
d98f46a0
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
201 additions
and
256 deletions
+201
-256
learn.js
src/common/api/learn.js
+5
-1
learn.vue
src/pages/index/learn.vue
+43
-44
answer.vue
src/pages/learn/answer.vue
+128
-185
assessment.vue
src/pages/learn/assessment.vue
+25
-26
No files found.
src/common/api/learn.js
View file @
9e03467d
...
...
@@ -18,8 +18,12 @@ let learnApiFun = function(vm){
/* 获取考试结果 */
let
getExamResult
=
async
(
examId
,
params
=
{})
=>
await
vm
.
$u
.
post
(
sysApiUrl
+
'/wxh-worker-rest/rest/exam/serviceRule/userExamInfo/'
+
vm
.
vuex_token
+
'?examId='
+
examId
,
params
);
/* 申请考试 */
let
applyExam
=
async
(
examId
,
params
=
{})
=>
await
vm
.
$u
.
post
(
sysApiUrl
+
'/wxh-worker-rest/rest/exam/serviceRule/'
+
vm
.
vuex_token
+
'?examId='
+
examId
,
params
);
/* 获取下一题 */
let
getNextQuestion
=
async
(
userExamId
,
questionId
,
userAnswerIds
,
params
=
{})
=>
await
vm
.
$u
.
post
(
sysApiUrl
+
'/wxh-worker-rest/rest/exam/serviceRule/next/'
+
vm
.
vuex_token
+
'?userExamId='
+
userExamId
+
'&questionId='
+
questionId
+
'&userAnswerIds='
+
(
userAnswerIds
||
"9999"
),
params
);
const
learnApi
=
{
getTrainingNoticeList
,
CourseList
,
ChapterDetails
,
CourseSection
,
updateLearnCourses
,
getExamResult
getTrainingNoticeList
,
CourseList
,
ChapterDetails
,
CourseSection
,
updateLearnCourses
,
getExamResult
,
applyExam
,
getNextQuestion
}
return
learnApi
}
...
...
src/pages/index/learn.vue
View file @
9e03467d
...
...
@@ -695,55 +695,54 @@ export default {
let
length
=
this
.
examList
.
length
;
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
let
examId
=
this
.
examList
[
i
].
id
;
this
.
$u
.
api
.
getExamResult
(
examId
)
.
then
((
res
)
=>
{
if
(
res
.
code
!=
200
)
{
console
.
log
(
"getUserExamInfo 200 err"
);
uni
.
showToast
({
icon
:
"none"
,
title
:
"获取考试信息失败"
,
});
}
this
.
examList
[
i
].
examId
=
res
.
data
.
id
;
this
.
examList
[
i
].
examStatus
=
res
.
data
.
examStatus
;
//i;//
this
.
examList
[
i
].
questionTime
=
res
.
data
.
questionTime
;
let
examResult
=
res
.
data
.
examLevelResult
;
this
.
examList
[
i
].
status
=
examResult
!=
""
?
examResult
:
"未通过"
;
//动态获取条件
let
ruleDisc
=
res
.
data
.
ruleDisc
;
let
targetIndex
=
ruleDisc
.
indexOf
(
"("
);
if
(
targetIndex
)
{
this
.
examList
[
i
].
condition
=
ruleDisc
.
substr
(
targetIndex
+
1
)
.
replace
(
")"
,
""
);
}
// examStatus 用户考试状态 0考试中 1考试完成 2未参与
that
.
exam
=
res
.
data
;
if
(
res
.
data
.
examStatus
==
2
)
{
return
;
}
if
(
res
.
data
.
examStatus
==
1
)
{
that
.
examList
[
i
].
isComplete
=
this
.
examList
[
i
].
status
==
"已通过"
;
that
.
examScore
=
res
.
data
.
examScore
;
return
;
}
if
(
res
.
data
.
examStatus
==
0
)
{
that
.
userExamId
=
res
.
data
.
id
;
}
})
.
catch
((
err
)
=>
{
uni
.
hideLoading
();
this
.
$u
.
api
.
getExamResult
(
examId
)
.
then
((
res
)
=>
{
if
(
res
.
code
!=
200
)
{
console
.
log
(
"getUserExamInfo 200 err"
);
uni
.
showToast
({
icon
:
"none"
,
title
:
"获取考试信息失败"
,
});
}
this
.
examList
[
i
].
examId
=
res
.
data
.
id
;
this
.
examList
[
i
].
examStatus
=
res
.
data
.
examStatus
;
//i;//
this
.
examList
[
i
].
questionTime
=
res
.
data
.
questionTime
;
let
examResult
=
res
.
data
.
examLevelResult
;
this
.
examList
[
i
].
status
=
examResult
!=
""
?
examResult
:
"未通过"
;
//动态获取条件
let
ruleDisc
=
res
.
data
.
ruleDisc
;
let
targetIndex
=
ruleDisc
.
indexOf
(
"("
);
if
(
targetIndex
)
{
this
.
examList
[
i
].
condition
=
ruleDisc
.
substr
(
targetIndex
+
1
)
.
replace
(
")"
,
""
);
}
// examStatus 用户考试状态 0考试中 1考试完成 2未参与
that
.
exam
=
res
.
data
;
if
(
res
.
data
.
examStatus
==
2
)
{
return
;
}
if
(
res
.
data
.
examStatus
==
1
)
{
that
.
examList
[
i
].
isComplete
=
this
.
examList
[
i
].
status
==
"已通过"
;
that
.
examScore
=
res
.
data
.
examScore
;
return
;
}
if
(
res
.
data
.
examStatus
==
0
)
{
that
.
userExamId
=
res
.
data
.
id
;
}
})
.
catch
((
err
)
=>
{
uni
.
hideLoading
();
uni
.
showToast
({
icon
:
"none"
,
title
:
"获取考试信息失败"
,
});
});
}
},
//跳转到assessment页面
...
...
src/pages/learn/answer.vue
View file @
9e03467d
This diff is collapsed.
Click to expand it.
src/pages/learn/assessment.vue
View file @
9e03467d
...
...
@@ -39,9 +39,11 @@ export default {
onLoad
(
param
)
{
getApp
().
trackPage
(
'学习开始考试页'
)
this
.
examId
=
param
.
examId
;
this
.
getExamResult
();
// this.getUserExamInfo();
},
onShow
()
{
this
.
getExamResult
();
},
onUnload
()
{
uni
.
switchTab
({
url
:
'/pages/index/learn'
...
...
@@ -67,32 +69,29 @@ export default {
});
},
getExamResult
()
{
uni
.
request
({
url
:
process
.
uniEnv
.
systemUrl
.
apiUrl
+
"/wxh-worker-rest/rest/exam/serviceRule/userExamInfo/"
+
this
.
vuex_token
+
"?examId="
+
this
.
examId
,
method
:
"POST"
,
header
:
{
"Content-Type"
:
"application/x-www-from-urlencoded"
,
},
success
:
(
res
)
=>
{
uni
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
data
.
ruleDisc
)
{
var
str
=
res
.
data
.
data
.
ruleDisc
;
this
.
userExamId
=
res
.
data
.
data
.
id
;
let
strArr
=
str
.
split
(
"("
)[
0
].
split
(
","
);
this
.
title
=
strArr
[
0
];
this
.
score
=
strArr
[
1
];
this
.
time
=
strArr
[
2
];
this
.
ruleDisc
=
strArr
[
3
];
}
let
examId
=
this
.
examId
;
this
.
$u
.
api
.
getExamResult
(
examId
)
.
then
((
res
)
=>
{
uni
.
hideLoading
();
if
(
res
.
code
==
200
)
{
if
(
res
.
data
.
ruleDisc
)
{
var
str
=
res
.
data
.
ruleDisc
;
this
.
userExamId
=
res
.
data
.
id
;
let
strArr
=
str
.
split
(
"("
)[
0
].
split
(
","
);
this
.
title
=
strArr
[
0
];
this
.
score
=
strArr
[
1
];
this
.
time
=
strArr
[
2
];
this
.
ruleDisc
=
strArr
[
3
];
}
},
}
})
.
catch
((
err
)
=>
{
uni
.
hideLoading
();
uni
.
showToast
({
icon
:
"none"
,
title
:
"获取考试信息失败"
,
});
});
},
},
...
...
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