Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-professional-exam
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Culm
pica-professional-exam
提交
6cb951c7
提交
6cb951c7
编写于
9月 26, 2020
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
做题主流程
上级
f539b887
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
235 行增加
和
107 行删除
+235
-107
no-content.vue
src/components/question/no-content.vue
+4
-4
question-content.vue
src/components/question/question-content.vue
+42
-21
question-footer.vue
src/components/question/question-footer.vue
+24
-19
getters.js
src/store/getters.js
+5
-4
question.js
src/store/modules/question.js
+51
-30
fetch.js
src/utils/fetch.js
+6
-7
mixins.js
src/utils/mixins.js
+3
-1
question-detail.vue
src/views/question-detail.vue
+100
-21
未找到文件。
src/components/question/no-content.vue
浏览文件 @
6cb951c7
<
template
>
<
template
>
<div
class=
"no-question-wrapper"
>
<div
class=
"no-question-wrapper"
>
<img
v-if=
"
dataType
== 1"
src=
"../../images/question/no-error.png"
alt=
""
>
<img
v-if=
"
commitKind
== 1"
src=
"../../images/question/no-error.png"
alt=
""
>
<img
v-else-if=
"
dataType
== 2"
src=
"../../images/question/no-collect.png"
alt=
""
>
<img
v-else-if=
"
commitKind
== 2"
src=
"../../images/question/no-collect.png"
alt=
""
>
<img
v-else
src=
"../../images/question/no-collect.png"
alt=
""
>
<img
v-else
src=
"../../images/question/no-collect.png"
alt=
""
>
<span>
{{
dataType
==
1
?
"您答错的题目会自动记录在这里哦!"
:
dataType
==
2
?
"您收藏的题目会自动记录在这里哦!"
:
"现在没有题目哦!"
}}
</span>
<span>
{{
commitKind
==
1
?
"您答错的题目会自动记录在这里哦!"
:
commitKind
==
2
?
"您收藏的题目会自动记录在这里哦!"
:
"现在没有题目哦!"
}}
</span>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
props
:
{
props
:
{
dataType
:
{
// 答题来源 1:错题集 2:收藏 3:题库
commitKind
:
{
// 答题来源 1:错题集 2:收藏 3:题库
type
:
Number
|
String
,
type
:
Number
|
String
,
default
:
1
default
:
1
}
}
...
...
src/components/question/question-content.vue
浏览文件 @
6cb951c7
...
@@ -17,9 +17,7 @@
...
@@ -17,9 +17,7 @@
v-for=
"(item, index) in currentQuestion.options"
v-for=
"(item, index) in currentQuestion.options"
:key=
"index"
:key=
"index"
>
>
<span
v-if=
"!item.isSelected"
class=
"option"
>
{{
getOrderVac
(
index
)
}}
.
</span>
<span
class=
"option"
>
{{
getOrderVac
(
index
)
}}
.
</span>
<img
v-if=
"item.isSelected && item.isCorrect"
src=
"../../images/question/correct.png"
alt
/>
<img
v-if=
"item.isSelected && !item.isCorrect"
src=
"../../images/question/error.png"
alt
/>
<span
class=
"content"
>
{{
item
.
text
}}
</span>
<span
class=
"content"
>
{{
item
.
text
}}
</span>
</div>
</div>
</article>
</article>
...
@@ -29,15 +27,22 @@
...
@@ -29,15 +27,22 @@
<span
class=
"type"
:class=
"
{'multi': currentQuestion.typeId == 2}">
<span
class=
"type"
:class=
"
{'multi': currentQuestion.typeId == 2}">
<span>
{{
currentQuestion
.
typeId
==
1
?
"单选题"
:
"多选题"
}}
</span>
<span>
{{
currentQuestion
.
typeId
==
1
?
"单选题"
:
"多选题"
}}
</span>
</span>
</span>
<span
class=
"content"
>
{{
currentQuestion
.
question
}}
</span>
<span
class=
"content"
v-html=
"currentQuestion.question"
>
</span>
<
img
src=
"https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png"
/
>
<
!--
<img
src=
"https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png"
/>
--
>
</article>
</article>
<article
class=
"select-wrapper"
>
<article
class=
"select-wrapper"
>
<div
class=
"item"
v-for=
"(item, index) in currentQuestion.options"
:key=
"index"
@
click=
"selectOption(index)"
>
<div
class=
"item"
v-for=
"(item, index) in currentQuestion.options"
:key=
"index"
@
click=
"selectOption(index)"
>
<span
v-if=
"!item.isSelected"
class=
"option border"
>
{{
getOrderVac
(
index
)
}}
</span>
<span
v-if=
"!item.isSelected"
class=
"option border"
>
{{
getOrderVac
(
index
)
}}
</span>
<img
v-if=
"item.isSelected && item.isCorrect"
src=
"../../images/question/correct.png"
alt
/>
<span
v-if=
"item.isSelected && !currentQuestion.commitFlag"
class=
"option bg"
>
{{
getOrderVac
(
index
)
}}
</span>
<img
v-if=
"item.isSelected && !item.isCorrect"
src=
"../../images/question/error.png"
alt
/>
<template
v-else
>
<span
<img
v-if=
"item.isSelected && item.isCorrect"
src=
"../../images/question/correct.png"
alt
/>
<img
v-if=
"item.isSelected && !item.isCorrect"
src=
"../../images/question/error.png"
alt
/>
</
template
>
<span
v-if=
"!currentQuestion.commitFlag"
class=
"content"
:class=
"{'select': item.isSelected}"
>
{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}
</span>
<span
v-else
class=
"content"
class=
"content"
:class=
"{'select': item.isSelected && item.isCorrect, 'error': item.isSelected && !item.isCorrect}"
:class=
"{'select': item.isSelected && item.isCorrect, 'error': item.isSelected && !item.isCorrect}"
>
{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}
</span>
>
{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}
</span>
...
@@ -56,10 +61,10 @@
...
@@ -56,10 +61,10 @@
<span class="content">查看病理,了解病史</span>
<span class="content">查看病理,了解病史</span>
</div>-->
</div>-->
</article>
</article>
<article
class=
"c-btn-wrapper"
v-show=
"currentQuestion.typeId == 2"
>
<article
class=
"c-btn-wrapper"
v-show=
"currentQuestion.typeId == 2
&& !currentQuestion.commitFlag"
@
click=
"commitAnswer
"
>
<van-button
size=
"large"
round
color=
"#449284"
>
确 认
</van-button>
<van-button
size=
"large"
round
color=
"#449284"
>
确 认
</van-button>
</article>
</article>
<article
class=
"answer-wrapper"
v-show=
"currentQuestion.isAnalyzed || currentQuestion.
myAnswer
"
>
<article
class=
"answer-wrapper"
v-show=
"currentQuestion.isAnalyzed || currentQuestion.
commitFlag
"
>
<span
class=
"content"
>
正确答案:D
</span>
<span
class=
"content"
>
正确答案:D
</span>
</article>
</article>
<article
class=
"analysis-wrapper"
v-show=
"currentQuestion.isAnalyzed"
>
<article
class=
"analysis-wrapper"
v-show=
"currentQuestion.isAnalyzed"
>
...
@@ -101,7 +106,6 @@ export default {
...
@@ -101,7 +106,6 @@ export default {
...
mapGetters
([
...
mapGetters
([
"questionList"
,
"questionList"
,
"currentQuestion"
,
"currentQuestion"
,
"currentQuestionIndex"
,
])
])
},
},
data
()
{
data
()
{
...
@@ -119,25 +123,33 @@ export default {
...
@@ -119,25 +123,33 @@ export default {
},
},
// 选择选项
// 选择选项
selectOption
(
index
)
{
selectOption
(
index
)
{
if
(
this
.
currentQuestion
.
commitFlag
)
return
;
// 只记录当前选项,不提交答案
// 只记录当前选项,不提交答案
this
.
currentQuestion
.
options
[
index
].
selected
=
true
;
this
.
currentQuestion
.
options
[
index
].
isSelected
=
true
;
// 重新设置答案(myAnswer)
if
(
this
.
currentQuestion
.
typeId
==
2
)
{
if
(
this
.
currentQuestion
.
typeId
==
2
)
{
// 重新设置答案(myAnswer)
let
myAnswer
=
""
;
let
myAnswer
=
""
;
this
.
currentQuestion
.
options
.
forEach
(
(
item
,
index
)
=>
{
this
.
currentQuestion
.
options
.
forEach
(
(
item
,
index
)
=>
{
if
(
item
.
s
elected
)
{
if
(
item
.
isS
elected
)
{
myAnswer
+=
this
.
getOrderVac
(
index
);
myAnswer
+=
this
.
getOrderVac
(
index
);
}
}
})
})
myAnswer
=
myAnswer
.
split
(
''
).
join
(
','
);
myAnswer
=
myAnswer
.
split
(
''
).
join
(
','
);
this
.
currentQuestion
.
myAnswer
=
myAnswer
;
this
.
currentQuestion
.
myAnswer
=
myAnswer
;
}
else
{
}
else
{
// 单选题直接设置commitFlag
if
(
this
.
currentQuestion
.
options
[
index
].
isCorrect
)
{
this
.
currentQuestion
.
commitFlag
=
1
;
}
else
{
this
.
currentQuestion
.
commitFlag
=
2
;
}
this
.
currentQuestion
.
myAnswer
=
this
.
getOrderVac
(
index
);
this
.
currentQuestion
.
myAnswer
=
this
.
getOrderVac
(
index
);
this
.
commit
();
this
.
commit
Answer
();
}
}
this
.
$forceUpdate
();
console
.
log
(
"in commit"
,
this
.
currentQuestion
.
myAnswer
);
console
.
log
(
"in commit"
,
this
.
currentQuestion
.
myAnswer
);
},
},
commit
()
{
commit
Answer
()
{
let
params
=
{
let
params
=
{
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
0
,
// 题库ID
directoryId
:
0
,
// 题库ID
...
@@ -147,7 +159,8 @@ export default {
...
@@ -147,7 +159,8 @@ export default {
resultId
:
1
,
// 刷题库轮次ID,刷收藏和错题集时为0
resultId
:
1
,
// 刷题库轮次ID,刷收藏和错题集时为0
rightFlag
:
1
,
// 答题对错:1对 2错
rightFlag
:
1
,
// 答题对错:1对 2错
titleId
:
1
,
// 题目ID
titleId
:
1
,
// 题目ID
}
};
this
.
currentQuestion
.
commitFlag
=
1
;
}
}
}
}
};
};
...
@@ -186,15 +199,18 @@ export default {
...
@@ -186,15 +199,18 @@ export default {
background: #e6a23c;
background: #e6a23c;
}
}
}
}
.content {
.content {
font-size: 16px;
font-size: 16px;
font-weight: 700;
font-weight: 700;
color: #333333;
color: #333333;
// & > img {
// margin-top: 15px !important;
// width: 100% !important;
// }
}
}
& >
img {
img {
margin-top: 15px
;
margin-top: 15px !important
;
width: 100%;
width: 100% !important;
}
}
}
}
.select-wrapper {
.select-wrapper {
...
@@ -218,6 +234,11 @@ export default {
...
@@ -218,6 +234,11 @@ export default {
border: 1px solid #c7c8c9;
border: 1px solid #c7c8c9;
border-radius: 50%;
border-radius: 50%;
}
}
&.bg {
color: #fff;
background: #449284;
border-radius: 50%;
}
}
}
& > img {
& > img {
width: 18px;
width: 18px;
...
...
src/components/question/question-footer.vue
浏览文件 @
6cb951c7
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
<span
class=
"text"
>
收藏
</span>
<span
class=
"text"
>
收藏
</span>
</article>
</article>
<article
class=
"right"
>
<article
class=
"right"
>
<span
class=
"pre"
:class=
"
{'disabled': currentQuestion
Index == 0
}" @click="previous">上一题
</span>
<span
class=
"pre"
:class=
"
{'disabled': currentQuestion
.titleNo == 1
}" @click="previous">上一题
</span>
<span
class=
"next"
@
click=
"next"
>
下一题
</span>
<span
class=
"next"
:class=
"
{'disabled': currentQuestion.titleNo == totalCount}"
@click="next">下一题
</span>
</article>
</article>
</section>
</section>
</
template
>
</
template
>
...
@@ -21,14 +21,23 @@ import { mapGetters, mapActions } from "vuex";
...
@@ -21,14 +21,23 @@ import { mapGetters, mapActions } from "vuex";
export
default
{
export
default
{
props
:
{},
props
:
{},
data
()
{
data
()
{
return
{};
return
{
queryParams
:
{
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
0
,
// 题库ID,获取错题集或收藏时传0
pageFlag
:
0
,
// 翻页标记:0往前翻页 1往后翻页
pageSize
:
10
,
// 每页大小
secondSubjectId
:
0
,
// 二级学科分类ID:用于判断学科下目录免费题数
titleNo
:
0
,
// 起始或结束题目序号,首次进入页面时传0,系统自动定位到上次做的题
}
};
},
},
computed
:
{
computed
:
{
...
mapGetters
([
...
mapGetters
([
"
dataType
"
,
"
commitKind
"
,
"questionList"
,
"questionList"
,
"currentQuestion"
,
"currentQuestion"
,
"currentQuestionIndex"
,
"totalCount"
,
"totalCount"
,
"userInfo"
"userInfo"
])
])
...
@@ -37,14 +46,12 @@ export default {
...
@@ -37,14 +46,12 @@ export default {
// 上一页 // 有可能要触发上分页(前端的个数只有一条)
// 上一页 // 有可能要触发上分页(前端的个数只有一条)
// TODO
// TODO
previous
()
{
previous
()
{
if
(
this
.
currentQuestion
.
order
==
1
)
{
if
(
this
.
currentQuestion
.
titleNo
==
1
)
{
Toast
(
"已是第一题"
);
Toast
(
"已是第一题"
);
}
else
{
}
else
{
let
preIndex
=
this
.
currentQuestionIndex
-
1
;
this
.
$store
.
commit
(
"SET_CURRENT_QUESTION_INDEX"
,
preIndex
);
this
.
$store
.
commit
(
this
.
$store
.
commit
(
"SET_CURRENT_QUESTION"
,
"SET_CURRENT_QUESTION"
,
this
.
questionList
[
preIndex
]
||
{
answerList
:
[]
}
this
.
questionList
[
this
.
currentQuestion
.
titleNo
-
2
]
||
{
answerList
:
[]
}
);
);
}
}
},
},
...
@@ -52,17 +59,14 @@ export default {
...
@@ -52,17 +59,14 @@ export default {
// 下一页 // 有可能要触发下分页(后面的个数只有一条)
// 下一页 // 有可能要触发下分页(后面的个数只有一条)
// TODO
// TODO
next
()
{
next
()
{
if
(
this
.
currentQuestion
.
order
==
this
.
totalCount
)
{
// if (this.currentQuestion.titleNo == this.totalCount) {
Toast
(
"已是最后一题"
);
if
(
this
.
currentQuestion
.
titleNo
==
this
.
questionList
.
length
)
{
// Toast("已是最后一题");
this
.
$emit
(
"statistics"
);
}
else
{
}
else
{
if
(
this
.
currentQuestion
.
order
>=
this
.
questionList
.
length
)
{
return
;
}
let
nextIndex
=
this
.
currentQuestionIndex
+
1
;
this
.
$store
.
commit
(
"SET_CURRENT_QUESTION_INDEX"
,
nextIndex
);
this
.
$store
.
commit
(
this
.
$store
.
commit
(
"SET_CURRENT_QUESTION"
,
"SET_CURRENT_QUESTION"
,
this
.
questionList
[
nextIndex
]
||
{
answerList
:
[]
}
this
.
questionList
[
this
.
currentQuestion
.
titleNo
]
||
{
answerList
:
[]
}
);
);
}
}
},
},
...
@@ -81,15 +85,16 @@ export default {
...
@@ -81,15 +85,16 @@ export default {
// 收藏/取消收藏
// 收藏/取消收藏
favor
(
currentQuestion
)
{
favor
(
currentQuestion
)
{
this
.
currentQuestion
.
favorFlag
=
this
.
currentQuestion
.
favorFlag
==
0
?
1
:
0
;
let
favorFlag
=
currentQuestion
.
favorFlag
;
let
favorFlag
=
currentQuestion
.
favorFlag
;
let
param
=
{
let
param
=
{
dataType
:
this
.
dataType
,
commitKind
:
this
.
commitKind
,
directoryId
:
currentQuestion
.
directoryId
,
directoryId
:
currentQuestion
.
directoryId
,
examTitleId
:
currentQuestion
.
examTitleId
,
examTitleId
:
currentQuestion
.
examTitleId
,
operateType
:
favorFlag
==
1
?
2
:
1
,
// 操作类型:1:收藏 2:取消收藏
operateType
:
favorFlag
==
1
?
2
:
1
,
// 操作类型:1:收藏 2:取消收藏
paperId
:
currentQuestion
.
paperId
,
paperId
:
currentQuestion
.
paperId
,
paperIndex
:
currentQuestion
.
paperIndex
,
paperIndex
:
currentQuestion
.
paperIndex
,
token
:
this
.
userInfo
.
userToken
||
this
.
token
,
token
:
this
.
userInfo
.
userToken
||
this
.
token
||
'998E10CD98ED4BCF91A28223270FE8CE'
,
setEntry
:
true
setEntry
:
true
// userId: 0
// userId: 0
};
};
...
...
src/store/getters.js
浏览文件 @
6cb951c7
...
@@ -8,11 +8,12 @@ const getters = {
...
@@ -8,11 +8,12 @@ const getters = {
organizationInfo
:
state
=>
state
.
coop
.
organizationInfo
,
organizationInfo
:
state
=>
state
.
coop
.
organizationInfo
,
logged
:
state
=>
!!
(
state
.
user
.
token
&&
state
.
user
.
info
.
id
),
logged
:
state
=>
!!
(
state
.
user
.
token
&&
state
.
user
.
info
.
id
),
// 刷题相关
// 刷题相关
commonConfig
:
state
=>
state
.
question
.
commonConfig
,
titleConfig
:
state
=>
state
.
question
.
titleConfig
,
questionList
:
state
=>
state
.
question
.
questionList
,
questionList
:
state
=>
state
.
question
.
questionList
,
currentQuestion
:
state
=>
state
.
question
.
currentQuestion
,
currentQuestion
:
state
=>
state
.
question
.
currentQuestion
,
currentQuestionIndex
:
state
=>
state
.
question
.
currentQuestionIndex
,
commitKind
:
state
=>
state
.
question
.
titleConfig
.
commitKind
,
dataType
:
state
=>
state
.
question
.
dataType
,
freeFlag
:
state
=>
state
.
question
.
titleConfig
.
freeFlag
,
freeFlag
:
state
=>
state
.
question
.
freeFlag
,
totalCount
:
state
=>
state
.
question
.
titleConfig
.
totalCount
,
totalCount
:
state
=>
state
.
question
.
totalCount
,
}
}
export
default
getters
export
default
getters
src/store/modules/question.js
浏览文件 @
6cb951c7
...
@@ -5,12 +5,9 @@
...
@@ -5,12 +5,9 @@
const
question
=
{
const
question
=
{
state
:
{
state
:
{
dataType
:
0
,
currentTitle
:
"题库"
,
freeFlag
:
0
,
bindStatus
:
0
,
// 绑卡状态:0未绑卡 1已绑卡
questionList
:
[],
questionList
:
[],
currentQuestion
:
{
currentQuestion
:
{
order
:
1
,
isAnalyzed
:
false
,
isAnalyzed
:
false
,
options
:
[
// 从options加工出来
options
:
[
// 从options加工出来
{
{
...
@@ -40,7 +37,7 @@ const question = {
...
@@ -40,7 +37,7 @@ const question = {
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
unionQuestion
:
""
,
// 共用题干
unionQuestion
:
""
,
// 共用题干
question
:
"题干内容"
,
// 题干内容
question
:
'题干内容<img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" />'
,
// 题干内容
config
:
""
,
// 选项
config
:
""
,
// 选项
answer
:
""
,
// 正确答案
answer
:
""
,
// 正确答案
intro
:
""
,
// 题目解析
intro
:
""
,
// 题目解析
...
@@ -54,18 +51,38 @@ const question = {
...
@@ -54,18 +51,38 @@ const question = {
paperId
:
""
,
// 试卷ID
paperId
:
""
,
// 试卷ID
paperIndex
:
""
,
// 试卷索引
paperIndex
:
""
,
// 试卷索引
},
},
currentQuestionIndex
:
0
,
commonConfig
:
{
totalCount
:
30
,
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
resultId
:
0
,
freeFlag
:
0
,
currentTitleNo
:
""
,
directoryId
:
""
,
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
secondSubjectId
:
0
,
cardType
:
3
,
goodsType
:
3
,
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
},
titleConfig
:
{
bindStatus
:
0
,
// 绑卡状态:0未绑卡 1已绑卡
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo
:
0
,
// 定位答题题目id
resultId
:
0
,
// 刷题库轮次ID
totalCount
:
0
,
// 题目总数
}
},
},
mutations
:
{
mutations
:
{
SET_DATA_TYPE
:
(
state
,
payload
)
=>
{
SET_COMMON_CONIFG
:
(
state
,
payload
)
=>
{
state
.
dataType
=
payload
;
state
.
commonConfig
=
payload
;
},
SET_TITLE_CONIFG
:
(
state
,
payload
)
=>
{
state
.
titleConfig
=
payload
;
},
SET_COMMIT_KIND
:
(
state
,
payload
)
=>
{
state
.
titleConfig
.
commitKind
=
payload
;
},
},
SET_FREE_FLAG
:
(
state
,
payload
)
=>
{
SET_FREE_FLAG
:
(
state
,
payload
)
=>
{
state
.
freeFlag
=
payload
;
state
.
titleConfig
.
freeFlag
=
payload
;
},
SET_TOTAL_COUNT
:
(
state
,
payload
)
=>
{
state
.
titleConfig
.
totalCount
=
payload
;
},
},
SET_QUESTION_LIST
:
(
state
,
payload
)
=>
{
SET_QUESTION_LIST
:
(
state
,
payload
)
=>
{
state
.
questionList
=
payload
;
state
.
questionList
=
payload
;
...
@@ -73,20 +90,23 @@ const question = {
...
@@ -73,20 +90,23 @@ const question = {
SET_CURRENT_QUESTION
:
(
state
,
payload
)
=>
{
SET_CURRENT_QUESTION
:
(
state
,
payload
)
=>
{
state
.
currentQuestion
=
payload
;
state
.
currentQuestion
=
payload
;
},
},
SET_CURRENT_QUESTION_INDEX
:
(
state
,
payload
)
=>
{
state
.
currentQuestionIndex
=
payload
;
},
SET_TOTAL_COUNT
:
(
state
,
payload
)
=>
{
state
.
totalCount
=
payload
;
},
},
},
actions
:
{
actions
:
{
// 获取用户信息
// 获取用户信息
async
getQuestionList
({
commit
,
state
},
params
)
{
async
getQuestionList
({
commit
,
state
},
params
)
{
// let param = {
// ...params,
// token: '998E10CD98ED4BCF91A28223270FE8CE',
// setEntry: true
// };
// this.GET(`portal/titleTest/practise/titles`, param).then(({ data }) => {
// console.log(data);
// });
// getQuestionList
console
.
log
(
params
);
console
.
log
(
params
);
let
currentList
=
[
let
currentList
=
[
{
{
order
:
1
,
isAnalyzed
:
false
,
isAnalyzed
:
false
,
options
:
[
options
:
[
{
{
...
@@ -131,7 +151,6 @@ const question = {
...
@@ -131,7 +151,6 @@ const question = {
paperIndex
:
""
,
// 试卷索引
paperIndex
:
""
,
// 试卷索引
},
},
{
{
order
:
2
,
isAnalyzed
:
false
,
isAnalyzed
:
false
,
options
:
[
options
:
[
{
{
...
@@ -155,8 +174,8 @@ const question = {
...
@@ -155,8 +174,8 @@ const question = {
text
:
"进行分析评3"
,
text
:
"进行分析评3"
,
},
},
],
],
titleId
:
1
,
titleId
:
2
,
titleNo
:
1
,
// 题序,从1开始
titleNo
:
2
,
// 题序,从1开始
typeId
:
1
,
// 题目类型ID 1-单选,2-多选,3-判断
typeId
:
1
,
// 题目类型ID 1-单选,2-多选,3-判断
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
2
,
// 0普通题型 1-共用题干; 2-共用选项
unionType
:
2
,
// 0普通题型 1-共用题干; 2-共用选项
...
@@ -176,7 +195,6 @@ const question = {
...
@@ -176,7 +195,6 @@ const question = {
paperIndex
:
""
,
// 试卷索引
paperIndex
:
""
,
// 试卷索引
},
},
{
{
order
:
3
,
isAnalyzed
:
false
,
isAnalyzed
:
false
,
options
:
[
options
:
[
{
{
...
@@ -201,8 +219,8 @@ const question = {
...
@@ -201,8 +219,8 @@ const question = {
},
},
],
],
question
:
"题干内容"
,
// 题干内容
question
:
"题干内容"
,
// 题干内容
titleId
:
1
,
//
titleId
:
3
,
//
titleNo
:
1
,
// 题序,从1开始
titleNo
:
3
,
// 题序,从1开始
typeId
:
1
,
// 题目类型ID 1-单选,2-多选,3-判断
typeId
:
1
,
// 题目类型ID 1-单选,2-多选,3-判断
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
...
@@ -222,7 +240,6 @@ const question = {
...
@@ -222,7 +240,6 @@ const question = {
paperIndex
:
""
,
// 试卷索引
paperIndex
:
""
,
// 试卷索引
},
},
{
{
order
:
4
,
isAnalyzed
:
false
,
isAnalyzed
:
false
,
options
:
[
options
:
[
{
{
...
@@ -246,8 +263,8 @@ const question = {
...
@@ -246,8 +263,8 @@ const question = {
text
:
"进行分析评估4"
,
text
:
"进行分析评估4"
,
},
},
],
],
titleId
:
1
,
titleId
:
4
,
titleNo
:
1
,
// 题序,从1开始
titleNo
:
4
,
// 题序,从1开始
typeId
:
2
,
// 题目类型ID 1-单选,2-多选,3-判断
typeId
:
2
,
// 题目类型ID 1-单选,2-多选,3-判断
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
...
@@ -269,10 +286,14 @@ const question = {
...
@@ -269,10 +286,14 @@ const question = {
];
];
commit
(
'SET_QUESTION_LIST'
,
currentList
);
commit
(
'SET_QUESTION_LIST'
,
currentList
);
// commit('SET_CURRENT_QUESTION', currentList[0] || {options:[]});
// commit('SET_CURRENT_QUESTION', currentList[0] || {options:[]});
commit
(
'SET_CURRENT_QUESTION_INDEX'
,
0
);
commit
(
'SET_TOTAL_COUNT'
,
30
);
commit
(
'SET_TOTAL_COUNT'
,
30
);
},
},
needFecth
()
{
let
qIndex
=
this
.
questionList
.
findIndex
(
(
item
,
index
)
=>
{
})
}
},
},
}
}
...
...
src/utils/fetch.js
浏览文件 @
6cb951c7
...
@@ -11,14 +11,13 @@ const service = axios.create({
...
@@ -11,14 +11,13 @@ const service = axios.create({
// request拦截器
// request拦截器
service
.
interceptors
.
request
.
use
(
config
=>
{
service
.
interceptors
.
request
.
use
(
config
=>
{
// debugger
if
(
config
.
data
&&
config
.
data
.
setEntry
)
{
if
(
config
.
data
&&
config
.
data
.
setEntry
)
{
config
.
headers
[
'sysCode'
]
=
config
.
data
.
sysCode
||
10
config
.
headers
[
'sysCode'
]
=
config
.
data
.
sysCode
||
10
if
(
config
.
data
.
token
)
{
if
(
config
.
data
.
token
)
{
config
.
headers
[
'token'
]
=
config
.
data
.
token
||
'47993ED00ECB46CE8D31ECF3AE34B4AA
'
config
.
headers
[
'token'
]
=
config
.
data
.
token
||
'998E10CD98ED4BCF91A28223270FE8CE
'
if
(
process
.
env
.
BUILD_ENV
==
"development"
)
{
// 本地开发环境
if
(
process
.
env
.
BUILD_ENV
==
"development"
)
{
// 本地开发环境
config
.
headers
[
'token'
]
=
config
.
data
.
token
||
'
47993ED00ECB46CE8D31ECF3AE34B4AA
'
;
config
.
headers
[
'token'
]
=
config
.
data
.
token
||
'
998E10CD98ED4BCF91A28223270FE8CE
'
;
}
}
}
}
delete
config
.
data
.
setEntry
;
delete
config
.
data
.
setEntry
;
delete
config
.
data
.
token
;
delete
config
.
data
.
token
;
...
@@ -38,7 +37,7 @@ service.interceptors.response.use(
...
@@ -38,7 +37,7 @@ service.interceptors.response.use(
/*
/*
baseUrl时,返回000000为成功
baseUrl时,返回000000为成功
apiUrl时,返回200为成功
apiUrl时,返回200为成功
*/
*/
if
(
res
.
code
!==
'000000'
&&
response
.
respCode
===
200
)
{
if
(
res
.
code
!==
'000000'
&&
response
.
respCode
===
200
)
{
return
Promise
.
reject
(
'error'
)
return
Promise
.
reject
(
'error'
)
}
else
{
}
else
{
...
...
src/utils/mixins.js
浏览文件 @
6cb951c7
...
@@ -110,8 +110,10 @@ module.exports = {
...
@@ -110,8 +110,10 @@ module.exports = {
// 通用GET请求
// 通用GET请求
GET
(
api
,
para
,
callback
,
str
)
{
GET
(
api
,
para
,
callback
,
str
)
{
// debugger
// debugger
let
token
=
para
.
token
||
this
.
token
||
this
.
$store
.
state
.
user
.
token
||
''
;
let
token
=
para
.
token
||
this
.
token
||
this
.
$store
.
state
.
user
.
token
||
'
998E10CD98ED4BCF91A28223270FE8CE
'
;
para
.
token
=
token
;
para
.
token
=
token
;
delete
para
.
token
;
delete
para
.
setEntry
;
let
url
=
api
+
this
.
getUrlPara
(
para
)
let
url
=
api
+
this
.
getUrlPara
(
para
)
return
fetch
({
return
fetch
({
url
:
getBaseUrl
(
url
),
url
:
getBaseUrl
(
url
),
...
...
src/views/question-detail.vue
浏览文件 @
6cb951c7
<
template
>
<
template
>
<section
class=
"question-detail-wrapper"
:style=
"
{'position': needFixed ? 'fixed': 'static'}">
<section
class=
"question-detail-wrapper"
:style=
"
{'position': needFixed ? 'fixed': 'static'}">
<question-header
:title=
"currentTitle"
:order=
"currentQuestion.
order
"
:total=
"totalCount"
></question-header>
<question-header
:title=
"currentTitle"
:order=
"currentQuestion.
titleNo
"
:total=
"totalCount"
></question-header>
<article
class=
"body"
>
<article
class=
"body"
>
<question-content
v-show=
"questionList.length"
></question-content>
<question-content
v-show=
"questionList.length"
></question-content>
<no-content
v-show=
"!questionList.length"
:listType=
"
dataType
"
></no-content>
<no-content
v-show=
"!questionList.length"
:listType=
"
commitKind
"
></no-content>
</article>
</article>
<!--
<free-tips
></free-tips>
-->
<!--
<free-tips
></free-tips>
-->
<question-footer></question-footer>
<question-footer
@
statistics=
"statistics"
></question-footer>
<ExperienceDialog
:showDialog=
"experienceDialog"
@
activeCard=
"activeCard"
@
buyCard=
"buyCard"
@
close=
"experienceDialog = false"
></ExperienceDialog>
<ExperienceDialog
:showDialog=
"experienceDialog"
@
activeCard=
"activeCard"
@
buyCard=
"buyCard"
@
close=
"experienceDialog = false"
></ExperienceDialog>
<!-- 去激活 -->
<!-- 去激活 -->
...
@@ -41,6 +41,7 @@ import CourseDialog from "@/components/course/course-dialog";
...
@@ -41,6 +41,7 @@ import CourseDialog from "@/components/course/course-dialog";
import
ChangeCard
from
"@/components/cme/change-card"
;
import
ChangeCard
from
"@/components/cme/change-card"
;
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
{
Toast
}
from
"vant"
;
let
titleArray
=
[
""
,
""
,
"免费体验"
,
"错题集"
,
"收藏夹"
];
let
titleArray
=
[
""
,
""
,
"免费体验"
,
"错题集"
,
"收藏夹"
];
export
default
{
export
default
{
...
@@ -61,7 +62,7 @@ export default {
...
@@ -61,7 +62,7 @@ export default {
cardType
:
3
,
cardType
:
3
,
goodsType
:
3
,
goodsType
:
3
,
currentTitle
:
"试题集"
,
currentTitle
:
"试题集"
,
dataType
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
experienceDialog
:
false
,
// 体验结束弹框
experienceDialog
:
false
,
// 体验结束弹框
showChangeCard
:
false
,
//是否展示激活弹框,
showChangeCard
:
false
,
//是否展示激活弹框,
changeCardErrorMsg
:
""
,
changeCardErrorMsg
:
""
,
...
@@ -78,30 +79,85 @@ export default {
...
@@ -78,30 +79,85 @@ export default {
id
:
0
id
:
0
},
},
queryParams
:
{
queryParams
:
{
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
commitKind
:
3
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
0
,
// 题库ID,获取错题集或收藏时传0
directoryId
:
1748
,
// 题库ID,获取错题集或收藏时传0
pageFlag
:
0
,
// 翻页标记:0往前翻页 1往后翻页
pageFlag
:
0
,
// 翻页标记:0往前翻页 1往后翻页
pageSize
:
10
,
// 每页大小
pageSize
:
5
,
// 每页大小
secondSubjectId
:
0
,
// 二级学科分类ID:用于判断学科下目录免费题数
secondSubjectId
:
106
,
// 二级学科分类ID:用于判断学科下目录免费题数
titleNo
:
0
,
// 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
titleNo
:
0
,
// 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
}
}
}
}
},
},
watch
:
{
// 实时获取前、后数据
"currentQuestion.titleNo"
:
{
handler
(
titleNo
)
{
console
.
log
(
'in watch currentQuestion.titleNo'
,
titleNo
);
if
(
this
.
queryParams
.
pageSize
<=
3
)
{
Toast
(
"分页个数不能小于等于3"
);
return
;
}
let
qIndex
=
this
.
questionList
.
findIndex
(
(
item
,
index
)
=>
{
return
item
.
titleNo
==
titleNo
;
});
// 向前翻页
if
(
qIndex
==
1
&&
titleNo
>
2
)
{
this
.
queryParams
.
pageFlag
=
0
;
this
.
queryParams
.
titleNo
=
this
.
questionList
[
0
].
titleNo
;
// this.$store.dispatch('getQuestionList', this.queryParams);
console
.
log
(
'this.queryParams'
,
this
.
queryParams
);
return
;
}
let
lastIndex
=
this
.
questionList
.
length
-
1
;
console
.
log
(
qIndex
,
lastIndex
,
qIndex
==
lastIndex
);
if
(
qIndex
==
lastIndex
&&
(
titleNo
+
1
)
!=
this
.
totalCount
)
{
this
.
queryParams
.
pageFlag
=
1
;
this
.
queryParams
.
titleNo
=
this
.
questionList
[
lastIndex
].
titleNo
;
// this.$store.dispatch('getQuestionList', this.queryParams);
console
.
log
(
'this.queryParams'
,
this
.
queryParams
);
return
;
}
},
// deep: true,
},
// currentQuestion: {
// handler(question) {
// console.log('in currentQuestion', question);
// let qIndex = this.questionList.findIndex( (item, index) => {
// return item.titleNo == question.titleNo;
// });
// this.$store.commit("SET_CURRENT_QUESTION", question);
// this.questionList.splice(qIndex, 1, question);
// this.$store.commit("SET_QUESTION_LIST", this.questionList);
// this.$forceUpdate();
// },
// deep: true,
// immediate: true,
// },
// questionList: {
// handler(questionList) {
// this.$store.commit("SET_QUESTION_LIST", questionList);
// },
// deep: true,
// immediate: true,
// }
},
computed
:
{
computed
:
{
...
mapGetters
([
'questionList'
,
'currentQuestion'
,
'
currentQuestionIndex'
,
'totalCount
'
]),
...
mapGetters
([
'questionList'
,
'currentQuestion'
,
'
totalCount'
,
'titleConfig
'
]),
needFixed
()
{
needFixed
()
{
return
this
.
experienceDialog
||
this
.
showChangeCard
||
this
.
showBindCardTips
;
return
this
.
experienceDialog
||
this
.
showChangeCard
||
this
.
showBindCardTips
;
},
},
},
},
created
()
{
created
()
{
let
_this
=
this
;
let
_this
=
this
;
this
.
directoryId
=
this
.
$route
.
query
.
directoryId
||
1
;
this
.
directoryId
=
this
.
$route
.
query
.
directoryId
||
1
;
// 题库ID,获取错题集或收藏时传0
this
.
commitKind
=
this
.
$route
.
query
.
commitKind
||
1
;
this
.
secondSubjectId
=
this
.
$route
.
query
.
secondSubjectId
||
1
;
// 学科id
this
.
cardType
=
this
.
$route
.
query
.
cardType
||
3
;
this
.
cardType
=
this
.
$route
.
query
.
cardType
||
3
;
// 卡类型
this
.
goodsType
=
this
.
$route
.
query
.
goodsType
||
3
;
this
.
goodsType
=
this
.
$route
.
query
.
goodsType
||
3
;
// 商品类型
this
.
dataType
=
this
.
$route
.
query
.
dataType
||
1
;
this
.
commitKind
=
this
.
$route
.
query
.
commitKind
||
1
;
// 答题来源 1:错题集 2:收藏 3:题库
this
.
freeFlag
=
this
.
$route
.
query
.
freeFlag
||
0
;
// 0: 免费; 1: 收费;
this
.
freeFlag
=
this
.
$route
.
query
.
freeFlag
||
0
;
// 0: 免费; 1: 收费;
this
.
currentTitle
=
this
.
$route
.
query
.
currentTitle
||
this
.
currentTitle
;
this
.
currentTitle
=
this
.
$route
.
query
.
currentTitle
||
this
.
currentTitle
;
// 顶部导航文案
this
.
init
();
this
.
init
();
window
.
__getUserInfoForQD
=
function
(
param
)
{
window
.
__getUserInfoForQD
=
function
(
param
)
{
...
@@ -111,7 +167,7 @@ export default {
...
@@ -111,7 +167,7 @@ export default {
// _this.checkToken();
// _this.checkToken();
};
};
if
(
__isWeb
)
{
if
(
__isWeb
)
{
_this
.
getQuestionList
();
_this
.
getQuestionList
(
this
.
queryParams
);
}
else
{
}
else
{
_this
.
getUserInfo
();
_this
.
getUserInfo
();
}
}
...
@@ -132,12 +188,34 @@ export default {
...
@@ -132,12 +188,34 @@ export default {
methods
:
{
methods
:
{
...
mapActions
([
"setUserInfo"
,
"getQuestionList"
]),
...
mapActions
([
"setUserInfo"
,
"getQuestionList"
]),
init
()
{
init
()
{
if
(
this
.
dataType
>=
2
&&
this
.
dataType
<=
4
)
{
if
(
this
.
commitKind
>=
2
&&
this
.
commitKind
<=
4
)
{
this
.
currentTitle
=
titleArray
[
this
.
dataType
];
this
.
currentTitle
=
titleArray
[
this
.
commitKind
];
}
}
this
.
$store
.
commit
(
'SET_COMMON_CONIFG'
,
{
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag
:
this
.
freeFlag
,
directoryId
:
this
.
directoryId
,
secondSubjectId
:
this
.
secondSubjectId
,
cardType
:
this
.
cardType
,
goodsType
:
this
.
goodsType
,
commitKind
:
this
.
commitKind
,
// 答题来源 1:错题集 2:收藏 3:题库
});
this
.
getUserInfo
();
this
.
getPractiseTitles
(
this
.
queryParams
);
// this.preJumper();
// this.preJumper();
},
},
// 统计当前信息
statistics
()
{
let
correctNum
=
0
,
errNum
=
0
,
rate
=
0
;
this
.
questionList
.
forEach
(
item
=>
{
if
(
item
.
commitKind
)
{
}
});
this
.
experienceDialog
=
true
;
},
//获取用户信息
//获取用户信息
getUserInfo
()
{
getUserInfo
()
{
rocNative
.
getUserInfo
({
rocNative
.
getUserInfo
({
...
@@ -231,10 +309,11 @@ export default {
...
@@ -231,10 +309,11 @@ export default {
getPractiseTitles
(
params
)
{
getPractiseTitles
(
params
)
{
let
param
=
{
let
param
=
{
...
params
,
...
params
,
setEntry
:
true
// token: '998E10CD98ED4BCF91A28223270FE8CE',
// setEntry: true
};
};
this
.
GET
(
`portal/titleTest/practise/titles`
,
param
).
then
(({
data
})
=>
{
this
.
GET
(
`portal/titleTest/practise/titles`
,
param
).
then
(({
data
})
=>
{
console
.
log
(
data
);
});
});
},
},
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录