Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-annual-summary
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.education.frontend
pica-annual-summary
提交
3811d671
提交
3811d671
编写于
9月 26, 2020
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
差异文件
题库做题页开发
上级
6cb951c7
064aaab4
变更
8
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
911 行增加
和
301 行删除
+911
-301
question-content.vue
src/components/question/question-content.vue
+5
-18
question-footer.vue
src/components/question/question-footer.vue
+29
-10
question copy 2.js
src/store/modules/question copy 2.js
+135
-0
question copy.js
src/store/modules/question copy.js
+326
-0
question.js
src/store/modules/question.js
+41
-199
index.js
src/utils/index.js
+40
-7
question-bank.vue
src/views/question-bank.vue
+286
-0
question-detail.vue
src/views/question-detail.vue
+49
-67
未找到文件。
src/components/question/question-content.vue
浏览文件 @
3811d671
...
...
@@ -65,7 +65,7 @@
<van-button
size=
"large"
round
color=
"#449284"
>
确 认
</van-button>
</article>
<article
class=
"answer-wrapper"
v-show=
"currentQuestion.isAnalyzed || currentQuestion.commitFlag"
>
<span
class=
"content"
>
正确答案:
D
</span>
<span
class=
"content"
>
正确答案:
{{currentQuestion.answer}}
</span>
</article>
<article
class=
"analysis-wrapper"
v-show=
"currentQuestion.isAnalyzed"
>
<span
class=
"title"
>
解析
</span>
...
...
@@ -76,22 +76,8 @@
<
script
>
import
commonSpliteLine
from
"@/components/common/common-splite-line"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
let
orderVac
=
[
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
];
import
{
getOrderText
}
from
"@/utils"
;
export
default
{
components
:
{
commonSpliteLine
...
...
@@ -119,8 +105,9 @@ export default {
},
methods
:
{
getOrderVac
(
index
)
{
return
orderVac
[
index
]
;
return
getOrderText
(
index
)
;
},
// 选择选项
selectOption
(
index
)
{
if
(
this
.
currentQuestion
.
commitFlag
)
return
;
...
...
src/components/question/question-footer.vue
浏览文件 @
3811d671
...
...
@@ -18,17 +18,26 @@
<
script
>
import
{
Toast
}
from
"vant"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
import
{
findQuestionIndexNo
}
from
"@/utils"
;
export
default
{
props
:
{},
data
()
{
return
{
queryParams
:
{
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
0
,
// 题库ID,获取错题集或收藏时传0
// commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
// directoryId: 0, // 题库ID,获取错题集或收藏时传0
// pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
// pageSize: 10, // 每页大小
// secondSubjectId: 0, // 二级学科分类ID:用于判断学科下目录免费题数
// titleNo: 0, // 起始或结束题目序号,首次进入页面时传0,系统自动定位到上次做的题
commitKind
:
3
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
1748
,
// 题库ID,获取错题集或收藏时传0
pageFlag
:
0
,
// 翻页标记:0往前翻页 1往后翻页
pageSize
:
10
,
// 每页大小
secondSubjectId
:
0
,
// 二级学科分类ID:用于判断学科下目录免费题数
titleNo
:
0
,
// 起始或结束题目
序号
,首次进入页面时传0,系统自动定位到上次做的题
pageSize
:
5
,
// 每页大小
secondSubjectId
:
106
,
// 二级学科分类ID:用于判断学科下目录免费题数
titleNo
:
0
,
// 起始或结束题目
ID
,首次进入页面时传0,系统自动定位到上次做的题
}
};
...
...
@@ -46,13 +55,18 @@ export default {
// 上一页 // 有可能要触发上分页(前端的个数只有一条)
// TODO
previous
()
{
// debugger
if
(
this
.
currentQuestion
.
titleNo
==
1
)
{
Toast
(
"已是第一题"
);
}
else
{
let
cIndex
=
findQuestionIndexNo
(
this
.
questionList
,
"titleNo"
,
this
.
currentQuestion
.
titleNo
);
this
.
$store
.
commit
(
"SET_CURRENT_QUESTION"
,
this
.
questionList
[
this
.
currentQuestion
.
titleNo
-
2
]
||
{
answerList
:
[]
}
this
.
questionList
[
cIndex
-
1
]
||
{
answerList
:
[]
}
);
if
(
cIndex
==
1
&&
this
.
currentQuestion
.
titleNo
>
2
)
{
this
.
$emit
(
"pageQuestion"
,
0
,
this
.
questionList
[
0
].
titleNo
);
}
}
},
...
...
@@ -64,10 +78,15 @@ export default {
// Toast("已是最后一题");
this
.
$emit
(
"statistics"
);
}
else
{
let
cIndex
=
findQuestionIndexNo
(
this
.
questionList
,
'titleNo'
,
this
.
currentQuestion
.
titleNo
);
this
.
$store
.
commit
(
"SET_CURRENT_QUESTION"
,
this
.
questionList
[
this
.
currentQuestion
.
titleNo
]
||
{
answerList
:
[]
}
this
.
questionList
[
cIndex
+
1
]
||
{
answerList
:
[]
}
);
if
((
cIndex
==
this
.
questionList
.
length
-
2
)
&&
(
this
.
questionList
.
length
<
this
.
totalCount
))
{
this
.
$emit
(
"pageQuestion"
,
1
,
this
.
questionList
[
this
.
questionList
.
length
-
1
].
titleNo
);
}
}
},
...
...
@@ -85,12 +104,11 @@ export default {
// 收藏/取消收藏
favor
(
currentQuestion
)
{
this
.
currentQuestion
.
favorFlag
=
this
.
currentQuestion
.
favorFlag
==
0
?
1
:
0
;
let
favorFlag
=
currentQuestion
.
favorFlag
;
let
param
=
{
commitKind
:
this
.
commitKind
,
dataType
:
2
,
directoryId
:
currentQuestion
.
directoryId
,
examTitleId
:
currentQuestion
.
examT
itleId
,
examTitleId
:
currentQuestion
.
t
itleId
,
operateType
:
favorFlag
==
1
?
2
:
1
,
// 操作类型:1:收藏 2:取消收藏
paperId
:
currentQuestion
.
paperId
,
paperIndex
:
currentQuestion
.
paperIndex
,
...
...
@@ -98,6 +116,7 @@ export default {
setEntry
:
true
// userId: 0
};
this
.
currentQuestion
.
favorFlag
=
this
.
currentQuestion
.
favorFlag
==
0
?
1
:
0
;
this
.
POST
(
"onlineexam/collectExamTitle"
,
param
).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
if
(
res
.
data
)
{
...
...
src/store/modules/question copy 2.js
0 → 100644
浏览文件 @
3811d671
// import fetch from '@/utils/fetch';
// import { getBaseUrl } from '@/utils/index'
// import { setCookie, getCookie, delCookie } from '@/utils/index';
// import { envConfig } from '@/utils/env-config';
import
{
findQuestionIndexNo
}
from
"@/utils"
;
const
question
=
{
state
:
{
currentTitle
:
"题库"
,
questionList
:
[],
currentQuestion
:
{
isAnalyzed
:
false
,
options
:
[
// 从options加工出来
{
isCorrect
:
false
,
isSelected
:
true
,
text
:
"进行分析评估"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估"
,
},
{
isCorrect
:
true
,
isSelected
:
true
,
text
:
"进行分析评估"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估"
,
},
],
titleId
:
1
,
titleNo
:
1
,
// 题序,从1开始
typeId
:
1
,
// 题目类型ID 1-单选,2-多选,3-判断
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
unionQuestion
:
""
,
// 共用题干
question
:
'题干内容<img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" />'
,
// 题干内容
config
:
""
,
// 选项
answer
:
""
,
// 正确答案
intro
:
""
,
// 题目解析
score
:
0
,
// 题目分值
myAnswer
:
""
,
// 我的答案
commitFlag
:
0
,
// 0还未做 1做对了 2做错了
favorFlag
:
0
,
// 0未收藏 1已收藏
pictureFlag
:
""
,
// 0没有图 1有图
questionStreamType
:
""
,
// 题干内流媒体类型:0-文本,1-图片,2-视频,3-音频
directoryId
:
0
,
// 题库ID
paperId
:
""
,
// 试卷ID
paperIndex
:
""
,
// 试卷索引
},
commonConfig
:
{
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag
:
0
,
directoryId
:
""
,
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
:
{
SET_COMMON_CONIFG
:
(
state
,
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
)
=>
{
state
.
titleConfig
.
freeFlag
=
payload
;
},
SET_TOTAL_COUNT
:
(
state
,
payload
)
=>
{
state
.
titleConfig
.
totalCount
=
payload
;
},
SET_QUESTION_LIST
:
(
state
,
payload
)
=>
{
state
.
questionList
=
payload
;
},
SET_CURRENT_QUESTION
:
(
state
,
payload
)
=>
{
state
.
currentQuestion
=
payload
;
},
},
actions
:
{
// 处理返回的数据
handlerQuestionList
({
commit
,
state
},
rezultData
)
{
// debugger
let
questionList
=
rezultData
.
practiseTitleModelList
;
let
handlerList
=
[],
question
,
option
,
optionList
=
[],
myAnswer
=
""
,
answer
=
""
;
questionList
.
forEach
(
(
item
,
index
)
=>
{
question
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
question
.
isAnalyzed
=
false
;
option
=
{};
optionList
=
[];
question
.
options
.
forEach
(
(
text
,
i
)
=>
{
option
.
isCorrect
=
false
;
option
.
isSelected
=
false
;
option
.
text
=
text
;
optionList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
option
)));
});
question
.
options
=
optionList
;
console
.
log
(
'handlerList'
,
index
);
handlerList
.
push
(
question
);
});
console
.
log
(
'in handlerList'
,
handlerList
);
let
cIndex
=
findQuestionIndexNo
(
handlerList
,
'titleNo'
,
rezultData
.
currentTitleNo
||
1
);
commit
(
"SET_CURRENT_QUESTION"
,
handlerList
[
cIndex
]);
commit
(
"SET_QUESTION_LIST"
,
handlerList
);
let
titleConfig
=
{
bindStatus
:
rezultData
.
bindStatus
,
// 绑卡状态:0未绑卡 1已绑卡
commitKind
:
rezultData
.
commitKind
,
// 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo
:
rezultData
.
currentTitleNo
,
// 定位答题题目id
resultId
:
rezultData
.
resultId
,
// 刷题库轮次ID
totalCount
:
rezultData
.
totalCount
,
// 题目总数
}
commit
(
"SET_TITLE_CONIFG"
,
titleConfig
);
},
},
}
export
default
question
;
src/store/modules/question copy.js
0 → 100644
浏览文件 @
3811d671
此差异已折叠。
点击以展开。
src/store/modules/question.js
浏览文件 @
3811d671
...
...
@@ -2,6 +2,7 @@
// import { getBaseUrl } from '@/utils/index'
// import { setCookie, getCookie, delCookie } from '@/utils/index';
// import { envConfig } from '@/utils/env-config';
import
{
findQuestionIndexNo
,
getOrderText
}
from
"@/utils"
;
const
question
=
{
state
:
{
...
...
@@ -92,208 +93,49 @@ const question = {
},
},
actions
:
{
// 获取用户信息
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
);
let
currentList
=
[
{
isAnalyzed
:
false
,
options
:
[
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估"
,
},
{
isCorrect
:
true
,
isSelected
:
false
,
text
:
"进行分析评估"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估"
,
},
],
titleId
:
1
,
titleNo
:
1
,
// 题序,从1开始
typeId
:
1
,
// 题目类型ID 1-单选,2-多选,3-判断
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
0
,
// 0普通题型 1-共用题干; 2-共用选项
unionQuestion
:
""
,
// 共用题干
question
:
"题干内容"
,
// 题干内容
config
:
""
,
// 选项
answer
:
""
,
// 正确答案
intro
:
""
,
// 题目解析
score
:
0
,
// 题目分值
myAnswer
:
""
,
// 我的答案
commitFlag
:
0
,
// 0还未做 1做对了 2做错了
favorFlag
:
0
,
// 0未收藏 1已收藏
pictureFlag
:
""
,
// 0没有图 1有图
questionStreamType
:
""
,
// 题干内流媒体类型:0-文本,1-图片,2-视频,3-音频
directoryId
:
0
,
// 题库ID
paperId
:
""
,
// 试卷ID
paperIndex
:
""
,
// 试卷索引
},
{
isAnalyzed
:
false
,
options
:
[
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估2"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估2"
,
},
{
isCorrect
:
true
,
isSelected
:
false
,
text
:
"进行分析评估2"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评3"
,
},
],
titleId
:
2
,
titleNo
:
2
,
// 题序,从1开始
typeId
:
1
,
// 题目类型ID 1-单选,2-多选,3-判断
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
2
,
// 0普通题型 1-共用题干; 2-共用选项
unionQuestion
:
""
,
// 共用题干
question
:
"题干内容"
,
// 题干内容
config
:
""
,
// 选项
answer
:
""
,
// 正确答案
intro
:
""
,
// 题目解析
score
:
0
,
// 题目分值
myAnswer
:
""
,
// 我的答案
commitFlag
:
0
,
// 0还未做 1做对了 2做错了
favorFlag
:
0
,
// 0未收藏 1已收藏
pictureFlag
:
""
,
// 0没有图 1有图
questionStreamType
:
""
,
// 题干内流媒体类型:0-文本,1-图片,2-视频,3-音频
directoryId
:
0
,
// 题库ID
paperId
:
""
,
// 试卷ID
paperIndex
:
""
,
// 试卷索引
},
{
isAnalyzed
:
false
,
options
:
[
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估3"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估3"
,
},
{
isCorrect
:
true
,
isSelected
:
false
,
text
:
"进行分析评估3"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估3"
,
},
],
question
:
"题干内容"
,
// 题干内容
titleId
:
3
,
//
titleNo
:
3
,
// 题序,从1开始
typeId
:
1
,
// 题目类型ID 1-单选,2-多选,3-判断
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
unionQuestion
:
""
,
// 共用题干
question
:
"题干内容"
,
// 题干内容
config
:
""
,
// 选项
answer
:
""
,
// 正确答案
intro
:
""
,
// 题目解析
score
:
0
,
// 题目分值
myAnswer
:
""
,
// 我的答案
commitFlag
:
0
,
// 0还未做 1做对了 2做错了
favorFlag
:
0
,
// 0未收藏 1已收藏
pictureFlag
:
""
,
// 0没有图 1有图
questionStreamType
:
""
,
// 题干内流媒体类型:0-文本,1-图片,2-视频,3-音频
directoryId
:
0
,
// 题库ID
paperId
:
""
,
// 试卷ID
paperIndex
:
""
,
// 试卷索引
},
{
isAnalyzed
:
false
,
options
:
[
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估4"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估4"
,
},
{
isCorrect
:
true
,
isSelected
:
false
,
text
:
"进行分析评估4"
,
},
{
isCorrect
:
false
,
isSelected
:
false
,
text
:
"进行分析评估4"
,
},
],
titleId
:
4
,
titleNo
:
4
,
// 题序,从1开始
typeId
:
2
,
// 题目类型ID 1-单选,2-多选,3-判断
unionId
:
""
,
// 联合类型题目,分组唯一标识
unionType
:
1
,
// 0普通题型 1-共用题干; 2-共用选项
unionQuestion
:
""
,
// 共用题干
question
:
"题干内容"
,
// 题干内容
config
:
""
,
// 选项
answer
:
""
,
// 正确答案
intro
:
""
,
// 题目解析
score
:
0
,
// 题目分值
myAnswer
:
""
,
// 我的答案
commitFlag
:
0
,
// 0还未做 1做对了 2做错了
favorFlag
:
0
,
// 0未收藏 1已收藏
pictureFlag
:
""
,
// 0没有图 1有图
questionStreamType
:
""
,
// 题干内流媒体类型:0-文本,1-图片,2-视频,3-音频
directoryId
:
0
,
// 题库ID
paperId
:
""
,
// 试卷ID
paperIndex
:
""
,
// 试卷索引
},
];
commit
(
'SET_QUESTION_LIST'
,
currentList
);
// commit('SET_CURRENT_QUESTION', currentList[0] || {options:[]});
commit
(
'SET_TOTAL_COUNT'
,
30
);
// 处理返回的数据
handlerQuestionList
({
commit
,
state
},
rezultData
)
{
// debugger
let
questionList
=
rezultData
.
practiseTitleModelList
;
let
handlerList
=
[],
question
,
option
,
optionList
=
[],
myAnswer
=
""
,
answer
=
""
;
questionList
.
forEach
(
(
item
,
index
)
=>
{
myAnswer
=
item
.
myAnswer
;
answer
=
item
.
answer
;
question
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
question
.
isAnalyzed
=
false
;
option
=
{};
optionList
=
[];
question
.
options
.
forEach
(
(
text
,
i
)
=>
{
option
.
isCorrect
=
answer
.
indexOf
(
getOrderText
(
i
))
!=
-
1
;
if
(
myAnswer
.
indexOf
(
getOrderText
(
i
))
!=
-
1
)
{
option
.
isSelected
=
true
;
}
else
{
option
.
isSelected
=
false
;
}
option
.
text
=
text
;
optionList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
option
)));
});
question
.
options
=
optionList
;
console
.
log
(
'handlerList'
,
index
);
handlerList
.
push
(
question
);
});
console
.
log
(
'in handlerList'
,
handlerList
);
let
cIndex
=
findQuestionIndexNo
(
handlerList
,
'titleNo'
,
rezultData
.
currentTitleNo
||
1
);
commit
(
"SET_CURRENT_QUESTION"
,
handlerList
[
cIndex
]);
commit
(
"SET_QUESTION_LIST"
,
handlerList
);
let
titleConfig
=
{
bindStatus
:
rezultData
.
bindStatus
,
// 绑卡状态:0未绑卡 1已绑卡
commitKind
:
rezultData
.
commitKind
,
// 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo
:
rezultData
.
currentTitleNo
,
// 定位答题题目id
resultId
:
rezultData
.
resultId
,
// 刷题库轮次ID
totalCount
:
rezultData
.
totalCount
,
// 题目总数
}
commit
(
"SET_TITLE_CONIFG"
,
titleConfig
);
},
needFecth
()
{
let
qIndex
=
this
.
questionList
.
findIndex
(
(
item
,
index
)
=>
{
})
}
},
}
...
...
src/utils/index.js
浏览文件 @
3811d671
/**
* Created by Anndy Yang on 19/02/28.
*/
let
orderVac
=
[
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
];
import
{
envConfig
}
from
'@/utils/env-config'
const
{
BUILD_ENV
}
=
process
.
env
;
// 获取SC服务器域名地址
export
function
getBaseUrl
(
url
)
{
return
getConfigByEnvType
(
'baseUrl'
)
+
url
...
...
@@ -250,14 +271,14 @@ export const getCookie = key => {
};
export
function
debounce
(
fn
,
wait
=
50
)
{
let
timer
;
return
function
()
{
if
(
timer
)
clearTimeout
(
timer
)
let
timer
;
return
function
()
{
if
(
timer
)
clearTimeout
(
timer
)
timer
=
setTimeout
(()
=>
{
fn
.
apply
(
this
,
arguments
);
fn
.
apply
(
this
,
arguments
);
timer
=
null
;
},
wait
)
}
},
wait
)
}
}
function
decode
(
input
)
{
...
...
@@ -275,3 +296,15 @@ export function querystring(query) {
return
result
;
}
export
function
getOrderText
(
index
)
{
return
orderVac
[
index
];
}
export
function
findQuestionIndexNo
(
oList
,
key
,
keyValue
)
{
let
index
=
oList
.
findIndex
(
item
=>
{
return
item
[
key
]
==
keyValue
;
});
return
index
;
}
src/views/question-bank.vue
浏览文件 @
3811d671
<
template
>
<div
class=
"question-bank-wrap"
>
<CommonNavbar
:bgColor=
"bgColor"
v-show=
"isShowNavbar"
:title=
"navTitle"
:isFixNavbar=
"isFixNavbar"
borderStyle=
"1px solid #fff"
></CommonNavbar>
<div
class=
"question-bank-content"
>
<div
class=
"header-info"
>
<div
class=
"info-first"
>
<img
src=
"../images/question/portrait.png"
>
<div
class=
"infor"
>
<p
class=
"name"
>
医生
</p>
<p
class=
"question-result"
>
已做题
<span>
0
</span>
错误题
<span
class=
"err"
>
0
</span>
正确率
<span
class=
"suc"
>
0%
</span></p>
</div>
</div>
<div
class=
"info-second"
>
<div
class=
"item"
><img
src=
"../images/question/text.png"
>
错题集
<span>
(80)
</span></div>
<div
class=
"item"
><img
src=
"../images/question/heart-h.png"
>
收藏
<span>
(5)
</span></div>
</div>
</div>
<div
class=
"question-intro"
>
<p>
你发我耳环佛为放假哦还文化佛为金佛还温恩覅偶尔为九佛我IE花覅偶平稳破郭伟鹏狂派舞恶徒提交奇偶文化宫呢
</p>
</div>
<div
class=
"course-list"
>
<p
class=
"title"
><span
class=
"line"
></span>
考点
</p>
<div
class=
"course-item"
>
<div
class=
"left-c"
>
<p
class=
"title-c"
>
第一篇 基础知识
</p>
<p
class=
"join-c"
>
234人已参与
</p>
</div>
<div
class=
"right-btn"
><span>
免费练习
</span></div>
</div>
<div
class=
"course-item"
>
<div
class=
"left-c"
>
<p
class=
"title-c"
>
第二篇 相关专业知识
</p>
<p
class=
"join-c"
>
234人已参与
</p>
<!--
<div
class=
"progress-course"
>
<div
class=
"progress-w"
><van-progress
:percentage=
"50"
:stroke-width=
"6"
color=
"#449284"
:show-pivot=
"false"
/></div>
<span
class=
"mg-set"
>
50%
</span><span>
共50道
</span>
</div>
-->
</div>
<div
class=
"right-btn"
>
<!--
<span>
免费练习
</span>
-->
<img
src=
"../images/question/lock.png"
>
</div>
</div>
</div>
</div>
<BindCardButton
:cardInfo=
"cardInfo"
@
changeClick=
"changeClick"
@
gotoBuy=
"confirm"
></BindCardButton>
<!--
<ChangeCard
:changeErrorMsg=
"changeCardErrorMsg"
:isShow=
"showChangeCard"
@
cancle=
"cancleChangeCard"
@
confirm=
"changeCardAction"
>
</ChangeCard>
-->
</div>
</
template
>
<
script
>
import
CommonNavbar
from
"@/components/common/common-navbar"
;
import
BindCardButton
from
"@/components/cme/bind-card-button"
;
import
ChangeCard
from
"@/components/cme/change-card"
;
import
{
Progress
}
from
'vant'
;
export
default
{
components
:
{
CommonNavbar
,
BindCardButton
,
ChangeCard
,
Progress
},
data
()
{
return
{
token
:
''
,
bgColor
:
"#fff"
,
isShowNavbar
:
true
,
navTitle
:
'中级-内科'
,
isFixNavbar
:
true
,
firstSubjectId
:
66
,
cardInfo
:
{
id
:
0
},
}
},
mounted
()
{
this
.
initData
();
},
methods
:
{
initData
()
{
let
param
=
{
token
:
this
.
token
,
setEntry
:
true
};
this
.
GET
(
`portal/titleTest/user/getBrushTitleInfo/
${
this
.
firstSubjectId
}
`
,
param
).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
}
else
{
this
.
$toast
(
res
.
message
);
}
});
},
changeClick
()
{
},
confirm
()
{},
},
}
</
script
>
<
style
lang=
"less"
scoped
>
.question-bank-wrap{
background-color: #FFFFFF;
width: 100%;
padding-bottom: 30px;
box-sizing: border-box;
.question-bank-content{
padding: 0 16px;
box-sizing: border-box;
.header-info{
.info-first{
display: flex;
padding: 20px 0;
img{
width: 44px;
height: 44px;
border-radius: 50%;
}
.infor{
margin-left: 12px;
.name{
color: #373839;
font-size: 18px;
font-weight: 700;
line-height: 22px;
}
.question-result{
font-size: 14px;
color: #676869;
line-height: 16px;
margin-top: 9px;
span{
margin-left: 3px;
margin-right: 15px;
color: #373839;
&.err{
color: #ED3131;
}
&.suc{
color: #449284;
}
}
}
}
}
.info-second{
display: flex;
justify-content: space-between;
align-items: center;
.item{
width: 165.5px;
height: 40px;
line-height: 40px;
text-align: center;
border-radius: 6px;
background-color: #F8F9FA;
font-size: 14px;
font-weight: 700;
color: #373839;
display: flex;
align-items: center;
justify-content: center;
img{
width: 20px;
height: 20px;
margin-right: 8px;
}
span{
font-size: 12px;
margin-left: 2px;
}
}
}
}
.question-intro{
margin-top: 15px;
background-color: #FFFFFF;
box-sizing: border-box;
box-shadow: 0 1px 12px 0 rgba(0, 0, 0, 0.05);
border-radius: 12px;
padding: 12px 0;
img{
width: 100%;
}
p{
color: #676869;
font-size: 12px;
line-height: 18px;
padding: 0 12px;
/*&:first-child{
margin-top: 12px;
}*/
}
}
.course-list{
margin-top: 30px;
.title{
font-size: 18px;
line-height: 22px;
color: #373839;
.line{
display: inline-block;
width: 3px;
height: 15px;
background-color: #F68367;
border-radius: 1.5px;
margin-right: 8px;
margin-bottom: -1px;
}
}
.course-item{
padding: 20px 0;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #E7E8E9;
.left-c{
/*flex: 1;*/
width: 230px;
.title-c{
font-size: 15px;
color: #333333;
font-weight: 700;
line-height: 22px;
}
.join-c{
font-size: 12px;
color: #979899;
line-height: 14px;
margin-top: 7px;
}
.progress-course{
margin-top: 8px;
font-size: 12px;
color: #979899;
display: flex;
align-items: center;
.progress-w{
width: 100px;
}
.mg-set{
margin-left: 6px;
margin-right: 10px;
}
}
}
.right-btn{
display: flex;
align-items: center;
span{
display: inline-block;
height: 25px;
line-height: 23px;
padding: 0 6px;
color: #449284;
border: 1px solid #449284;
border-radius: 15px;
font-size: 12px;
font-weight: 700;
box-sizing: border-box;
}
img{
width: 15px;
height: 15px;
margin-right: 22.5px;
}
}
}
}
}
}
</
style
>
src/views/question-detail.vue
浏览文件 @
3811d671
<
template
>
<section
class=
"question-detail-wrapper"
:style=
"
{'position': needFixed ? 'fixed': 'static'}">
<question-header
:title=
"currentTitle"
:order=
"currentQuestion.titleNo"
:total=
"totalCount"
></question-header>
<question-header
:title=
"currentTitle"
:order=
"currentQuestion.titleNo"
:total=
"t
itleConfig.t
otalCount"
></question-header>
<article
class=
"body"
>
<question-content
v-show=
"questionList.length"
></question-content>
<no-content
v-show=
"!questionList.length"
:listType=
"commitKind"
></no-content>
</article>
<!--
<free-tips
></free-tips>
-->
<question-footer
@
statistics=
"statistics"
></question-footer>
<question-footer
@
statistics=
"statistics"
@
pageQuestion=
"pageQuestion"
></question-footer>
<ExperienceDialog
:showDialog=
"experienceDialog"
@
activeCard=
"activeCard"
@
buyCard=
"buyCard"
@
close=
"experienceDialog = false"
></ExperienceDialog>
<!-- 去激活 -->
...
...
@@ -42,6 +42,7 @@ import ChangeCard from "@/components/cme/change-card";
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
{
Toast
}
from
"vant"
;
import
{
findQuestionIndexNo
}
from
"@/utils"
;
let
titleArray
=
[
""
,
""
,
"免费体验"
,
"错题集"
,
"收藏夹"
];
export
default
{
...
...
@@ -88,60 +89,6 @@ export default {
}
}
},
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
:
{
...
mapGetters
([
'questionList'
,
'currentQuestion'
,
'totalCount'
,
'titleConfig'
]),
needFixed
()
{
...
...
@@ -163,11 +110,12 @@ export default {
window
.
__getUserInfoForQD
=
function
(
param
)
{
_this
.
token
=
param
.
userToken
;
_this
.
setUserInfo
(
param
);
_this
.
getQuestionList
();
this
.
getPractiseTitles
();
// _this.checkToken();
};
if
(
__isWeb
)
{
_this
.
getQuestionList
(
this
.
queryParams
);
this
.
getPractiseTitles
(
);
}
else
{
_this
.
getUserInfo
();
}
...
...
@@ -186,7 +134,7 @@ export default {
},
methods
:
{
...
mapActions
([
"setUserInfo"
,
"
get
QuestionList"
]),
...
mapActions
([
"setUserInfo"
,
"
handler
QuestionList"
]),
init
()
{
if
(
this
.
commitKind
>=
2
&&
this
.
commitKind
<=
4
)
{
this
.
currentTitle
=
titleArray
[
this
.
commitKind
];
...
...
@@ -201,10 +149,17 @@ export default {
commitKind
:
this
.
commitKind
,
// 答题来源 1:错题集 2:收藏 3:题库
});
this
.
getUserInfo
();
this
.
getPractiseTitles
(
this
.
queryParams
);
// this.getPractiseTitles(
);
// this.preJumper();
},
// 开始翻页
pageQuestion
(
pageFlag
,
titleNo
)
{
this
.
queryParams
.
pageFlag
=
pageFlag
;
this
.
queryParams
.
titleNo
=
titleNo
;
this
.
getPractiseTitles
();
},
// 统计当前信息
statistics
()
{
let
correctNum
=
0
,
errNum
=
0
,
rate
=
0
;
...
...
@@ -306,17 +261,44 @@ export default {
},
// 分页获取题目(前、后翻页)
getPractiseTitles
(
params
)
{
let
param
=
{
...
params
,
// token: '998E10CD98ED4BCF91A28223270FE8CE',
// setEntry: true
};
this
.
GET
(
`portal/titleTest/practise/titles`
,
param
).
then
(({
data
})
=>
{
getPractiseTitles
()
{
this
.
GET
(
`portal/titleTest/practise/titles`
,
this
.
queryParams
).
then
(({
data
})
=>
{
this
.
currentTitleNo
=
data
.
currentTitleNo
;
this
.
handlerQuestionList
(
data
);
// this.handlerPractiseData(data.practiseTitleModelList);
console
.
log
(
data
);
});
},
// 将序号转成字母
getOrderVac
(
index
)
{
return
getOrderText
(
index
);
},
// 处理返回的数据,并存储到store中
handlerPractiseData
(
questionList
)
{
let
handlerList
=
[],
question
,
option
,
optionList
=
[],
myAnswer
=
""
,
answer
=
""
;
questionList
.
forEach
(
(
item
,
index
)
=>
{
question
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
question
.
isAnalyzed
=
false
;
option
=
{};
optionList
=
[];
question
.
options
.
forEach
(
(
text
,
i
)
=>
{
option
.
isCorrect
=
false
;
option
.
isSelected
=
false
;
option
.
text
=
text
;
optionList
.
push
(
JSON
.
parse
(
JSON
.
stringify
(
option
)));
});
question
.
options
=
optionList
;
console
.
log
(
'handlerList'
,
index
);
handlerList
.
push
(
question
);
});
console
.
log
(
'in handlerList'
,
handlerList
);
let
cIndex
=
findQuestionIndexNo
(
handlerList
,
'titleNo'
,
this
.
currentTitleNo
);
this
.
$store
.
commit
(
"SET_CURRENT_QUESTION"
,
handlerList
[
cIndex
]);
this
.
$store
.
commit
(
"SET_QUESTION_LIST"
,
handlerList
);
},
// 激活Action 返回值:0绑定失败,1绑定成功
changeCardAction
(
cardKey
,
isInTips
)
{
let
_this
=
this
;
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录