Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-professional-exam
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Culm
pica-professional-exam
提交
b1bb00c8
提交
b1bb00c8
编写于
9月 27, 2020
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
对两个数组中的元素进行排序
上级
0e4967b2
变更
8
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
229 行增加
和
97 行删除
+229
-97
question-content.vue
src/components/question/question-content.vue
+39
-12
question-footer.vue
src/components/question/question-footer.vue
+1
-1
question copy.js
src/store/modules/question copy.js
+1
-1
question.js
src/store/modules/question.js
+9
-9
fetch.js
src/utils/fetch.js
+2
-2
index.js
src/utils/index.js
+26
-0
mixins.js
src/utils/mixins.js
+4
-2
question-detail.vue
src/views/question-detail.vue
+147
-70
未找到文件。
src/components/question/question-content.vue
浏览文件 @
b1bb00c8
...
...
@@ -25,7 +25,7 @@
</article>
<article
class=
"title-wrapper"
>
<span
class=
"type"
:class=
"
{'multi': currentQuestion.typeId == 2}">
<span>
{{
currentQuestion
.
typeId
==
1
?
"单选题"
:
"多选题"
}}
</span>
<span>
{{
currentQuestion
.
typeId
!=
2
?
"单选题"
:
"多选题"
}}
</span>
</span>
<span
class=
"content"
v-html=
"currentQuestion.question"
></span>
<!--
<img
src=
"https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png"
/>
-->
...
...
@@ -92,6 +92,8 @@ export default {
...
mapGetters
([
"questionList"
,
"currentQuestion"
,
"commonConfig"
,
"titleConfig"
])
},
data
()
{
...
...
@@ -124,7 +126,7 @@ export default {
myAnswer
=
myAnswer
.
split
(
''
).
join
(
','
);
this
.
currentQuestion
.
myAnswer
=
myAnswer
;
}
else
{
// 单选题直接设置commitFlag
// 单选题
或者判断题
直接设置commitFlag
if
(
this
.
currentQuestion
.
options
[
index
].
isCorrect
)
{
this
.
currentQuestion
.
commitFlag
=
1
;
}
else
{
...
...
@@ -136,18 +138,43 @@ export default {
this
.
$forceUpdate
();
console
.
log
(
"in commit"
,
this
.
currentQuestion
.
myAnswer
);
},
commitAnswer
()
{
// 提交答案
commitAnswer
(
isMulti
)
{
let
params
=
{
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
0
,
// 题库ID
myAnswer
:
this
.
currentQuestion
.
myAnswer
,
// 我的答案,单选时单个答案,如A;多选答案,按照顺序使用
paperId
:
1
,
// 试卷ID
paperIndex
:
1
,
// 试卷索引(随机试卷的第n套)
resultId
:
1
,
// 刷题库轮次ID,刷收藏和错题集时为0
rightFlag
:
1
,
// 答题对错:1对 2错
titleId
:
1
,
// 题目ID
commitKind
:
this
.
commonConfig
.
commitKind
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
this
.
currentQuestion
.
directoryId
,
// 题库ID
myAnswer
:
this
.
currentQuestion
.
myAnswer
,
// 我的答案,单选时单个答案,如A;多选答案,按照顺序使用
paperId
:
this
.
currentQuestion
.
paperId
,
// 试卷ID
paperIndex
:
this
.
currentQuestion
.
paperIndex
,
// 试卷索引(随机试卷的第n套)
resultId
:
this
.
titleConfig
.
resultId
,
// 刷题库轮次ID,刷收藏和错题集时为0
// rightFlag: 1, // 答题对错:1对 2错
titleId
:
this
.
currentQuestion
.
titleId
,
// 题目ID
titleNo
:
this
.
currentQuestion
.
titleNo
,
// 题目ID
};
this
.
currentQuestion
.
commitFlag
=
1
;
// 计算是否答对了题目(只有多选题,才做相应处理)
if
(
isMulti
)
{
let
cList
=
this
.
currentQuestion
,
option
=
{},
isRight
=
true
;
for
(
let
i
=
0
;
i
<
cList
.
length
;
i
++
)
{
option
=
cList
[
i
];
if
(
option
.
isCorrect
&&
!
option
.
isSelected
)
{
isRight
=
false
;
return
;
}
}
if
(
isRight
)
{
this
.
currentQuestion
.
commitFlag
=
1
;
}
else
{
this
.
currentQuestion
.
commitFlag
=
2
;
}
}
this
.
POST
(
`onlineexam/practise/commit`
,
params
).
then
(({
data
})
=>
{
// this.currentTitleNo = data.currentTitleNo;
// this.handlerQuestionList(data);
// this.handlerPractiseData(data.practiseTitleModelList);
console
.
log
(
"onlineexam/practise/commit"
,
data
);
});
}
}
};
...
...
src/components/question/question-footer.vue
浏览文件 @
b1bb00c8
...
...
@@ -112,7 +112,7 @@ export default {
operateType
:
favorFlag
==
1
?
2
:
1
,
// 操作类型:1:收藏 2:取消收藏
paperId
:
currentQuestion
.
paperId
,
paperIndex
:
currentQuestion
.
paperIndex
,
token
:
this
.
userInfo
.
userToken
||
this
.
token
||
'9
98E10CD98ED4BCF91A28223270FE8CE
'
,
token
:
this
.
userInfo
.
userToken
||
this
.
token
||
'9
3521BDB92774134B2CC18633F2B6D3A
'
,
setEntry
:
true
// userId: 0
};
...
...
src/store/modules/question copy.js
浏览文件 @
b1bb00c8
...
...
@@ -97,7 +97,7 @@ const question = {
// async getQuestionList({ commit, state }, params) {
// // let param = {
// // ...params,
// // token: '9
98E10CD98ED4BCF91A28223270FE8CE
',
// // token: '9
3521BDB92774134B2CC18633F2B6D3A
',
// // setEntry: true
// // };
// // this.GET(`portal/titleTest/practise/titles`, param).then(({ data }) => {
...
...
src/store/modules/question.js
浏览文件 @
b1bb00c8
...
...
@@ -2,7 +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"
;
import
{
findQuestionIndexNo
,
getOrderText
,
concatArray
}
from
"@/utils"
;
const
question
=
{
state
:
{
...
...
@@ -59,11 +59,11 @@ const question = {
secondSubjectId
:
0
,
cardType
:
3
,
goodsType
:
3
,
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
commitKind
:
3
,
// 答题来源 1:错题集 2:收藏 3:题库
},
titleConfig
:
{
bindStatus
:
0
,
// 绑卡状态:0未绑卡 1已绑卡
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
commitKind
:
3
,
// 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo
:
0
,
// 定位答题题目id
resultId
:
0
,
// 刷题库轮次ID
totalCount
:
0
,
// 题目总数
...
...
@@ -97,7 +97,7 @@ const question = {
// 处理返回的数据
handlerQuestionList
({
commit
,
state
},
rezultData
)
{
// debugger
let
questionList
=
rezultData
.
practiseTitleModelList
;
let
questionList
=
rezultData
.
practiseTitleModelList
||
[]
;
let
handlerList
=
[],
question
,
option
,
optionList
=
[],
myAnswer
=
""
,
answer
=
""
;
questionList
.
forEach
(
(
item
,
index
)
=>
{
...
...
@@ -123,16 +123,16 @@ const 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
newList
=
concatArray
(
state
.
questionList
,
handlerList
,
'titleNo'
);
let
titleConfig
=
{
bindStatus
:
rezultData
.
bindStatus
,
// 绑卡状态:0未绑卡 1已绑卡
commitKind
:
rezultData
.
commitKind
,
// 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo
:
rezultData
.
currentTitleNo
,
// 定位答题题目id
resultId
:
rezultData
.
resultId
,
// 刷题库轮次ID
currentTitleNo
:
rezultData
.
currentTitleNo
,
// 定位答题题目id
resultId
:
rezultData
.
resultId
,
// 刷题库轮次ID
totalCount
:
rezultData
.
totalCount
,
// 题目总数
}
commit
(
"SET_CURRENT_QUESTION"
,
newList
[
cIndex
]
||
{
titleNo
:
1
});
commit
(
"SET_QUESTION_LIST"
,
newList
);
commit
(
"SET_TITLE_CONIFG"
,
titleConfig
);
},
...
...
src/utils/fetch.js
浏览文件 @
b1bb00c8
...
...
@@ -14,9 +14,9 @@ service.interceptors.request.use(config => {
if
(
config
.
data
&&
config
.
data
.
setEntry
)
{
config
.
headers
[
'sysCode'
]
=
config
.
data
.
sysCode
||
10
if
(
config
.
data
.
token
)
{
config
.
headers
[
'token'
]
=
config
.
data
.
token
||
'9
98E10CD98ED4BCF91A28223270FE8CE
'
config
.
headers
[
'token'
]
=
config
.
data
.
token
||
'9
3521BDB92774134B2CC18633F2B6D3A
'
if
(
process
.
env
.
BUILD_ENV
==
"development"
)
{
// 本地开发环境
config
.
headers
[
'token'
]
=
config
.
data
.
token
||
'9
98E10CD98ED4BCF91A28223270FE8CE
'
;
config
.
headers
[
'token'
]
=
config
.
data
.
token
||
'9
3521BDB92774134B2CC18633F2B6D3A
'
;
}
}
delete
config
.
data
.
setEntry
;
...
...
src/utils/index.js
浏览文件 @
b1bb00c8
...
...
@@ -301,6 +301,7 @@ export function getOrderText(index) {
return
orderVac
[
index
];
}
// 从数组中查找某个key对应值所在的位置(序号:0开始的)
export
function
findQuestionIndexNo
(
oList
,
key
,
keyValue
)
{
let
index
=
oList
.
findIndex
(
item
=>
{
return
item
[
key
]
==
keyValue
;
...
...
@@ -308,3 +309,28 @@ export function findQuestionIndexNo(oList, key, keyValue) {
return
index
;
}
// 对两个数组中的元素进行排序
export
function
concatArray
(
firstArr
=
[],
secondArr
=
[],
key
)
{
if
(
firstArr
.
length
==
0
)
return
secondArr
;
if
(
secondArr
.
length
==
0
)
return
[];
let
all
=
[],
newArr
=
[],
deleteIndex
;
if
(
firstArr
[
0
][
key
]
==
secondArr
[
0
][
key
])
{
return
firstArr
;
}
else
if
(
firstArr
[
0
][
key
]
<
secondArr
[
0
][
key
])
{
all
=
firstArr
.
concat
(
secondArr
);
}
else
{
all
=
secondArr
.
concat
(
firstArr
);
}
// 从all中去重
for
(
let
i
=
0
;
i
<
all
.
length
;
i
++
)
{
deleteIndex
=
findQuestionIndexNo
(
all
.
slice
(
i
+
1
),
key
,
all
[
i
][
key
]);
if
(
deleteIndex
>=
0
)
{
all
.
splice
(
deleteIndex
,
1
);
i
--
;
}
}
console
.
log
(
"in contactArray"
,
all
);
return
all
;
}
src/utils/mixins.js
浏览文件 @
b1bb00c8
...
...
@@ -110,7 +110,7 @@ module.exports = {
// 通用GET请求
GET
(
api
,
para
,
callback
,
str
)
{
// debugger
let
token
=
para
.
token
||
this
.
token
||
this
.
$store
.
state
.
user
.
token
||
'9
98E10CD98ED4BCF91A28223270FE8CE
'
;
let
token
=
para
.
token
||
this
.
token
||
this
.
$store
.
state
.
user
.
token
||
'9
3521BDB92774134B2CC18633F2B6D3A
'
;
para
.
token
=
token
;
delete
para
.
token
;
delete
para
.
setEntry
;
...
...
@@ -148,8 +148,10 @@ module.exports = {
// 通用POST请求
POST
(
api
,
para
,
callback
)
{
let
token
=
para
.
token
||
this
.
token
||
this
.
$store
.
state
.
user
.
token
||
''
;
let
token
=
para
.
token
||
this
.
token
||
this
.
$store
.
state
.
user
.
token
||
'
93521BDB92774134B2CC18633F2B6D3A
'
;
para
.
token
=
token
;
delete
para
.
token
;
delete
para
.
setEntry
;
return
fetch
({
url
:
getBaseUrl
(
api
),
method
:
'post'
,
...
...
src/views/question-detail.vue
浏览文件 @
b1bb00c8
<
template
>
<section
class=
"question-detail-wrapper"
:style=
"
{'position': needFixed ? 'fixed': 'static'}">
<question-header
:title=
"currentTitle"
:order=
"currentQuestion.titleNo"
:total=
"titleConfig.totalCount"
></question-header>
<question-header
:title=
"currentTitle"
:order=
"currentQuestion.titleNo"
:total=
"titleConfig.totalCount"
></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"
@
pageQuestion=
"pageQuestion"
></question-footer>
<ExperienceDialog
:showDialog=
"experienceDialog"
@
activeCard=
"activeCard"
@
buyCard=
"buyCard"
@
close=
"experienceDialog = false"
></ExperienceDialog>
<ExperienceDialog
:showDialog=
"experienceDialog"
@
activeCard=
"activeCard"
@
buyCard=
"buyCard"
@
close=
"experienceDialog = false"
></ExperienceDialog>
<!-- 去激活 -->
<ChangeCard
...
...
@@ -26,7 +35,7 @@
@
handlerAction=
"handlerAction"
></CourseDialog>
<Loading
v-show=
"showLoading"
/>
<Loading
v-show=
"showLoading"
/>
<div
class=
"pt-70"
></div>
</section>
</
template
>
...
...
@@ -40,11 +49,11 @@ import Loading from "@/components/common/common-loading";
import
CourseDialog
from
"@/components/course/course-dialog"
;
import
ChangeCard
from
"@/components/cme/change-card"
;
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
import
{
Toast
}
from
"vant"
;
import
{
findQuestionIndexNo
}
from
"@/utils"
;
import
{
findQuestionIndexNo
,
contactArray
}
from
"@/utils"
;
let
titleArray
=
[
""
,
"
"
,
"免费体验"
,
"错题集
"
,
"收藏夹"
];
let
titleArray
=
[
""
,
"
错题集"
,
"收藏夹
"
,
"收藏夹"
];
export
default
{
components
:
{
QuestionHeader
,
...
...
@@ -54,7 +63,7 @@ export default {
ExperienceDialog
,
Loading
,
CourseDialog
,
ChangeCard
,
ChangeCard
},
data
()
{
return
{
...
...
@@ -63,9 +72,9 @@ export default {
cardType
:
3
,
goodsType
:
3
,
currentTitle
:
"试题集"
,
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
experienceDialog
:
false
,
// 体验结束弹框
showChangeCard
:
false
,
//是否展示激活弹框,
commitKind
:
1
,
// 答题来源 1:错题集 2:收藏 3:题库
experienceDialog
:
false
,
// 体验结束弹框
showChangeCard
:
false
,
//是否展示激活弹框,
changeCardErrorMsg
:
""
,
showBindCardTips
:
false
,
cmeCardModels
:
{
...
...
@@ -80,33 +89,86 @@ export default {
id
:
0
},
queryParams
:
{
commitKind
:
3
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
1748
,
// 题库ID,获取错题集或收藏时传0
pageFlag
:
0
,
// 翻页标记:0往前翻页 1往后翻页
pageSize
:
5
,
// 每页大小
secondSubjectId
:
106
,
// 二级学科分类ID:用于判断学科下目录免费题数
titleNo
:
0
,
// 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
commitKind
:
3
,
// 答题来源 1:错题集 2:收藏 3:题库
directoryId
:
1748
,
// 题库ID,获取错题集或收藏时传0
pageFlag
:
0
,
// 翻页标记:0往前翻页 1往后翻页
pageSize
:
5
,
// 每页大小
secondSubjectId
:
106
,
// 二级学科分类ID:用于判断学科下目录免费题数
titleNo
:
0
// 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
}
}
}
;
},
computed
:
{
...
mapGetters
([
'questionList'
,
'currentQuestion'
,
'totalCount'
,
'titleConfig'
]),
...
mapGetters
([
"questionList"
,
"currentQuestion"
,
"totalCount"
,
"titleConfig"
]),
needFixed
()
{
return
this
.
experienceDialog
||
this
.
showChangeCard
||
this
.
showBindCardTips
;
},
return
(
this
.
experienceDialog
||
this
.
showChangeCard
||
this
.
showBindCardTips
);
}
},
created
()
{
let
_this
=
this
;
this
.
directoryId
=
this
.
$route
.
query
.
directoryId
||
1
;
// 题库ID,获取错题集或收藏时传0
this
.
secondSubjectId
=
this
.
$route
.
query
.
secondSubjectId
||
1
;
// 学科id
this
.
cardType
=
this
.
$route
.
query
.
cardType
||
3
;
// 卡类型
this
.
goodsType
=
this
.
$route
.
query
.
goodsType
||
3
;
// 商品类型
this
.
commitKind
=
this
.
$route
.
query
.
commitKind
||
1
;
// 答题来源 1:错题集 2:收藏 3:题库
this
.
freeFlag
=
this
.
$route
.
query
.
freeFlag
||
0
;
// 0: 免费; 1: 收费;
this
.
currentTitle
=
this
.
$route
.
query
.
currentTitle
||
this
.
currentTitle
;
// 顶部导航文案
this
.
directoryId
=
this
.
$route
.
query
.
directoryId
||
1
;
// 题库ID,获取错题集或收藏时传0
this
.
secondSubjectId
=
this
.
$route
.
query
.
secondSubjectId
||
1
;
// 学科id
this
.
cardType
=
this
.
$route
.
query
.
cardType
||
3
;
// 卡类型
this
.
goodsType
=
this
.
$route
.
query
.
goodsType
||
3
;
// 商品类型
this
.
commitKind
=
this
.
$route
.
query
.
commitKind
||
3
;
// 答题来源 1:错题集 2:收藏 3:题库
this
.
freeFlag
=
this
.
$route
.
query
.
freeFlag
||
0
;
// 0: 免费; 1: 收费;
this
.
currentTitle
=
this
.
$route
.
query
.
currentTitle
||
this
.
currentTitle
;
// 顶部导航文案
this
.
init
();
let
firstArr
=
[
{
titleNo
:
1
,
name
:
"11"
},
{
titleNo
:
2
,
name
:
"11"
},
{
titleNo
:
3
,
name
:
"11"
},
{
titleNo
:
4
,
name
:
"11"
},
{
titleNo
:
5
,
name
:
"11"
}
];
let
secondArr
=
[
{
titleNo
:
3
,
name
:
"11"
},
{
titleNo
:
4
,
name
:
"11"
},
{
titleNo
:
5
,
name
:
"11"
},
{
titleNo
:
6
,
name
:
"11"
},
{
titleNo
:
7
,
name
:
"11"
}
];
window
.
__getUserInfoForQD
=
function
(
param
)
{
_this
.
token
=
param
.
userToken
;
_this
.
setUserInfo
(
param
);
...
...
@@ -114,7 +176,7 @@ export default {
// _this.checkToken();
};
if
(
__isWeb
)
{
if
(
__isWeb
)
{
this
.
getPractiseTitles
();
}
else
{
_this
.
getUserInfo
();
...
...
@@ -131,22 +193,21 @@ export default {
param
.
setEntry
=
true
;
_this
.
getProvinceIdByPosition
(
param
);
};
},
methods
:
{
...
mapActions
([
"setUserInfo"
,
"handlerQuestionList"
]),
init
()
{
if
(
this
.
commitKind
>=
2
&&
this
.
commitKind
<=
4
)
{
if
(
this
.
commitKind
>=
2
&&
this
.
commitKind
<=
4
)
{
this
.
currentTitle
=
titleArray
[
this
.
commitKind
];
}
this
.
$store
.
commit
(
'SET_COMMON_CONIFG'
,
{
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag
:
this
.
freeFlag
,
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:题库
commitKind
:
this
.
commitKind
// 答题来源 1:错题集 2:收藏 3:题库
});
this
.
getUserInfo
();
// this.getPractiseTitles();
...
...
@@ -162,10 +223,11 @@ export default {
// 统计当前信息
statistics
()
{
let
correctNum
=
0
,
errNum
=
0
,
rate
=
0
;
this
.
questionList
.
forEach
(
item
=>
{
if
(
item
.
commitKind
)
{
let
correctNum
=
0
,
errNum
=
0
,
rate
=
0
;
this
.
questionList
.
forEach
(
item
=>
{
if
(
item
.
commitKind
)
{
}
});
this
.
experienceDialog
=
true
;
...
...
@@ -185,7 +247,7 @@ export default {
},
buyCard
()
{
!
__isWeb
&&
this
.
confirm
()
!
__isWeb
&&
this
.
confirm
()
;
},
// 跳转到原生的购买页面
...
...
@@ -201,9 +263,9 @@ export default {
return
;
}
// 直接传入
题库ID(directory
Id)
// 直接传入
学科ID(secondSubject
Id)
let
pageUrl
=
getWebPageUrl
(
`/profexam/#/question-
detail?id=
${
this
.
directoryId
}
&bankName=
${
this
.
bankName
}
&directoryId=
${
this
.
directory
Id
}
`
`/profexam/#/question-
bank?id=
${
this
.
secondSubjectId
}
&secondSubjectId=
${
this
.
secondSubject
Id
}
`
);
let
paramList
=
[
{
...
...
@@ -247,7 +309,7 @@ export default {
// 处理提示信息框
handlerAction
(
type
)
{
if
(
type
==
1
)
{
if
(
type
==
1
)
{
// this.$sendBuriedData({
// component_tag: `882#88219`
// });
...
...
@@ -256,18 +318,20 @@ export default {
// this.$sendBuriedData({
// component_tag: `882#88218`
// });
this
.
beforeChangeCardAction
(
this
.
cmeCardModels
.
cardKey
,
true
)
this
.
beforeChangeCardAction
(
this
.
cmeCardModels
.
cardKey
,
true
)
;
}
},
// 分页获取题目(前、后翻页)
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
);
});
this
.
GET
(
`portal/titleTest/practise/titles`
,
this
.
queryParams
).
then
(
({
data
})
=>
{
this
.
currentTitleNo
=
data
.
currentTitleNo
;
this
.
handlerQuestionList
(
data
);
// this.handlerPractiseData(data.practiseTitleModelList);
console
.
log
(
data
);
}
);
},
// 将序号转成字母
...
...
@@ -277,24 +341,33 @@ export default {
// 处理返回的数据,并存储到store中
handlerPractiseData
(
questionList
)
{
let
handlerList
=
[],
question
,
option
,
optionList
=
[],
myAnswer
=
""
,
answer
=
""
;
questionList
.
forEach
(
(
item
,
index
)
=>
{
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
)
=>
{
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
);
console
.
log
(
"handlerList"
,
index
);
handlerList
.
push
(
question
);
});
console
.
log
(
'in handlerList'
,
handlerList
);
let
cIndex
=
findQuestionIndexNo
(
handlerList
,
'titleNo'
,
this
.
currentTitleNo
);
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
);
},
...
...
@@ -315,11 +388,11 @@ export default {
this
.
POST
(
"cme/projectCard/bind"
,
param
)
.
then
(
res
=>
{
isInTips
&&
(
_this
.
showBindCardTips
=
false
);
console
.
log
(
'in res'
,
res
,
isInTips
);
console
.
log
(
"in res"
,
res
,
isInTips
);
if
(
res
.
code
==
"000000"
)
{
if
(
!
res
.
data
)
{
if
(
isInTips
)
{
Toast
(
res
.
message
);
if
(
isInTips
)
{
Toast
(
res
.
message
);
}
else
{
_this
.
changeCardErrorMsg
=
"请输入正确的激活码"
;
}
...
...
@@ -330,12 +403,12 @@ export default {
// _this.getProjectInfoById();
}
}
else
{
Toast
(
res
.
message
);
Toast
(
res
.
message
);
}
})
.
catch
(
e
=>
{
console
.
log
(
'in catch'
,
isInTips
);
if
(
isInTips
)
{
console
.
log
(
"in catch"
,
isInTips
);
if
(
isInTips
)
{
Toast
(
"无效的激活码"
);
_this
.
showBindCardTips
=
false
;
}
else
{
...
...
@@ -349,7 +422,10 @@ export default {
let
param
=
{
setEntry
:
true
};
this
.
GET
(
`cme/projectCard/queryNoUsedCard/
${
this
.
goodsType
}
/
${
this
.
cardType
}
`
,
param
).
then
(({
data
})
=>
{
this
.
GET
(
`cme/projectCard/queryNoUsedCard/
${
this
.
goodsType
}
/
${
this
.
cardType
}
`
,
param
).
then
(({
data
})
=>
{
this
.
hasNoUsedCard
=
data
.
hasNoUsedCard
;
if
(
data
.
hasNoUsedCard
==
1
)
{
this
.
cmeCardModels
=
data
.
cmeCardModels
[
0
]
||
{};
...
...
@@ -389,14 +465,17 @@ export default {
let
param
=
{
area
:
provinceId
+
""
,
cardType
:
this
.
cardType
||
3
,
cardTypeList
:
[
this
.
cardType
||
3
],
goodsType
:
this
.
goodsType
,
cardTypeList
:
[
this
.
cardType
||
3
],
goodsType
:
this
.
goodsType
};
param
.
setEntry
=
true
;
this
.
POST
(
"trade/goods/cardList_v2"
,
param
).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
this
.
showLoading
=
false
;
this
.
cardInfo
=
(
res
.
data
&&
res
.
data
[
0
])
||
{
id
:
0
,
name
:
"题库卡"
};
this
.
cardInfo
=
(
res
.
data
&&
res
.
data
[
0
])
||
{
id
:
0
,
name
:
"题库卡"
};
this
.
subContent
=
`您已购买
${
this
.
cardInfo
.
goodsName
}
”,是否用此卡绑定并激活当前题库。题库卡激活码一旦使用,不可更改不可退回`
;
}
});
...
...
@@ -408,11 +487,9 @@ export default {
rocNative
.
getPositionData
({
__funcName
:
"__getPositionData"
});
},
},
}
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.question-detail-wrapper {
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录